Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions .github/actions/get-workflow-job-id/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@ name: Get workflow job id
description: Get the ID of the workflow job that is currently running.

inputs:
working-directory:
description: The working directory to use
default: ''
github-token:
description: GITHUB_TOKEN
required: true
Expand All @@ -19,12 +22,12 @@ runs:
using: composite
steps:
- name: Get job id and name or fail
# timeout-minutes is unsupported for composite workflows, see https://github.com/actions/runner/issues/1979
# timeout-minutes: 10
shell: bash
id: get-job-id
working-directory: ${{ inputs.working-directory }}
run: |
set -eux

python3 .github/scripts/get_workflow_job_id.py "${GITHUB_RUN_ID}" "${RUNNER_NAME}"
env:
GITHUB_TOKEN: ${{ inputs.github-token }}
52 changes: 48 additions & 4 deletions .github/workflows/mobile_job.yml
Original file line number Diff line number Diff line change
Expand Up @@ -92,14 +92,22 @@ on:
type: string
default: ''

outputs:
artifacts:
description: |
The list of artifacts from AWS in JSON format returned to the caller
value: ${{ jobs.mobile.outputs.artifacts }}

jobs:
job:
mobile:
name: ${{ inputs.job-name }} (${{ inputs.device-type }})
runs-on: ${{ inputs.runner }}
timeout-minutes: ${{ inputs.timeout }}
permissions:
id-token: write
contents: read
outputs:
artifacts: ${{ inputs.device-type == 'ios' && steps.ios-test.outputs.artifacts || inputs.device-type == 'android' && steps.android-test.outputs.artifacts || '[]' }}
steps:
- name: Clean workspace
run: |
Expand All @@ -112,7 +120,7 @@ jobs:
uses: aws-actions/configure-aws-credentials@v3
with:
role-to-assume: arn:aws:iam::308535385114:role/gha_workflow_mobile_job
# This could go up to 18000, the max duration enforced by the server side
# The max duration enforced by the server side
role-duration-seconds: 18000
aws-region: us-east-1

Expand Down Expand Up @@ -254,7 +262,16 @@ jobs:

echo "extra-data-output=${EXTRA_DATA_OUTPUT}" >> "${GITHUB_OUTPUT}"

- name: Get workflow job id
id: get-job-id
uses: ./test-infra/.github/actions/get-workflow-job-id
if: always()
with:
working-directory: test-infra
github-token: ${{ secrets.GITHUB_TOKEN }}

- name: Run iOS tests on devices
id: ios-test
if: ${{ inputs.device-type == 'ios' }}
shell: bash
working-directory: test-infra/tools/device-farm-runner
Expand All @@ -270,6 +287,7 @@ jobs:
DEVICE_TYPE: ${{ inputs.device-type }}
RUN_ID: ${{ github.run_id }}
RUN_ATTEMPT: ${{ github.run_attempt }}
JOB_ID: ${{ steps.get-job-id.outputs.job-id }}
run: |
set -ex

Expand All @@ -282,9 +300,22 @@ jobs:
--test-spec "${TEST_SPEC}" \
--name-prefix "${JOB_NAME}-${DEVICE_TYPE}" \
--workflow-id "${RUN_ID}" \
--workflow-attempt "${RUN_ATTEMPT}"
--workflow-attempt "${RUN_ATTEMPT}" \
--output "ios-artifacts-${JOB_ID}.json"

- name: Upload iOS artifacts to S3
uses: seemethere/upload-artifact-s3@v5
if: ${{ inputs.device-type == 'ios' }}
with:
retention-days: 14
s3-bucket: gha-artifacts
s3-prefix: |
device_farm/${{ github.run_id }}/${{ github.run_attempt }}/artifacts
path: |
test-infra/tools/device-farm-runner/ios-artifacts-${{ steps.get-job-id.outputs.job-id }}.json

- name: Run Android tests on devices
id: android-test
if: ${{ inputs.device-type == 'android' }}
shell: bash
working-directory: test-infra/tools/device-farm-runner
Expand All @@ -300,6 +331,7 @@ jobs:
DEVICE_TYPE: ${{ inputs.device-type }}
RUN_ID: ${{ github.run_id }}
RUN_ATTEMPT: ${{ github.run_attempt }}
JOB_ID: ${{ steps.get-job-id.outputs.job-id }}
run: |
set -ex

Expand All @@ -312,4 +344,16 @@ jobs:
--test-spec "${TEST_SPEC}" \
--name-prefix "${JOB_NAME}-${DEVICE_TYPE}" \
--workflow-id "${RUN_ID}" \
--workflow-attempt "${RUN_ATTEMPT}"
--workflow-attempt "${RUN_ATTEMPT}" \
--output "android-artifacts-${JOB_ID}.json"

- name: Upload Android artifacts to S3
uses: seemethere/upload-artifact-s3@v5
if: ${{ inputs.device-type == 'android' }}
with:
retention-days: 14
s3-bucket: gha-artifacts
s3-prefix: |
device_farm/${{ github.run_id }}/${{ github.run_attempt }}/artifacts
path: |
test-infra/tools/device-farm-runner/android-artifacts-${{ steps.get-job-id.outputs.job-id }}.json
Loading
Loading