Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add on-device tests #4739

Merged
merged 126 commits into from
Jan 31, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
126 commits
Select commit Hold shift + click to select a range
c5d48d1
Break out test targets into a separate config
isarkis Dec 14, 2024
ac2684b
Chrobalt on-device test work for Android
isarkis Dec 19, 2024
39eb494
Update params passed to ODT gateway
isarkis Dec 19, 2024
8ff567b
ODT Client code
Libzu Dec 20, 2024
a7dace2
Incremental commit based on review comments
isarkis Dec 23, 2024
c9f93a4
new changes for odt gateway
Libzu Jan 2, 2025
4a1c783
additional changes to odt gateway code
Libzu Jan 2, 2025
9ef1c4c
changing --archive_path in action.yaml
Libzu Jan 3, 2025
f1c937d
Additional changes for odt gateway
Libzu Jan 7, 2025
9287f88
Add additional argument for ODT gateway client
isarkis Jan 7, 2025
924b494
Additional improvements for odt gateway code
Libzu Jan 7, 2025
6b6d877
removing autogenerated files from pr
Libzu Jan 7, 2025
feacfac
moving odt gateway code from tools folder to cobalt/tools
Libzu Jan 7, 2025
3c86d6f
Introduce "test_dimension" key
isarkis Jan 7, 2025
5e5e5f5
Log and XML file processing
isarkis Jan 9, 2025
c8bf953
Update gateway client parameters
isarkis Jan 14, 2025
d7b0696
remove tag
isarkis Jan 14, 2025
0acf2cc
Parameter work
isarkis Jan 14, 2025
14fcb8c
Updated ODT Gateway Client code
Libzu Jan 16, 2025
2f09d39
New Modifications to ODT Gateway code
Libzu Jan 16, 2025
22ba293
Deleting erroneous file
isarkis Jan 16, 2025
6f5a260
Fix build dependency problem
isarkis Jan 16, 2025
fb0dbc7
Testing ODT trigger
isarkis Jan 17, 2025
26b0932
Fix github actions syntax error
isarkis Jan 17, 2025
8e8d116
Fix grpc proto paths
isarkis Jan 17, 2025
d0f748f
Fix command line arguments
isarkis Jan 18, 2025
65772a9
Testing ODT trigger
isarkis Jan 18, 2025
f6fe084
Hardcode runtime deps file
isarkis Jan 20, 2025
06ffb5a
Update deps archive path on device
isarkis Jan 20, 2025
c343979
Fix gsutil copy command
isarkis Jan 20, 2025
a2dc411
Fix test logs archival mechanism
isarkis Jan 20, 2025
1dcef08
Fix test result processing mechanism
isarkis Jan 20, 2025
0757659
Add removed unit tests back
isarkis Jan 20, 2025
488c881
Artifact upload work for ODT
isarkis Jan 21, 2025
cddc68b
Fix artifact upload mechanism
isarkis Jan 22, 2025
3904c9f
Merge branch 'chrobalt-odt-dev' of github.com:youtube/cobalt_sandbox …
oxve Jan 22, 2025
5a5c647
Lint and formatting
oxve Jan 22, 2025
6f20c76
Fix params processing, delete some dead code
oxve Jan 22, 2025
4381381
Remove dead code, minor refactoring
oxve Jan 22, 2025
a455108
Remove last traces of change_id param
oxve Jan 22, 2025
ef6b9ad
Add apk copying to artifact script
oxve Jan 22, 2025
a3ee0d8
Remove loading of gtest target from platform configs
oxve Jan 22, 2025
41375e9
Unify on-host and on-device test steps
oxve Jan 22, 2025
a47df72
Get target list from temp hardcoded json file
oxve Jan 22, 2025
0f07e80
Revert sandbox docker config
oxve Jan 22, 2025
019eb7a
Merge branch 'main' of github.com:youtube/cobalt into odt-integration…
oxve Jan 23, 2025
b2bc541
Fix inconsistent quote lint error
oxve Jan 23, 2025
5e26eca
Add missing backslash in params list
oxve Jan 23, 2025
505f753
Break out test targets into a separate config
isarkis Dec 14, 2024
d661480
Chrobalt on-device test work for Android
isarkis Dec 19, 2024
ded1c7a
Update params passed to ODT gateway
isarkis Dec 19, 2024
9b6f0e0
ODT Client code
Libzu Dec 20, 2024
79de31b
Incremental commit based on review comments
isarkis Dec 23, 2024
45d9969
new changes for odt gateway
Libzu Jan 2, 2025
f74f774
additional changes to odt gateway code
Libzu Jan 2, 2025
5b674ac
changing --archive_path in action.yaml
Libzu Jan 3, 2025
318c121
Additional changes for odt gateway
Libzu Jan 7, 2025
f6cfd7e
Add additional argument for ODT gateway client
isarkis Jan 7, 2025
82f228e
Additional improvements for odt gateway code
Libzu Jan 7, 2025
02209ec
removing autogenerated files from pr
Libzu Jan 7, 2025
ac128ff
moving odt gateway code from tools folder to cobalt/tools
Libzu Jan 7, 2025
9fb0007
Introduce "test_dimension" key
isarkis Jan 7, 2025
b6f6786
Log and XML file processing
isarkis Jan 9, 2025
94e115a
Update gateway client parameters
isarkis Jan 14, 2025
de4e817
remove tag
isarkis Jan 14, 2025
d0d5c8d
Parameter work
isarkis Jan 14, 2025
7b88ba7
Updated ODT Gateway Client code
Libzu Jan 16, 2025
fbd00a8
New Modifications to ODT Gateway code
Libzu Jan 16, 2025
4c07925
Deleting erroneous file
isarkis Jan 16, 2025
42c6bbf
Fix build dependency problem
isarkis Jan 16, 2025
be98ad0
Testing ODT trigger
isarkis Jan 17, 2025
ee7c0c4
Fix github actions syntax error
isarkis Jan 17, 2025
da7f17c
Fix grpc proto paths
isarkis Jan 17, 2025
e04f203
Fix command line arguments
isarkis Jan 18, 2025
5b47adf
Testing ODT trigger
isarkis Jan 18, 2025
54bf26e
Hardcode runtime deps file
isarkis Jan 20, 2025
87290dc
Update deps archive path on device
isarkis Jan 20, 2025
1348a70
Fix gsutil copy command
isarkis Jan 20, 2025
d350366
Fix test logs archival mechanism
isarkis Jan 20, 2025
4120de8
Fix test result processing mechanism
isarkis Jan 20, 2025
a98fe42
Add removed unit tests back
isarkis Jan 20, 2025
49e90eb
Artifact upload work for ODT
isarkis Jan 21, 2025
fa5d3fa
Fix artifact upload mechanism
isarkis Jan 22, 2025
6239a47
Fix wildcard for process test
isarkis Jan 22, 2025
6e19a00
Testing artifact download
isarkis Jan 23, 2025
c2b5458
Remove erroneous input to build action
isarkis Jan 23, 2025
90fde43
Remove extra gtest targets from android-arm4/x86
isarkis Jan 23, 2025
3d054ba
Trigger build
isarkis Jan 23, 2025
084903d
Fix gtest_target processing
isarkis Jan 23, 2025
592e200
Handle gtest_targets list
isarkis Jan 23, 2025
f101d25
Fix syntax error
isarkis Jan 23, 2025
182df6d
Refactor validate job to support ODT
oxve Jan 23, 2025
24edf87
Support fully qualified target names in odt client
oxve Jan 23, 2025
7f09441
Testing pattern matching
isarkis Jan 23, 2025
74a6dcc
Add shard number to ODT test results key
oxve Jan 23, 2025
07d73f6
Remove dash from test results key
oxve Jan 23, 2025
366b047
Add time to create archive command
oxve Jan 23, 2025
358ae4a
Bump actions/upload-artifact to v4 (v3 is deprecated)
oxve Jan 23, 2025
686c54e
Use default checkout action for odt job
isarkis Jan 23, 2025
ea1fc81
Fix build
isarkis Jan 23, 2025
66b6740
Merge branch 'odt-integration-hell' into odt-reintegration-hell
oxve Jan 23, 2025
b1c9e50
Fix merge conflict mistakes
oxve Jan 23, 2025
a0296ad
Fix missing filter config breaking ODTs
oxve Jan 23, 2025
d4d26de
fix more missed merge issues
oxve Jan 23, 2025
292b191
Reset deps list for single target artifacts
oxve Jan 24, 2025
dea15c0
Fix android packaging, reduce archive sizes
oxve Jan 24, 2025
3244f08
Fix android packaging
oxve Jan 24, 2025
e0b46d6
Move copying of test_targets.json to after cd
oxve Jan 24, 2025
299aad5
Clarify some names
oxve Jan 25, 2025
93afdf8
Remove failing test targets, add filter for failing test
oxve Jan 25, 2025
268c9e4
Fix linux packaging
oxve Jan 25, 2025
15fe0e2
Use requirements file for grpc deps
oxve Jan 27, 2025
3d9b5c9
Cleanup
oxve Jan 27, 2025
060cd1e
Clean up ODT vars
oxve Jan 28, 2025
69f45b0
Re-add other configs, remove shard from odt job name
oxve Jan 28, 2025
093782a
Refine comments in test archiving script
oxve Jan 28, 2025
4804455
Refine comments in proto file
oxve Jan 28, 2025
0777f32
Re-add missing parameter
oxve Jan 28, 2025
9a73647
Do not add array to deps set
oxve Jan 28, 2025
bfe3231
Fix ghcr path for main repo
oxve Jan 28, 2025
7b20c40
Fix path to reqs file, add trailing comma
oxve Jan 28, 2025
5208bd9
Remove TODO, break long command
oxve Jan 28, 2025
f5a1f5e
Only filter android test archives
oxve Jan 29, 2025
ae7ca24
Merge branch 'main' of github.com:youtube/cobalt into odt-integration…
oxve Jan 29, 2025
82f3097
Remove targets from executables list
oxve Jan 30, 2025
89052a7
Merge branch 'main' of github.com:youtube/cobalt into odt-integration…
oxve Jan 31, 2025
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
93 changes: 89 additions & 4 deletions .github/actions/on_device_tests/action.yaml
Original file line number Diff line number Diff line change
@@ -1,9 +1,94 @@
name: On Host Tests
description: Runs on-host tests.
name: On Device Test
description: Runs on-device tests.
inputs:
gcs_results_path:
description: "GCS path for the test results"
required: true
test_results_key:
description: "Artifact key used to store test results."
required: true

runs:
using: "composite"
steps:
- name: Run On-Device Tests
- name: Install Requirements
run: |
pip3 install --require-hashes --no-deps -r ${GITHUB_WORKSPACE}/cobalt/tools/requirements.txt
shell: bash
- name: Generate gRPC files
run: |
python -m grpc_tools.protoc -I${GITHUB_WORKSPACE}/cobalt/tools/ \
--python_out=${GITHUB_WORKSPACE}/cobalt/tools/ \
--grpc_python_out=${GITHUB_WORKSPACE}/cobalt/tools/ \
${GITHUB_WORKSPACE}/cobalt/tools/on_device_tests_gateway.proto
shell: bash
- name: Set Up Cloud SDK
uses: isarkis/setup-gcloud@40dce7857b354839efac498d3632050f568090b6 # v1.1.1
- name: Set GCS Project Name
run: |
echo "PROJECT_NAME=$(gcloud config get-value project)" >> $GITHUB_ENV
shell: bash
- name: Run Tests on ${{ matrix.platform }} Platform
env:
GCS_ARTIFACTS_PATH: /bigstore/${{ env.PROJECT_NAME }}-test-artifacts/${{ github.workflow }}/${{ github.run_number }}/${{ matrix.platform }}
GCS_RESULTS_PATH: gs://cobalt-unittest-storage/results/${{ matrix.name }}/${{ github.run_id }}
GITHUB_SHA: ${{ github.sha }}
GITHUB_TOKEN: ${{ github.token }}
GITHUB_EVENT_NAME: ${{ github.event_name }}
GITHUB_ACTOR: ${{ github.actor }}
GITHUB_TRIGGERING_ACTOR: ${{ github.triggering_actor }}
GITHUB_ACTOR_ID: ${{ github.actor_id }}
GITHUB_REPO: ${{ github.repository }}
GITHUB_PR_HEAD_USER_LOGIN: ${{ github.event.pull_request.head.user.login }}
GITHUB_PR_HEAD_USER_ID: ${{ github.event.pull_request.head.user.id }}
GITHUB_COMMIT_AUTHOR_USERNAME: ${{ github.event.commits[0].author.username }}
GITHUB_COMMIT_AUTHOR_EMAIL: ${{ github.event.commits[0].author.email }}
GITHUB_PR_NUMBER: ${{ github.event.pull_request.number }}
GITHUB_RUN_NUMBER: ${{ github.run_number }}
GITHUB_RUN_URL: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}
GITHUB_WORKFLOW: ${{ github.workflow }}
# TODO(b/382508397): Replace hardcoded list with dynamically generated one.
TEST_TARGETS_JSON_FILE: cobalt/build/testing/targets/${{ matrix.platform }}/test_targets.json
run: |
set -uxe
python3 -u cobalt/tools/on_device_tests_gateway_client.py \
--token ${GITHUB_TOKEN} \
trigger \
--targets $(cat "${{ env.TEST_TARGETS_JSON_FILE }}" | jq -cr '.test_targets | join(",")') \
--filter_json_dir "${GITHUB_WORKSPACE}/cobalt/testing/filters/${{ matrix.platform}}" \
--label github_${GITHUB_PR_NUMBER:-postsubmit} \
--label builder-${{ matrix.platform }} \
--label builder_url-${GITHUB_RUN_URL} \
--label github \
--label ${GITHUB_EVENT_NAME} \
--label ${GITHUB_WORKFLOW} \
--label actor-${GITHUB_ACTOR} \
--label actor_id-${GITHUB_ACTOR_ID} \
--label triggering_actor-${GITHUB_TRIGGERING_ACTOR} \
--label sha-${GITHUB_SHA} \
--label repository-${GITHUB_REPO} \
--label author-${GITHUB_PR_HEAD_USER_LOGIN:-$GITHUB_COMMIT_AUTHOR_USERNAME} \
--label author_id-${GITHUB_PR_HEAD_USER_ID:-$GITHUB_COMMIT_AUTHOR_EMAIL} \
${DIMENSION:+"--dimension" "$DIMENSION"} \
${ON_DEVICE_TEST_ATTEMPTS:+"--test_attempts" "$ON_DEVICE_TEST_ATTEMPTS"} \
--gcs_archive_path "${GCS_ARTIFACTS_PATH}" \
--gcs_result_path "${GCS_RESULTS_PATH}"
shell: bash
- name: Download ${{ matrix.platform }} Test Results from GCS
if: always()
env:
GCS_RESULTS_PATH: ${{ inputs.gcs_results_path }}
run: |
echo "Nothing yet"
set -uxe
test_output="${GITHUB_WORKSPACE}/results"
echo "test_output=${test_output}" >> $GITHUB_ENV

mkdir -p "${test_output}"
gsutil cp -r "${GCS_RESULTS_PATH}/" "${test_output}"
shell: bash
- name: Archive Test Results
uses: actions/upload-artifact@v4
if: always()
with:
name: ${{ inputs.test_results_key }}
path: ${{ env.test_output }}/*
2 changes: 1 addition & 1 deletion .github/actions/on_host_tests/action.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -82,5 +82,5 @@ runs:
if: success() || failure()
uses: actions/upload-artifact@v4
with:
name: ${{ inputs.test_results_key }}-${{ matrix.shard }}
name: ${{ inputs.test_results_key }}
path: ${{ env.results_dir }}/shard_${{ matrix.shard }}/*.xml
2 changes: 1 addition & 1 deletion .github/actions/process_test_results/action.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ runs:
- name: Download Test Results
uses: actions/download-artifact@v4
with:
pattern: ${{ inputs.test_results_key }}-*
pattern: ${{ inputs.test_results_key }}*
path: results/**/*

- name: Test Summary action
Expand Down
37 changes: 20 additions & 17 deletions .github/actions/upload_test_artifacts/action.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,27 +16,16 @@ inputs:
runs:
using: "composite"
steps:
- name: Set up Cloud SDK
if: inputs.upload_on_device_test_artifacts == 'true'
uses: isarkis/setup-gcloud@40dce7857b354839efac498d3632050f568090b6 # v1.1.1
- name: Upload Android Test Artifacts to GCS
if: inputs.upload_on_device_test_artifacts == 'true'
env:
WORKFLOW: ${{ github.workflow }}
run: |
set -eux
project_name=$(gcloud config get-value project)
gsutil cp "${GITHUB_WORKSPACE}/src/out/${{ matrix.platform }}_${{ matrix.config }}/**/*.apk" \
"gs://${project_name}-test-artifacts/${WORKFLOW}/${GITHUB_RUN_NUMBER}/${{matrix.platform}}/"
shell: bash

- name: Create On-Host Test Artifacts Archive
if: inputs.upload_on_host_test_artifacts == 'true'
- name: Archive Test Artifacts
run: |
set -x
mkdir ${GITHUB_WORKSPACE}/artifacts
cd src/
./cobalt/build/archive_test_artifacts.py \

# Put test targets json file in the out folder for the archiving script to pick up.
cp "${{ inputs.test_targets_json_file }}" out/${{ matrix.platform }}_${{ matrix.config }}/

time ./cobalt/build/archive_test_artifacts.py \
--source out/${{ matrix.platform }}_${{ matrix.config }}/ \
--destination ${GITHUB_WORKSPACE}/artifacts \
--platform ${{ matrix.platform }} \
Expand All @@ -49,3 +38,17 @@ runs:
name: ${{ inputs.test_artifacts_key }}
path: artifacts/*
retention-days: 3
- name: Set up Cloud SDK
if: inputs.upload_on_device_test_artifacts == 'true'
uses: isarkis/setup-gcloud@40dce7857b354839efac498d3632050f568090b6 # v1.1.1
- name: Upload Android Test Artifacts to GCS
if: inputs.upload_on_device_test_artifacts == 'true'
env:
WORKFLOW: ${{ github.workflow }}
run: |
set -eux
project_name=$(gcloud config get-value project)

gsutil cp "${GITHUB_WORKSPACE}/artifacts/*" \
"gs://${project_name}-test-artifacts/${WORKFLOW}/${GITHUB_RUN_NUMBER}/${{matrix.platform}}/"
shell: bash
5 changes: 5 additions & 0 deletions .github/config/android-arm.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,11 @@
"platforms": [
"android-arm"
],
"test_on_device": true,
"test_dimensions": {
"gtest_device": "sabrina",
"gtest_lab": "maneki"
},
"targets": [
"content_shell",
"cobalt:gn_all"
Expand Down
10 changes: 0 additions & 10 deletions .github/config/chromium_android-arm.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,6 @@
"chromium_android-arm"
],
"targets": [
"base_unittests",
"sql_unittests",
"net_unittests",
"url_unittests",
"ipc_tests",
"mojo_unittests",
"gpu_unittests",
"gin_unittests",
"blink_unittests",
"media_unittests",
"content_shell",
"system_webview_apk",
"system_webview_shell_apk"
Expand Down
10 changes: 0 additions & 10 deletions .github/config/chromium_android-arm64.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,6 @@
"chromium_android-arm64"
],
"targets": [
"base_unittests",
"sql_unittests",
"net_unittests",
"url_unittests",
"ipc_tests",
"mojo_unittests",
"gpu_unittests",
"gin_unittests",
"blink_unittests",
"media_unittests",
"content_shell",
"system_webview_apk",
"system_webview_shell_apk"
Expand Down
10 changes: 0 additions & 10 deletions .github/config/chromium_android-x86.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,6 @@
"chromium_android-x86"
],
"targets": [
"base_unittests",
"sql_unittests",
"net_unittests",
"url_unittests",
"ipc_tests",
"mojo_unittests",
"gpu_unittests",
"gin_unittests",
"blink_unittests",
"media_unittests",
"content_shell",
"system_webview_apk",
"system_webview_shell_apk"
Expand Down
77 changes: 58 additions & 19 deletions .github/workflows/main.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@
group: ${{ github.workflow }}-${{ github.event_name }}-${{ inputs.platform }} @ ${{ github.event.label.name || github.event.pull_request.number || github.sha }} @ ${{ github.event.label.name && github.event.pull_request.number || github.event.action }}
cancel-in-progress: true

# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
# Retrieves configuration from json file.
initialize:
Expand Down Expand Up @@ -92,7 +91,7 @@
num_gtest_shards=$(cat ${GITHUB_WORKSPACE}/.github/config/${{ inputs.platform }}.json | jq -rc '.num_gtest_shards' || echo 1)
echo "num_gtest_shards=${num_gtest_shards}" >> $GITHUB_ENV

# create a zero-indexed list of shards for use by matrix, e.g. [0,1,2,3,4,5]
# Create a zero-indexed list of shards for use by matrix, e.g. [0,1,2,3,4,5].
gtest_shards="[$(seq -s, 0 1 $((${num_gtest_shards} - 1)))]"
echo "gtest_shards=${gtest_shards}" >> $GITHUB_ENV
outputs:
Expand Down Expand Up @@ -134,7 +133,6 @@
outputs:
docker_tag: ${{ env.docker_tag }}

# Runs builds.
build:
needs: [initialize, docker-build-image]
permissions: {}
Expand Down Expand Up @@ -183,9 +181,44 @@
upload_on_host_test_artifacts: ${{ matrix.config == 'devel' && needs.initialize.outputs.test_on_host }}
upload_on_device_test_artifacts: ${{ matrix.config == 'devel' && needs.initialize.outputs.test_on_device }}

test:
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_tests
permissions: {}
strategy:
fail-fast: false
matrix:
platform: ${{ fromJson(needs.initialize.outputs.platforms) }}
include: ${{ fromJson(needs.initialize.outputs.includes) }}
config: [devel]
oxve marked this conversation as resolved.
Show resolved Hide resolved
env:
TEST_RESULTS_KEY: ${{ matrix.platform }}_${{ matrix.name }}_test_results
steps:
- name: Checkout
uses: actions/checkout@v4

Check warning

Code scanning / Scorecard

Pinned-Dependencies Medium

score is 0: GitHub-owned GitHubAction not pinned by hash
Remediation tip: update your workflow using https://app.stepsecurity.io
Click Remediation section below for further remediation help
timeout-minutes: 30
with:
fetch-depth: 1
persist-credentials: false
- name: Run On-Device Tests
id: on-device-tests
uses: ./.github/actions/on_device_tests
with:
test_results_key: ${{ env.TEST_RESULTS_KEY }}
gcs_results_path: gs://cobalt-unittest-storage/results/${{ matrix.name }}/${{ github.run_id }}

on-host-test:
needs: [initialize, docker-build-image, build]
if: needs.initialize.outputs.test_on_host == 'true' || needs.initialize.outputs.test_on_device == 'true'
if: always() && needs.initialize.outputs.test_on_host == 'true'
permissions: {}
# TODO(b/372303096): Should have dedicated runner?
runs-on: [self-hosted, chrobalt-linux-runner]
Expand All @@ -201,38 +234,36 @@
env:
TMPDIR: /__w/_temp
TEST_ARTIFACTS_KEY: ${{ matrix.platform }}_${{ matrix.name }}_test_artifacts
TEST_RESULTS_KEY: ${{ matrix.platform }}_${{ matrix.name }}_test_results
TEST_RESULTS_KEY: ${{ matrix.platform }}_${{ matrix.name }}_test_results-${{ matrix.shard }}
imindich marked this conversation as resolved.
Show resolved Hide resolved
steps:
- name: Checkout
uses: actions/checkout@v4
with:
path: src
- name: Run On-Host Tests
id: on-host-tests
if: always() && needs.initialize.outputs.test_on_host == 'true'
uses: ./src/.github/actions/on_host_tests
with:
test_artifacts_key: ${{ env.TEST_ARTIFACTS_KEY }}
test_results_key: ${{ env.TEST_RESULTS_KEY }}
num_gtest_shards: ${{ needs.initialize.outputs.num_gtest_shards }}

test-upload:
needs: [initialize, docker-build-image, build, test]
needs: [initialize, on-host-test, on-device-test]
if: always() &&
(
needs.initialize.outputs.test_on_host == 'true' ||
needs.initialize.outputs.test_on_device == 'true'
)
(
needs.initialize.outputs.test_on_host == 'true' ||
needs.initialize.outputs.test_on_device == 'true'
)
permissions: {}
runs-on: [self-hosted, chrobalt-linux-runner]
runs-on: ubuntu-latest
name: ${{ matrix.name }}_tests_upload
strategy:
fail-fast: false
matrix:
platform: ${{ fromJson(needs.initialize.outputs.platforms) }}
include: ${{ fromJson(needs.initialize.outputs.includes) }}
config: [devel]
container: ${{ needs.docker-build-image.outputs.docker_tag }}
env:
TMPDIR: /__w/_temp
TEST_ARTIFACTS_KEY: ${{ matrix.platform }}_${{ matrix.name }}_test_artifacts
Expand All @@ -249,8 +280,9 @@
datadog_api_key: ${{ secrets.datadog_api_key }}
continue-on-error: true


validate-test-result:
needs: [initialize, docker-build-image, build, test]
needs: [initialize, on-device-test, on-host-test]
if: always() &&
(
needs.initialize.outputs.test_on_host == 'true' ||
Expand All @@ -265,8 +297,15 @@
include: ${{ fromJson(needs.initialize.outputs.includes) }}
config: [devel]
steps:
- name: Fail if any test shards have failed
if: ${{ needs.test.result != 'success' }}
- name: Check Status
if: ${{ ! (needs.on-device-test.result == 'success' || needs.on-host-test.result == 'success') }}
run: |
echo "Failing because at least one test shard had errors."
exit 1
if [ "${{ needs.on-device-test.result }}" != "success" ]; then
echo "On device tests failed. See separate job log for details."
exit 1
fi
oxve marked this conversation as resolved.
Show resolved Hide resolved

if [ "${{ needs.on-host-test.result }}" != "success" ]; then
echo "On host tests failed. See separate job log for details."
exit 1
fi
Loading
Loading