Always create check for Android render test, Take into account cancelled workflows (#2149)

This commit is contained in:
Bart Louwers
2024-02-27 19:28:05 +01:00
committed by GitHub
parent f4c6fabbe6
commit f27848fdaa
4 changed files with 14 additions and 28 deletions

View File

@@ -7,21 +7,7 @@ on:
- completed
jobs:
pre_job:
runs-on: ubuntu-latest
outputs:
should_skip: ${{ steps.check_skip.outputs.should_skip }}
steps:
# if android-build in android-ci was skipped, the android-device-test job can be skipped entirely
- id: check_skip
run: |
conclusion=$(curl ${{ github.event.workflow_run.jobs_url }} | jq -r '.jobs[] | select(.name == "android-build").conclusion')
should_skip=$([ "$conclusion" = "skipped" ] && echo "true" || echo "false")
echo "should_skip=$should_skip" >> "$GITHUB_OUTPUT"
android-device-test:
needs: pre_job
if: needs.pre_job.outputs.should_skip == 'false'
strategy:
max-parallel: 2
matrix:
@@ -51,11 +37,11 @@ jobs:
steps:
- uses: actions/checkout@v4
- name: Sanity check, test files should exist
uses: andstor/file-existence-action@v2.0.0
with:
files: "${{ matrix.test.testFile }}, ${{ matrix.test.appFile }}"
fail: true
- id: parent_workflow
run: |
conclusion=$(curl ${{ github.event.workflow_run.jobs_url }} | jq -r '.jobs[] | select(.name == "android-build").conclusion')
was_skipped=$([[ "$conclusion" = "skipped" || "$conclusion" = "cancelled" ]] && echo "true" || echo "false")
echo "was_skipped=$was_skipped" >> "$GITHUB_OUTPUT"
# get comment from PR
@@ -82,14 +68,15 @@ jobs:
# always run when something was merged into main
# run benchmark when comment with '!benchmark android' exists in PR
if: |
(github.event.workflow_run.head_branch == 'main' && github.event.workflow_run.event == 'push') ||
steps.parent_workflow.outputs.was_skipped == 'false' &&
((github.event.workflow_run.head_branch == 'main' && github.event.workflow_run.event == 'push') ||
matrix.test.name == 'Android Benchmark' && steps.benchmark_comment.outputs.comment-id ||
matrix.test.name != 'Android Benchmark'
matrix.test.name != 'Android Benchmark')
run:
echo "run_device_test=true" >> "$GITHUB_ENV"
- uses: LouisBrunner/checks-action@v2.0.0
if: env.run_device_test == 'true'
if: env.run_device_test == 'true' || matrix.test.name == 'Android Render Tests'
id: create_check
with:
token: ${{ steps.generate_token.outputs.token }}
@@ -102,6 +89,7 @@ jobs:
if: env.run_device_test == 'true'
with:
artifact-name: ${{ matrix.test.artifactName }}
expect-files: "${{ matrix.test.testFile }}, ${{ matrix.test.appFile }}"
- name: Configure AWS Credentials
if: env.run_device_test == 'true' && matrix.test.name == 'Android Benchmark'
@@ -141,7 +129,7 @@ jobs:
testSpecArn: ${{ matrix.test.testSpecArn }}
- uses: LouisBrunner/checks-action@v2.0.0
if: always() && env.run_device_test == 'true'
if: always() && (env.run_device_test == 'true' || matrix.test.name == 'Android Render Tests')
with:
token: ${{ steps.generate_token.outputs.token }}
check_id: ${{ steps.create_check.outputs.check_id }}