Skip to content

Commit

Permalink
Artifact upload work for ODT
Browse files Browse the repository at this point in the history
  • Loading branch information
isarkis committed Jan 21, 2025
1 parent 0757659 commit bea5116
Show file tree
Hide file tree
Showing 2 changed files with 60 additions and 50 deletions.
10 changes: 7 additions & 3 deletions .github/actions/on_device_tests/action.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@ inputs:
results_dir:
description: "Path to directory where test results are saved."
required: true
test_results_key:
description: "Artifact key used to store test results."
required: true

runs:
using: "composite"
Expand Down Expand Up @@ -88,9 +91,10 @@ runs:
gsutil cp -r "${GCS_RESULTS_PATH}/" "${TEST_LOGS}"
echo "TEST_LOGS=${TEST_LOGS}" >> $GITHUB_ENV
shell: bash
- name: Archive Test Logs
- name: Archive Test Results
uses: actions/upload-artifact@v3
if: always()
with:
name: Test log
path: ${{ env.TEST_LOGS }}
name: ${{ inputs.test_results_key }}
path: ${{ env.TEST_LOGS }}/

100 changes: 53 additions & 47 deletions .github/workflows/main.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -193,6 +193,54 @@ jobs:
test_artifacts_key: ${{ env.TEST_ARTIFACTS_KEY }}
on_host: ${{ needs.initialize.outputs.test_on_host }}
on_device: ${{ needs.initialize.outputs.test_on_device }}

# Runs on-device integration and unit tests.
on-device-test:
needs: [initialize, build]
# Run ODT when on_device label is applied on PR.
# Also, run ODT on push and schedule if not explicitly disabled via repo vars.
if: needs.initialize.outputs.test_on_device == 'true' &&
((
github.event_name == 'pull_request' &&
contains(github.event.pull_request.labels.*.name, 'on_device') ) || ((
inputs.nightly == 'true' || github.event_name == 'schedule') &&
vars.RUN_ODT_TESTS_ON_NIGHTLY != 'False') ||
( github.event_name == 'push' && vars.RUN_ODT_TESTS_ON_POSTSUBMIT != 'False'
))
runs-on: [self-hosted, odt-runner]
name: ${{ matrix.name }}_on_device
permissions: {}
strategy:
fail-fast: false
matrix:
platform: ${{ fromJson(needs.initialize.outputs.platforms) }}
config: [devel]
include: ${{ fromJson(needs.initialize.outputs.includes) }}
env:
TEST_RESULTS_DIR: ${{ matrix.name }}_test_results
TEST_RESULTS_KEY: ${{ matrix.platform }}_${{ matrix.name }}_test_results
steps:
- name: Checkout
uses: kaidokert/[email protected]
timeout-minutes: 30
with:
fetch-depth: 1
persist-credentials: false
- name: Run On-Device Tests (${{ matrix.shard }})
id: on-device-tests
uses: ./.github/actions/on_device_tests
with:
test_artifacts_key: ${{ env.TEST_ARTIFACTS_KEY }}
gcs_results_path: gs://cobalt-unittest-storage/results/${{ matrix.name }}/${{ github.run_id }}
results_dir: ${{ env.TEST_RESULTS_DIR }}
- name: Process Test Results
if: always()
uses: ./.github/actions/process_test_results
with:
results_dir: ${{ env.TEST_RESULTS_DIR }}
datadog_api_key: ${{ secrets.DD_API_KEY }}
is_postsubmit: ${{ github.event_name == 'schedule' || github.event_name == 'push' }}
continue-on-error: true

on-host-test:
needs: [initialize, docker-build-image, build]
Expand Down Expand Up @@ -229,7 +277,11 @@ jobs:

test-upload:
needs: [initialize, docker-build-image, build, on-host-test]
if: always() && needs.initialize.outputs.test_on_host == 'true'
if: always() &&
(
needs.initialize.outputs.test_on_host == 'true' ||
needs.initialize.outputs.test_on_device == 'true'
)
permissions: {}
runs-on: [self-hosted, chrobalt-linux-runner]
name: ${{ matrix.name }}_tests_upload
Expand Down Expand Up @@ -277,49 +329,3 @@ jobs:
run: |
echo "Failing because at least one test shard had errors."
exit 1
# Runs on-device integration and unit tests.
on-device-test:
needs: [initialize, build]
# Run ODT when on_device label is applied on PR.
# Also, run ODT on push and schedule if not explicitly disabled via repo vars.
if: needs.initialize.outputs.test_on_device == 'true' &&
((
github.event_name == 'pull_request' &&
contains(github.event.pull_request.labels.*.name, 'on_device') ) || ((
inputs.nightly == 'true' || github.event_name == 'schedule') &&
vars.RUN_ODT_TESTS_ON_NIGHTLY != 'False') ||
( github.event_name == 'push' && vars.RUN_ODT_TESTS_ON_POSTSUBMIT != 'False'
))
runs-on: [self-hosted, odt-runner]
name: ${{ matrix.name }}_on_device
permissions: {}
strategy:
fail-fast: false
matrix:
platform: ${{ fromJson(needs.initialize.outputs.platforms) }}
config: [devel]
include: ${{ fromJson(needs.initialize.outputs.includes) }}
env:
TEST_RESULTS_DIR: ${{ matrix.name }}_test_results
steps:
- name: Checkout
uses: kaidokert/[email protected]
timeout-minutes: 30
with:
fetch-depth: 1
persist-credentials: false
- name: Run On-Device Tests (${{ matrix.shard }})
id: on-device-tests
uses: ./.github/actions/on_device_tests
with:
gcs_results_path: gs://cobalt-unittest-storage/results/${{ matrix.name }}/${{ github.run_id }}
results_dir: ${{ env.TEST_RESULTS_DIR }}
- name: Process Test Results
if: always()
uses: ./.github/actions/process_test_results
with:
results_dir: ${{ env.TEST_RESULTS_DIR }}
datadog_api_key: ${{ secrets.DD_API_KEY }}
is_postsubmit: ${{ github.event_name == 'schedule' || github.event_name == 'push' }}
continue-on-error: true

0 comments on commit bea5116

Please sign in to comment.