Skip to content

Commit

Permalink
chore(CI): run E2E test for every commit
Browse files Browse the repository at this point in the history
With cache, `make e2e-test-ci` only takes only 7 minutes.
  • Loading branch information
Flouse committed Sep 18, 2023
1 parent d6377f2 commit eef6c36
Showing 1 changed file with 9 additions and 52 deletions.
61 changes: 9 additions & 52 deletions .github/workflows/e2e_test.yml
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
name: E2E Tests

on:
# TODO: With cache, `make e2e-test-ci` only takes only 7 minutes.
push:
pull_request:
merge_group:
workflow_dispatch:
inputs:
# used by regression_testing.yml and entry_workflow.yml
dispatch:
type: string
description: "'regression' or the JSON of a PR's context"
required: false

# Ensure that only a single job or workflow using the same concurrency group will run at a time.
# see https://docs.github.com/en/actions/using-jobs/using-concurrency#example-only-cancel-in-progress-jobs-or-runs-for-the-current-workflow
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
# only needs to test the group's latest commit
cancel-in-progress: true

jobs:
e2e-test:
Expand All @@ -32,28 +32,7 @@ jobs:
statuses: write

steps:
- name: Get the git ref of Axon
uses: actions/github-script@v6
id: axon_git_ref
with:
script: |
if (`${{ env.IS_DISPATCH }}` == 'true' && `${{ env.IS_REGRESSION }}` == 'false' && `${{ github.event.inputs.dispatch }}`) {
const dispatch = JSON.parse(`${{ github.event.inputs.dispatch }}`);
const prNum = dispatch.issue.number;
const { data: pullRequest } = await github.rest.pulls.get({
owner: dispatch.repo.owner,
repo: dispatch.repo.repo,
pull_number: dispatch.issue.number,
});
return pullRequest.head.sha;
}
return `${{ github.sha }}`;
result-encoding: string

- name: Checkout Axon ${{ steps.axon_git_ref.outputs.result}}
uses: actions/checkout@v4
with:
ref: ${{ steps.axon_git_ref.outputs.result}}
- uses: actions/checkout@v4

- name: Cache of Cargo
uses: actions/cache@v3
Expand All @@ -68,7 +47,6 @@ jobs:
restore-keys: |
${{ matrix.os }}-${{ runner.os }}-${{ runner.arch }}-cargo-build
${{ matrix.os }}-${{ runner.os }}-${{ runner.arch }}-cargo
# TODO: remove ${{ matrix.os }}-${{ runner.os }}-${{ runner.arch }}-cargo key
- uses: lyricwulf/abc@v1
with:
Expand Down Expand Up @@ -98,28 +76,7 @@ jobs:
restore-keys: |
${{ runner.os }}-node_modules-
# Only enable tmate while debugging
# - name: Setup tmate session
# # if: ${{ failure() }}
# uses: mxschmitt/action-tmate@v3
# timeout-minutes: 30

- name: E2E Tests Linting in tests/e2e
run: make e2e-test-lint
- name: E2E Tests in tests/e2e
run: make e2e-test-ci

# The `statuses: write` permission is required in this step.
- name: Update the commit Status
if: always() && env.IS_DISPATCH == 'true' && env.IS_REGRESSION == 'false'
uses: actions/github-script@v6
with:
script: |
github.rest.repos.createCommitStatus({
state: '${{ job.status }}',
owner: context.repo.owner,
repo: context.repo.repo,
context: '${{ github.workflow }}',
sha: '${{ steps.axon_git_ref.outputs.result}}',
target_url: 'https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}'
})

0 comments on commit eef6c36

Please sign in to comment.