Skip to content

Commit

Permalink
test run conditionals
Browse files Browse the repository at this point in the history
  • Loading branch information
gartnera committed Jul 2, 2024
1 parent 5efdc85 commit 1075854
Show file tree
Hide file tree
Showing 2 changed files with 48 additions and 3 deletions.
50 changes: 47 additions & 3 deletions .github/workflows/e2e.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,24 +7,68 @@ on:
pull_request:
branches:
- "*"
merge_group:
workflow_dispatch:
schedule:
# run at 6AM UTC Daily
# 6AM UTC -> 11PM PT
- cron: "0 6 * * *"

jobs:
define-matrix:
runs-on: ubuntu-22.04
steps:
# use cli rather than event context to avoid race conditions (label added after push)
- name: PR
if: ${{ github.event_name == 'pull_request' }}
run: |
labels=$(gh pr view -R ${{github.repository}} ${{github.event.pull_request.number}} --json labels -q '.labels[].name' -r '.[]')
if [[ $labels == *"UPGRADE_TESTS"* ]]; then
if [[ $labels == *"LIGHT_UPGRADE_TESTS"* ]]; then
echo "UPGRADE_TESTS_LIGHT=true" >> $GITHUB_OUTPUT
else
echo "UPGRADE_TESTS=true" >> $GITHUB_OUTPUT
fi
fi
if [[ $labels == *"ADMIN_TESTS"* ]]; then
echo "ADMIN_TESTS=true" >> $GITHUB_OUTPUT
fi
- name: mergegroup
if: ${{ github.event_name == 'merge_group' }}
run: |
labels=$(gh pr view -R ${{github.repository}} ${{github.event.pull_request.number}} --json labels -q '.labels[].name' -r '.[]')
if [[ $labels == *"MINIMAL_TESTS"* ]]; then
exit
fi
# TODO: maybe run more tests here
echo "LIGHT_UPGRADE_TESTS=true" >> $GITHUB_OUTPUT
- name: schedule
if: ${{ github.event_name == 'schedule' }}
run: |
echo "UPGRADE_TESTS=true" >> $GITHUB_OUTPUT
echo "LIGHT_UPGRADE_TESTS=true" >> $GITHUB_OUTPUT
echo "ADMIN_TESTS=true" >> $GITHUB_OUTPUT
e2e:
needs: define-matrix
strategy:
matrix:
include:
- make-target: "start-e2e-test"
runs-on: ubuntu-20.04
run: true
- make-target: "start-upgrade-test"
runs-on: ubuntu-20.04
run: ${{ needs.define-matrix.outputs.UPGRADE_TESTS }}
- make-target: "start-upgrade-test-light"
runs-on: ubuntu-20.04
run: ${{ github.event_name == 'pull_request' && !contains(github.event.pull_request.labels.*.name, 'MINIMAL_CI') }}
name: ${{ matrix.make-target }}
run: ${{ needs.define-matrix.outputs.UPGRADE_TESTS_LIGHT }}
- make-target: "start-e2e-admin-test"
runs-on: ubuntu-20.04
run: ${{ needs.define-matrix.outputs.ADMIN_TESTS }}
name: e2e
uses: ./.github/workflows/reusable-e2e.yml
with:
make-target: ${{ matrix.make-target }}
Expand All @@ -33,7 +77,7 @@ jobs:
secrets: inherit
# this allows you to set a required status check
ok:
runs-on: ubuntu-latest
runs-on: ubuntu-22.04
needs: e2e
steps:
- run: echo "e2e tests passed"
1 change: 1 addition & 0 deletions .github/workflows/reusable-e2e.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ on:

jobs:
e2e:
name: ${{ inputs.make-target }}
if: ${{ inputs.run }}
runs-on: ${{ inputs.runs-on }}
timeout-minutes: ${{ inputs.timeout-minutes }}
Expand Down

0 comments on commit 1075854

Please sign in to comment.