Skip to content

Commit 48b34d7

Browse files
authored
[AXON-772, AXON-788]: Reconfigure GitHub's build pipeline to run in parallel unit tests and E2E tests (#675)
* build: updated build yaml * build: updated build.yaml * build: updated build.yaml * fix: removed old dependency job * build: restored Build and package the extension * build: add test matrix * build: upload e2e artifacts only if exists * build: added fail-fast strategy * build: fix typo
1 parent 200c024 commit 48b34d7

File tree

1 file changed

+44
-15
lines changed

1 file changed

+44
-15
lines changed

.github/workflows/build.yaml

Lines changed: 44 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
name: Build
2+
permissions:
3+
contents: read
24

35
on:
46
push:
@@ -7,47 +9,74 @@ on:
79

810
jobs:
911

10-
build:
11-
12+
lint:
1213
runs-on: ubuntu-latest
14+
steps:
15+
- uses: actions/checkout@v4
16+
- uses: actions/setup-node@v4
17+
with:
18+
node-version: 20
19+
cache: 'npm'
1320

21+
- name: Install dependencies
22+
run: |
23+
npm ci --no-audit
24+
npm audit
25+
26+
- name: Run linter
27+
run: npm run lint
28+
29+
tests:
30+
needs: [lint]
31+
runs-on: ubuntu-latest
32+
33+
strategy:
34+
fail-fast: true
35+
matrix:
36+
test-type: [unit, e2e]
37+
1438
env:
1539
ATLASCODE_FX3_API_KEY: ${{ secrets.ATLASCODE_FX3_API_KEY }}
1640
ATLASCODE_FX3_ENVIRONMENT: ${{ vars.ATLASCODE_FX3_ENVIRONMENT }}
1741
ATLASCODE_FX3_TARGET_APP: ${{ vars.ATLASCODE_FX3_TARGET_APP }}
1842
ATLASCODE_FX3_TIMEOUT: ${{ vars.ATLASCODE_FX3_TIMEOUT }}
1943

2044
steps:
21-
2245
- uses: actions/checkout@v4
23-
24-
- name: Set up Node.js
25-
uses: actions/setup-node@v4
46+
- uses: actions/setup-node@v4
2647
with:
2748
node-version: 20
2849
cache: 'npm'
2950

3051
- name: Install dependencies
31-
run: |
32-
npm ci --no-audit
33-
npm audit
52+
run: npm ci --no-audit
3453

3554
- name: Build and package the extension
55+
if: matrix.test-type == 'e2e'
3656
run: npm run extension:package
3757

38-
- name: Run linter
39-
run: npm run lint
40-
41-
- name: Run unit tests
42-
run: npm run test
43-
4458
- name: Generate SSL certs for E2E test
59+
if: matrix.test-type == 'e2e'
4560
run: npm run test:e2e:sslcerts
4661

4762
- name: Fetch E2E image
63+
if: matrix.test-type == 'e2e'
4864
run: |
4965
docker pull ghcr.io/atlassian/atlascode-e2e:latest
5066
docker tag ghcr.io/atlassian/atlascode-e2e:latest atlascode-e2e
5167
68+
- name: Run unit tests
69+
if: matrix.test-type == 'unit'
70+
run: npm run test
71+
5272
- name: Run E2E tests
73+
if: matrix.test-type == 'e2e'
5374
run: npm run test:e2e:docker
75+
76+
- name: Upload E2E artifacts
77+
if: matrix.test-type == 'e2e' && always() && hashFiles('./test-results/**') != ''
78+
uses: actions/upload-artifact@v4
79+
with:
80+
name: e2e-test-results
81+
path: ./test-results
82+
retention-days: 1

0 commit comments

Comments
 (0)