chore: fix missing test results in pipeline & refactor docker e2e testing (#4872)

This commit is contained in:
Karan 2021-11-30 11:51:11 -08:00 коммит произвёл GitHub
Родитель 9c632f0c5f
Коммит 1092bdb607
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 4AEE18F83AFDEB23
9 изменённых файлов: 68 добавлений и 54 удалений

Просмотреть файл

@ -133,7 +133,9 @@ jobs:
vmImage: $(linuxImage)
steps:
- template: pipeline/install-node-prerequisites.yaml
- template: pipeline/e2e-test-from-docker.yaml
- template: pipeline/run-tests-in-docker-linux.yaml
parameters:
target: web
- template: pipeline/e2e-test-publish-results.yaml
- job: 'e2e_unified_mac'
@ -150,7 +152,9 @@ jobs:
vmImage: $(linuxImage)
steps:
- template: pipeline/install-node-prerequisites.yaml
- template: pipeline/unified/unified-e2e-test-linux.yaml
- template: pipeline/run-tests-in-docker-linux.yaml
parameters:
target: unified
- template: pipeline/unified/unified-e2e-publish-results.yaml
- job: 'e2e_unified_windows'

Просмотреть файл

@ -28,5 +28,7 @@ jobs:
pool:
vmImage: ${{ parameters.linuxImage }}
steps:
- template: ./e2e-test-from-docker.yaml
- template: ./run-tests-in-docker-linux.yaml
parameters:
target: web
- template: ./e2e-test-publish-results.yaml

Просмотреть файл

@ -1,18 +0,0 @@
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License.
steps:
- script: docker build -t app --target web .
displayName: setup docker
- script: docker run --network=host -i app --ci
displayName: run e2e tests on docker
- bash: |
export CONTAINERID=$(docker ps -alq)
echo "##vso[task.setvariable variable=CONTAINER_ID]$CONTAINERID"
displayName: get container id for docker
condition: succeededOrFailed()
- script: docker cp $(CONTAINER_ID):/app/test-results/ .
displayName: copy test results from docker to base agent
condition: succeededOrFailed()

Просмотреть файл

@ -0,0 +1,50 @@
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License.
# This template:
# - builds and runs a given target in DOCKERFILE
# - copies /app/test-results & /app/drop back to the base agent
# - requires you to publish test results or artifacts in the consuming pipeline
# - could be applicable to any agent, but intentionally no-ops on non-linux agents
parameters:
- name: target # should be web or unified
type: string
- name: run-timeout-minutes
type: number
default: 30
steps:
- bash: |
if [ -z "$TARGET" ]; then
echo "##vso[task.logissue type=error;]Missing template parameter \"target\""
echo "##vso[task.complete result=Failed;]"
fi
env:
TARGET: ${{ parameters.target }}
condition: and(succeeded(), eq(variables['Agent.OS'], 'linux'))
displayName: (linux) make sure 'target' parameter is specified
# DOCKER_BUILDKIT=1 allows us to skip non-related targets (github docker/cli@1134)
- script: DOCKER_BUILDKIT=1 docker build -t app --target ${{ parameters.target }} .
displayName: (linux) setup docker
condition: and(succeeded(), eq(variables['Agent.OS'], 'linux'))
- script: docker run --network=host -i app --ci
displayName: (linux) run docker entrypoint
timeoutInMinutes: ${{ parameters['run-timeout-minutes'] }}
condition: and(succeeded(), eq(variables['Agent.OS'], 'linux'))
- bash: |
export CONTAINERID=$(docker ps -alq)
echo "##vso[task.setvariable variable=CONTAINER_ID]$CONTAINERID"
displayName: (linux) get container id for docker
condition: and(succeeded(), eq(variables['Agent.OS'], 'linux'))
- script: docker cp $(CONTAINER_ID):/app/test-results/ .
displayName: (linux) copy test results from docker to base agent
condition: and(succeeded(), eq(variables['Agent.OS'], 'linux'))
- script: docker cp $(CONTAINER_ID):/app/drop/ .
displayName: (linux) copy drop folder from docker to base agent
condition: and(succeeded(), eq(variables['Agent.OS'], 'linux'))

Просмотреть файл

@ -40,7 +40,6 @@ steps:
timeoutInMinutes: 5
- template: ./unified-e2e-test-interactive.yaml
- template: ./unified-e2e-publish-results.yaml
- script: yarn build:unified:all --unified-version=$(Build.BuildNumber) --unified-canary-instrumentation-key=$(UnifiedCanaryInstrumentationKey) --unified-insider-instrumentation-key=$(UnifiedInsiderInstrumentationKey) --unified-prod-instrumentation-key=$(UnifiedProdInstrumentationKey)

Просмотреть файл

@ -29,5 +29,7 @@ jobs:
vmImage: ${{ parameters.linuxImage }}
steps:
- template: ../install-node-prerequisites.yaml
- template: ./unified-e2e-test-linux.yaml
- template: ../run-tests-in-docker-linux.yaml
parameters:
target: unified
- template: ./unified-e2e-publish-results.yaml

Просмотреть файл

@ -4,6 +4,7 @@ steps:
- script: yarn build:unified
displayName: build:unified
timeoutInMinutes: 5
condition: and(succeeded(), ne(variables.platform, 'linux'))
# e2e tests require different job for linux
- script: yarn test:unified --ci
@ -11,11 +12,7 @@ steps:
condition: and(succeeded(), ne(variables.platform, 'linux'))
timeoutInMinutes: 22
- script: DOCKER_BUILDKIT=1 docker build -t app --target unified .
displayName: setup docker
condition: and(succeeded(), eq(variables.platform, 'linux'))
- script: docker run --network=host -i app sh -c "yarn test:unified --ci"
displayName: run unified tests on docker
condition: and(succeeded(), eq(variables.platform, 'linux'))
timeoutInMinutes: 22
- template: ../run-tests-in-docker-linux.yaml
parameters:
target: unified
run-timeout-minutes: 22

Просмотреть файл

@ -1,22 +0,0 @@
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License.
steps:
- script: DOCKER_BUILDKIT=1 docker build -t app --target unified .
displayName: setup docker
- script: docker run --network=host -i app sh -c "yarn test:unified --ci"
displayName: run e2e tests on docker
- bash: |
export CONTAINERID=$(docker ps -alq)
echo "##vso[task.setvariable variable=CONTAINER_ID]$CONTAINERID"
displayName: get container id for docker
condition: succeededOrFailed()
- script: docker cp $(CONTAINER_ID):/app/test-results/ .
displayName: copy test results from docker to base agent
condition: succeededOrFailed()
- script: docker cp $(CONTAINER_ID):/app/drop/ .
displayName: copy mock adb folder from docker to base agent
condition: succeededOrFailed()

Просмотреть файл

@ -12,4 +12,4 @@ export DEBUG=pw:api
echo "Executing command $@"
exec "$@"
yarn test:unified --ci