Skip to content

Commit 814f04f

Browse files
authored
GitHub Actions: Extract test-e2e.yml (#163)
1 parent d0df841 commit 814f04f

4 files changed

Lines changed: 41 additions & 29 deletions

File tree

.github/workflows/deploy.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,9 +43,9 @@ jobs:
4343
actions: write
4444
runs-on: ubuntu-24.04
4545
steps:
46-
- name: Dispatch Test (e2e Production) Workflow
46+
- name: Dispatch Test (Production) Workflow
4747
run: |
48-
gh workflow run test-e2e-prod.yml \
48+
gh workflow run test-prod.yml \
4949
--repo "${REPO}" \
5050
--ref "${REF}"
5151
env:
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
1-
name: Test (e2e Production)
1+
name: Test (e2e)
22

33
on:
4+
workflow_call:
5+
inputs: &inputs
6+
url:
7+
required: true
8+
type: string
49
workflow_dispatch:
5-
schedule:
6-
- cron: '34 6,18 * * *' # Twice a day, one hour after the Update Data workflow
7-
8-
concurrency:
9-
group: ${{ github.workflow }}-${{ github.ref_name }}
10-
cancel-in-progress: true
10+
inputs: *inputs
1111

1212
permissions:
1313
contents: read
@@ -16,13 +16,9 @@ env:
1616
GOEXPERIMENT: jsonv2
1717

1818
jobs:
19-
e2e-test-prod:
19+
test:
20+
name: ${{ inputs.url || 'Local' }}
2021
runs-on: ubuntu-latest
21-
strategy:
22-
matrix:
23-
url:
24-
- 'https://repo-wpsecadv.typist.tech/'
25-
- 'https://wpsecadv.fly.dev/'
2622
steps:
2723
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
2824
with:
@@ -34,4 +30,4 @@ jobs:
3430

3531
- run: go test -tags=e2econtainer -count=1 -shuffle=on ./e2e/container/...
3632
env:
37-
WPSECADV_SERVER_URL: ${{ matrix.url }}
33+
WPSECADV_SERVER_URL: ${{ inputs.url }}

.github/workflows/test-prod.yml

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
name: Test (Production)
2+
3+
on:
4+
workflow_dispatch:
5+
schedule:
6+
- cron: '34 6,18 * * *' # Twice a day, one hour after the Update Data workflow
7+
8+
concurrency:
9+
group: ${{ github.workflow }}-${{ github.ref_name }}
10+
cancel-in-progress: true
11+
12+
permissions:
13+
contents: read
14+
15+
jobs:
16+
e2e:
17+
strategy:
18+
matrix:
19+
url:
20+
- 'https://repo-wpsecadv.typist.tech/'
21+
- 'https://wpsecadv.fly.dev/'
22+
uses: ./.github/workflows/test-e2e.yml
23+
with:
24+
url: ${{ matrix.url }}

.github/workflows/test.yml

Lines changed: 5 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -38,19 +38,11 @@ jobs:
3838
path: coverage.out
3939
if-no-files-found: error
4040

41-
e2e-test:
41+
e2e:
4242
needs: test
43-
runs-on: ubuntu-latest
44-
steps:
45-
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
46-
with:
47-
persist-credentials: false
48-
- uses: actions/setup-go@4a3601121dd01d1626a1e23e37211e3254c1c06c # v6.4.0
49-
with:
50-
go-version-file: 'go.mod'
51-
- uses: docker/setup-buildx-action@4d04d5d9486b7bd6fa91e7baf45bbb4f8b9deedd # v4.0.0
52-
53-
- run: go test -tags=e2econtainer -count=1 -shuffle=on ./e2e/container/...
43+
uses: ./.github/workflows/test-e2e.yml
44+
with:
45+
url: '' # Leave blank to boot a local server for testing
5446

5547
codecov:
5648
needs: test
@@ -78,7 +70,7 @@ jobs:
7870
if: github.event_name == 'push' && github.ref_name == 'main'
7971
needs:
8072
- test
81-
- e2e-test
73+
- e2e
8274
permissions:
8375
actions: write
8476
runs-on: ubuntu-24.04

0 commit comments

Comments
 (0)