python sdagksdhjkahsdkja #82
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Dispatcher Workflow | |
permissions: | |
contents: read | |
actions: read | |
id-token: write | |
on: | |
push: | |
branches-ignore: | |
- 'main' | |
jobs: | |
setup_dispatch: # This job sets up variables that determine if create and/or sanity test need to be run. | |
runs-on: ubuntu-latest | |
outputs: | |
trigger_create: ${{ steps.set_trigger.outputs.trigger_create }} | |
trigger_sanity_test: ${{ steps.set_trigger.outputs.trigger_sanity_test }} | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set flags for create channel and sanity test | |
id: set_trigger | |
run: './.github/workflows/dispatcher.sh' | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
GITHUB_SHA: ${{ github.sha }} | |
GITHUB_REF: ${{ github.ref }} | |
- name: results | |
run: | | |
echo "trigger_create: ${{ steps.set_trigger.outputs.trigger_create }}" | |
echo "trigger_sanity_test: ${{ steps.set_trigger.outputs.trigger_sanity_test }}" | |
run_create_channel: | |
needs: setup_dispatch | |
if: ${{ needs.setup_dispatch.outputs.trigger_create == 'true' }} | |
uses: ./.github/workflows/create-channel.yml | |
secrets: | |
AWS_S3_BUCKET: ${{ secrets.AWS_S3_BUCKET }} | |
CRT_CI_ROLE_ARN: ${{ secrets.CRT_CI_ROLE_ARN }} | |
AWS_ECR_REPO: ${{ secrets.AWS_ECR_REPO }} | |
sanity_test_after_create_channel: | |
needs: [setup_dispatch, run_create_channel] | |
if: ${{ needs.setup_dispatch.outputs.trigger_sanity_test == 'true' && needs.setup_dispatch.outputs.trigger_create == 'true' }} | |
uses: ./.github/workflows/sanity-test.yml | |
secrets: | |
AWS_S3_BUCKET: ${{ secrets.AWS_S3_BUCKET }} | |
CRT_CI_ROLE_ARN: ${{ secrets.CRT_CI_ROLE_ARN }} | |
AWS_ECR_REPO: ${{ secrets.AWS_ECR_REPO }} | |
sanity_test_skip_create_channel: | |
needs: setup_dispatch | |
if: ${{ needs.setup_dispatch.outputs.trigger_sanity_test == 'true' && needs.setup_dispatch.outputs.trigger_create != 'true' }} | |
uses: ./.github/workflows/sanity-test.yml | |
secrets: | |
AWS_S3_BUCKET: ${{ secrets.AWS_S3_BUCKET }} | |
CRT_CI_ROLE_ARN: ${{ secrets.CRT_CI_ROLE_ARN }} | |
AWS_ECR_REPO: ${{ secrets.AWS_ECR_REPO }} | |
validate_tests_passed: | |
needs: [setup_dispatch, run_create_channel, sanity_test_after_create_channel, sanity_test_skip_create_channel] | |
if: always() | |
runs-on: ubuntu-latest | |
steps: | |
- name: Check all jobs succeeded | |
run: | | |
for result in "${{ needs.run_create_channel.result }}" "${{ needs.sanity_test_after_create_channel.result }}" "${{ needs.sanity_test_skip_create_channel.result }}"; do | |
if [[ "$result" != "success" && "$result" != "skipped" ]]; then | |
echo "One or more jobs failed, were cancelled, or had errors (result: $result)" | |
exit 1 | |
fi | |
done | |
echo "All required jobs have completed successfully" |