Skip to content

Commit

Permalink
ci: carry forward the previous success of an integration test
Browse files Browse the repository at this point in the history
  • Loading branch information
mhofman committed Aug 30, 2023
1 parent 1289bc4 commit ba8d3f7
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
3 changes: 2 additions & 1 deletion .github/workflows/integration.yml
Original file line number Diff line number Diff line change
Expand Up @@ -277,7 +277,7 @@ jobs:
- getting-started
- deployment-test
- test-docker-build
if: needs.pre_check.outputs.should_run == 'true' && (success() || failure() || cancelled())
if: (needs.pre_check.outputs.should_run == 'true' || needs.pre_check.outputs.previous_success == 'true') && (success() || failure() || cancelled())
runs-on: ubuntu-latest
steps:
- name: Check job results
Expand All @@ -286,6 +286,7 @@ jobs:
cat <<EOF
needs ${{ toJSON(needs) }}
EOF
[ "${{ needs.pre_check.outputs.previous_success }}" = "true" ] && exit 0
[ "${{ needs.getting-started.result }}" = "success" ] || exit 1
[ "${{ needs.deployment-test.result }}" = "success" ] || exit 1
[ "${{ needs.test-docker-build.result }}" = "success" ] || exit 1
9 changes: 9 additions & 0 deletions .github/workflows/pre-check-integration.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@ on:
should_run:
description: "'true' if the test should run"
value: "${{ jobs.check_and_cancel.outcome != 'skipped' && jobs.check_and_cancel.outputs.should_skip != 'true' }}"
previous_success:
description: "'true' if should not run because of a previous successful run"
value: "${{ jobs.check_and_cancel.outcome != 'skipped' && jobs.check_and_cancel.outputs.previous_success == 'true' }}"
merge_requested:
description: "'true' if pull_request was requested for merge"
value: >-
Expand Down Expand Up @@ -49,6 +52,12 @@ jobs:
runs-on: ubuntu-latest
outputs:
should_skip: ${{ (steps.step2.outcome == 'skipped' || steps.step2.outputs.concurrent_conclusion == 'success') && steps.step1.outputs.should_skip || 'false' }}
previous_success: >-
${{
(steps.step2.outcome == 'skipped' && steps.step1.outputs.reason == 'skip_after_successful_duplicate' && 'true') ||
(steps.step2.outputs.concurrent_conclusion == 'success' && 'true') ||
'false'
}}
steps:
- id: step1
uses: fkirc/skip-duplicate-actions@v5
Expand Down

0 comments on commit ba8d3f7

Please sign in to comment.