refactor(ci): finish matrix migration and update release workflow #199
Workflow file for this run
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 | |
- release/* | |
pull_request: | |
branches: | |
- "*" | |
merge_group: | |
schedule: | |
# run at 6AM UTC Daily | |
# 6AM UTC -> 11PM PT | |
- cron: "0 6 * * *" | |
workflow_dispatch: | |
inputs: | |
default-test: | |
type: boolean | |
required: false | |
default: false | |
upgrade-light-test: | |
type: boolean | |
required: false | |
default: false | |
upgrade-test: | |
type: boolean | |
required: false | |
default: false | |
admin-test: | |
type: boolean | |
required: false | |
default: false | |
upgrade-import-mainnet-test: | |
type: boolean | |
required: false | |
default: false | |
performance-test: | |
type: boolean | |
required: false | |
default: false | |
stateful-data-test: | |
type: boolean | |
required: false | |
default: false | |
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.result.DEFAULT_TESTS }} | |
UPGRADE_TESTS: ${{ steps.matrix-conditionals.outputs.result.UPGRADE_TESTS }} | |
UPGRADE_LIGHT_TESTS: ${{ steps.matrix-conditionals.outputs.result.UPGRADE_LIGHT_TESTS }} | |
UPGRADE_IMPORT_MAINNET_TESTS: ${{ steps.matrix-conditionals.outputs.result.UPGRADE_IMPORT_MAINNET_TESTS }} | |
ADMIN_TESTS: ${{ steps.matrix-conditionals.outputs.result.ADMIN_TESTS }} | |
PERFORMANCE_TESTS: ${{ steps.matrix-conditionals.outputs.result.PERFORMANCE_TESTS }} | |
STATEFUL_DATA_TESTS: ${{ steps.matrix-conditionals.outputs.result.STATEFUL_DATA_TESTS }} | |
steps: | |
# use api rather than event context to avoid race conditions (label added after push) | |
- id: matrix-conditionals | |
uses: actions/github-script@v7 | |
with: | |
script: | | |
console.log(context); | |
if (context.event_name === 'pull_request') { | |
outputs.DEFAULT_TESTS = 'true'; | |
const { data: labelsRaw } = await github.rest.pulls.get({ | |
owner: context.repo.owner, | |
repo: context.repo.repo, | |
pull_number: context.payload.pull_request.number, | |
}); | |
const labels = labelsRaw.map(label => label.name); | |
return { | |
UPGRADE_TESTS: labels.includes('UPGRADE_TESTS'), | |
UPGRADE_LIGHT_TESTS: labels.includes('UPGRADE_LIGHT_TESTS'), | |
UPGRADE_IMPORT_MAINNET_TESTS: labels.includes('UPGRADE_IMPORT_MAINNET_TESTS'), | |
ADMIN_TESTS: labels.includes('ADMIN_TESTS'), | |
PERFORMANCE_TESTS: labels.includes('PERFORMANCE_TESTS'), | |
STATEFUL_DATA_TESTS: labels.includes('STATEFUL_DATA_TESTS'), | |
} | |
} else if (context.event_name === 'merge_group') { | |
return { | |
DEFAULT_TESTS: 'true', | |
} | |
} else if (context.event_name === 'push' && context.ref === 'refs/heads/develop') { | |
return { | |
DEFAULT_TESTS: 'true', | |
} | |
} else if (context.event_name === 'push' && context.ref.startsWith('refs/heads/release/')) { | |
return { | |
DEFAULT_TESTS: 'true', | |
UPGRADE_TESTS: 'true', | |
UPGRADE_LIGHT_TESTS: 'true', | |
UPGRADE_IMPORT_MAINNET_TESTS: 'true', | |
ADMIN_TESTS: 'true', | |
PERFORMANCE_TESTS: 'true', | |
STATEFUL_DATA_TESTS: 'true', | |
} | |
} else if (context.event_name === 'schedule') { | |
return { | |
DEFAULT_TESTS: 'true', | |
UPGRADE_TESTS: 'true', | |
UPGRADE_LIGHT_TESTS: 'true', | |
UPGRADE_IMPORT_MAINNET_TESTS: 'true', | |
ADMIN_TESTS: 'true', | |
PERFORMANCE_TESTS: 'true', | |
STATEFUL_DATA_TESTS: 'true', | |
} | |
} else if (context.event_name === 'workflow_dispatch') { | |
return { | |
DEFAULT_TESTS: context.payload.workflow_dispatch.inputs['default-test'], | |
UPGRADE_TESTS: context.payload.workflow_dispatch.inputs['upgrade-test'], | |
UPGRADE_LIGHT_TESTS: context.payload.workflow_dispatch.inputs['upgrade-light-test'], | |
UPGRADE_IMPORT_MAINNET_TESTS: context.payload.workflow_dispatch.inputs['upgrade-import-mainnet-test'], | |
ADMIN_TESTS: context.payload.workflow_dispatch.inputs['admin-test'], | |
PERFORMANCE_TESTS: context.payload.workflow_dispatch.inputs['performance-test'], | |
STATEFUL_DATA_TESTS: context.payload.workflow_dispatch.inputs['stateful-data-test'], | |
} | |
} | |
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-upgrade-import-mainnet-test" | |
runs-on: buildjet-16vcpu-ubuntu-2204 | |
run: ${{ needs.matrix-conditionals.outputs.UPGRADE_IMPORT_MAINNET_TESTS == 'true' }} | |
- make-target: "start-e2e-admin-test" | |
runs-on: ubuntu-20.04 | |
run: ${{ needs.matrix-conditionals.outputs.ADMIN_TESTS == 'true' }} | |
- make-target: "start-e2e-performance-test" | |
runs-on: buildjet-4vcpu-ubuntu-2204 | |
run: ${{ needs.matrix-conditionals.outputs.PERFORMANCE_TESTS == 'true' }} | |
- make-target: "start-e2e-import-mainnet-test" | |
runs-on: buildjet-16vcpu-ubuntu-2204 | |
run: ${{ needs.matrix-conditionals.outputs.STATEFUL_DATA_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 |