ci: optimize upgrade tests by downloading binaries (#2433) #105
This file contains 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: e2e | |
on: | |
push: | |
branches: | |
- develop | |
pull_request: | |
branches: | |
- "*" | |
merge_group: | |
workflow_dispatch: | |
schedule: | |
# run at 6AM UTC Daily | |
# 6AM UTC -> 11PM PT | |
- cron: "0 6 * * *" | |
concurrency: | |
group: e2e-${{ github.head_ref || github.sha }} | |
cancel-in-progress: true | |
jobs: | |
matrix-conditionals: | |
runs-on: ubuntu-22.04 | |
env: | |
GH_TOKEN: ${{ github.token }} | |
outputs: | |
DEFAULT_TESTS: ${{ steps.matrix-conditionals.outputs.DEFAULT_TESTS }} | |
UPGRADE_TESTS: ${{ steps.matrix-conditionals.outputs.UPGRADE_TESTS }} | |
UPGRADE_LIGHT_TESTS: ${{ steps.matrix-conditionals.outputs.UPGRADE_LIGHT_TESTS }} | |
ADMIN_TESTS: ${{ steps.matrix-conditionals.outputs.ADMIN_TESTS }} | |
steps: | |
# use cli rather than event context to avoid race conditions (label added after push) | |
- id: matrix-conditionals | |
run: | | |
if [[ ${{ github.event_name }} == 'pull_request' ]]; then | |
echo "DEFAULT_TESTS=true" >> $GITHUB_OUTPUT | |
labels=$(gh pr view -R ${{github.repository}} ${{github.event.pull_request.number}} --json labels -q '.labels[].name') | |
if [[ "$labels" == *"UPGRADE_TESTS"* ]]; then | |
echo "UPGRADE_TESTS=true" >> $GITHUB_OUTPUT | |
fi | |
if [[ "$labels" == *"UPGRADE_LIGHT_TESTS"* ]]; then | |
echo "UPGRADE_LIGHT_TESTS=true" >> $GITHUB_OUTPUT | |
fi | |
if [[ "$labels" == *"ADMIN_TESTS"* ]]; then | |
echo "ADMIN_TESTS=true" >> $GITHUB_OUTPUT | |
fi | |
elif [[ ${{ github.event_name }} == 'merge_group' ]]; then | |
echo "DEFAULT_TESTS=true" >> $GITHUB_OUTPUT | |
elif [[ ${{ github.event_name }} == 'push' && ${{ github.ref }} == 'refs/heads/develop' ]]; then | |
echo "DEFAULT_TESTS=true" >> $GITHUB_OUTPUT | |
elif [[ ${{ github.event_name }} == 'schedule' ]]; then | |
echo "UPGRADE_TESTS=true" >> $GITHUB_OUTPUT | |
echo "UPGRADE_LIGHT_TESTS=true" >> $GITHUB_OUTPUT | |
echo "ADMIN_TESTS=true" >> $GITHUB_OUTPUT | |
fi | |
e2e: | |
needs: matrix-conditionals | |
strategy: | |
fail-fast: false | |
matrix: | |
include: | |
- make-target: "start-e2e-test" | |
runs-on: ubuntu-20.04 | |
run: ${{ needs.matrix-conditionals.outputs.DEFAULT_TESTS == 'true' }} | |
- make-target: "start-upgrade-test" | |
runs-on: ubuntu-20.04 | |
run: ${{ needs.matrix-conditionals.outputs.UPGRADE_TESTS == 'true' }} | |
- make-target: "start-upgrade-test-light" | |
runs-on: ubuntu-20.04 | |
run: ${{ needs.matrix-conditionals.outputs.UPGRADE_LIGHT_TESTS == 'true' }} | |
- make-target: "start-e2e-admin-test" | |
runs-on: ubuntu-20.04 | |
run: ${{ needs.matrix-conditionals.outputs.ADMIN_TESTS == 'true' }} | |
name: ${{ matrix.make-target }} | |
uses: ./.github/workflows/reusable-e2e.yml | |
with: | |
make-target: ${{ matrix.make-target }} | |
runs-on: ${{ matrix.runs-on}} | |
run: ${{ matrix.run }} | |
secrets: inherit | |
# this allows you to set a required status check | |
e2e-ok: | |
runs-on: ubuntu-22.04 | |
needs: e2e | |
if: always() | |
steps: | |
- run: | | |
result="${{ needs.e2e.result }}" | |
if [[ $result == "success" || $result == "skipped" ]]; then | |
exit 0 | |
else | |
exit 1 | |
fi |