Skip to content
This repository was archived by the owner on Apr 18, 2024. It is now read-only.

Commit 0807819

Browse files
authored
chore: CI test artifact handling improvement (#1497)
* trying to reduce gh action times as it is taking way too long * fix e2e name, was treating as two inputs * we don't want node_modules in the artifacts * download path not required since tar has dir within * remove node_modules from artifact upload of cypress test suite * don't need the download paths now
1 parent 511a0e8 commit 0807819

File tree

7 files changed

+98
-18
lines changed

7 files changed

+98
-18
lines changed

Diff for: .github/actions/download-artifact/action.yml

+33
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
# source https://github.com/actions/upload-artifact/issues/199#issuecomment-1516555821
2+
name: Download artifact
3+
description: Wrapper around GitHub's official action, with additional extraction before download
4+
5+
# https://github.com/actions/download-artifact/blob/main/action.yml
6+
inputs:
7+
name:
8+
description: Artifact name
9+
required: true
10+
path:
11+
description: Destination path
12+
required: false
13+
default: .
14+
15+
runs:
16+
using: composite
17+
steps:
18+
- name: Download artifacts
19+
uses: actions/download-artifact@v3
20+
with:
21+
name: ${{ inputs.name }}
22+
path: ${{ inputs.path }}
23+
24+
- name: Extract artifacts
25+
run: tar -xvf ${{ inputs.name }}.tar
26+
shell: bash
27+
working-directory: ${{ inputs.path }}
28+
29+
- name: Remove archive
30+
run: rm -f ${{ inputs.name }}.tar
31+
shell: bash
32+
working-directory: ${{ inputs.path }}
33+

Diff for: .github/actions/upload-artifact/action.yml

+47
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
# source https://github.com/actions/upload-artifact/issues/199#issuecomment-1516555821
2+
name: Upload artifact
3+
description: Wrapper around GitHub's official action, with additional archiving before upload
4+
5+
# https://github.com/actions/upload-artifact/blob/main/action.yml
6+
inputs:
7+
name:
8+
description: Artifact name
9+
required: true
10+
path:
11+
description: A file, directory or wildcard pattern that describes what to upload
12+
required: true
13+
if-no-files-found:
14+
description: >
15+
The desired behavior if no files are found using the provided path.
16+
Available Options:
17+
warn: Output a warning but do not fail the action
18+
error: Fail the action with an error message
19+
ignore: Do not output any warnings or errors, the action does not fail
20+
required: false
21+
default: warn
22+
retention-days:
23+
description: >
24+
Duration after which artifact will expire in days. 0 means using default retention.
25+
Minimum 1 day.
26+
Maximum 90 days unless changed from the repository settings page.
27+
required: false
28+
default: '0'
29+
30+
runs:
31+
using: composite
32+
steps:
33+
- name: Archive artifacts
34+
run: tar -cvf ${{ inputs.name }}.tar ${{ inputs.path }}
35+
shell: bash
36+
37+
- name: Upload artifacts
38+
uses: actions/upload-artifact@v3
39+
with:
40+
if-no-files-found: ${{ inputs.if-no-files-found }}
41+
name: ${{ inputs.name }}
42+
path: ${{ inputs.name }}.tar
43+
retention-days: ${{ inputs.retention-days }}
44+
45+
- name: Remove archive
46+
run: rm -f ${{ inputs.name }}.tar
47+
shell: bash

Diff for: .github/workflows/build_bundle.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ jobs:
6969

7070
# upload this build as artifact to current Action
7171
- name: Upload bundle
72-
uses: actions/upload-artifact@v3
72+
uses: ./.github/actions/upload-artifact
7373
with:
7474
name: LSF-${{ inputs.build_for_coverage && 'coverage-' || '' }}${{ inputs.sha }}
7575
path: build/

Diff for: .github/workflows/e2e_tests.yml

+4-6
Original file line numberDiff line numberDiff line change
@@ -54,12 +54,10 @@ jobs:
5454
run: du -d 0 -h ${{ steps.yarn-cache-dir-path.outputs.dir }}
5555

5656
- name: "Download bundle"
57-
uses: actions/download-artifact@v3
57+
uses: ./.github/actions/download-artifact
5858
with:
5959
name: LSF-coverage-${{ inputs.sha }}
6060

61-
path: build/
62-
6361
# run http-server with build in background (will be killed after job ends)
6462
# do this only for master branch (so only for push event)
6563
# because pr can contain unfinished job
@@ -95,10 +93,10 @@ jobs:
9593
yarn run test:ci ${{ steps.cpu-info.outputs.cores-count }}
9694
9795
- name: "Upload e2e output"
98-
uses: actions/upload-artifact@v3
96+
uses: ./.github/actions/upload-artifact
9997
if: ${{ failure() }}
10098
with:
101-
name: e2e output
99+
name: e2e-output
102100
path: e2e/output/
103101

104102
- name: Merge coverage reports
@@ -108,7 +106,7 @@ jobs:
108106
yarn coverage:merge
109107
110108
- name: Upload coverage to Artifact
111-
uses: actions/upload-artifact@v3
109+
uses: ./.github/actions/upload-artifact
112110
if: ${{ success() }}
113111
with:
114112
name: e2e-tests-coverage

Diff for: .github/workflows/fun_tests.yml

+9-4
Original file line numberDiff line numberDiff line change
@@ -67,10 +67,9 @@ jobs:
6767
run: du -d 0 -h ${{ steps.yarn-cache-dir-path.outputs.dir }}
6868

6969
- name: "Download bundle"
70-
uses: actions/download-artifact@v3
70+
uses: ./.github/actions/download-artifact
7171
with:
7272
name: LSF-coverage-${{ inputs.sha }}
73-
path: build/
7473

7574
# run http-server with build in background (will be killed after job ends)
7675
# do this only for master branch (so only for push event)
@@ -110,8 +109,14 @@ jobs:
110109
cd ./tests/functional
111110
yarn run test:parallel
112111
112+
- name: Prepare suite output
113+
if: ${{ failure() }}
114+
run: |
115+
cd ./tests/functional
116+
rm -rf node_modules
117+
113118
- name: "Upload suite output"
114-
uses: actions/upload-artifact@v3
119+
uses: ./.github/actions/upload-artifact
115120
if: ${{ failure() }}
116121
with:
117122
name: failure-result
@@ -125,7 +130,7 @@ jobs:
125130
yarn cvg:report
126131
127132
- name: Upload coverage to Artifact
128-
uses: actions/upload-artifact@v3
133+
uses: ./.github/actions/upload-artifact
129134
if: ${{ success() }}
130135
with:
131136
name: cypress-tests-coverage

Diff for: .github/workflows/tests_coverage.yml

+3-6
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,9 @@ jobs:
2020
uses: actions/checkout@v3
2121

2222
- name: "Download Unit coverage from Artifact"
23-
uses: actions/download-artifact@v3
23+
uses: ./.github/actions/download-artifact
2424
with:
2525
name: unit-tests-coverage
26-
path: coverage/
2726

2827
- name: Upload coverage to Codecov
2928
uses: codecov/[email protected]
@@ -43,10 +42,9 @@ jobs:
4342
uses: actions/checkout@v3
4443

4544
- name: "Download E2E coverage from Artifact"
46-
uses: actions/download-artifact@v3
45+
uses: ./.github/actions/download-artifact
4746
with:
4847
name: e2e-tests-coverage
49-
path: coverage/
5048

5149
- name: Upload coverage to Codecov
5250
uses: codecov/[email protected]
@@ -66,10 +64,9 @@ jobs:
6664
uses: actions/checkout@v3
6765

6866
- name: "Download Cypress coverage from Artifact"
69-
uses: actions/download-artifact@v3
67+
uses: ./.github/actions/download-artifact
7068
with:
7169
name: cypress-tests-coverage
72-
path: coverage/
7370

7471
- name: Upload coverage to Codecov
7572
uses: codecov/[email protected]

Diff for: .github/workflows/unit_tests.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ jobs:
5858
# token: ${{ secrets.CODECOV_TOKEN }}
5959
- name: Upload coverage to Artifacts
6060
if: ${{ !github.event.pull_request.head.repo.fork }}
61-
uses: actions/upload-artifact@v3
61+
uses: ./.github/actions/upload-artifact
6262
with:
6363
name: unit-tests-coverage
6464
path: coverage/

0 commit comments

Comments
 (0)