Skip to content

Commit 98232ef

Browse files
committed
ci: use artifacts
1 parent 6a03bd3 commit 98232ef

File tree

8 files changed

+75
-157
lines changed

8 files changed

+75
-157
lines changed

.github/actions/local-network/action.yaml

Lines changed: 3 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -11,20 +11,10 @@ runs:
1111
- name: Setup Node.JS
1212
uses: ./.github/actions/nodejs
1313

14-
# - name: Restore JS build artifacts
15-
# uses: strophy/actions-cache@opendal-update
16-
# with:
17-
# bucket: multi-runner-cache-x1xibo9c
18-
# root: actions-cache
19-
# path: build-js-artifacts-${{ github.sha }}.tar
20-
# key: build-js-artifacts/${{ github.sha }}
21-
22-
- name: Restore JS build artifacts
23-
uses: actions/cache/restore@v4
14+
- name: Download JS build artifacts
15+
uses: actions/download-artifact@v4
2416
with:
25-
key: build-js-artifacts-${{ github.sha }}
26-
path: build-js-artifacts-${{ github.sha }}.tar
27-
fail-on-cache-miss: 'true'
17+
name: build-js-artifacts-${{ github.sha }}
2818

2919
- name: Unpack JS build artifacts archive
3020
shell: bash

.github/workflows/release.yml

Lines changed: 24 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -40,39 +40,23 @@ jobs:
4040
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
4141
aws-region: ${{ secrets.AWS_REGION }}
4242

43-
# - name: Retrieve JS build artifacts
44-
# uses: strophy/actions-cache@opendal-update
45-
# id: cache
46-
# with:
47-
# bucket: multi-runner-cache-x1xibo9c
48-
# root: actions-cache
49-
# path: build-js-artifacts-${{ github.sha }}.tar
50-
# key: build-js-artifacts/${{ github.sha }}
51-
52-
- name: Retrieve JS build artifacts
53-
uses: actions/cache/restore@v4
54-
id: cache
43+
- uses: softwareforgood/check-artifact-v4-existence@v0
44+
id: check-artifact
5545
with:
56-
path: build-js-artifacts-${{ github.sha }}.tar
57-
key: build-js-artifacts-${{ github.sha }}
58-
fail-on-cache-miss: 'true'
59-
60-
- name: Unpack JS build artifacts archive
61-
run: tar -xf build-js-artifacts-${{ github.sha }}.tar
62-
if: ${{ steps.cache.outputs.cache-hit == 'true' }}
46+
name: build-js-artifacts-${{ github.sha }}
6347

6448
- name: Login to DockerHub
6549
uses: docker/login-action@v3
66-
if: ${{ steps.cache.outputs.cache-hit != 'true' }}
6750
with:
6851
username: ${{ secrets.DOCKERHUB_USERNAME }}
6952
password: ${{ secrets.DOCKERHUB_TOKEN }}
53+
if: ${{ steps.check-artifact.outputs.exists != 'true' }}
7054

7155
- name: Setup Rust
7256
uses: ./.github/actions/rust
7357
with:
7458
target: wasm32-unknown-unknown
75-
if: ${{ steps.cache.outputs.cache-hit != 'true' }}
59+
if: ${{ steps.check-artifact.outputs.exists != 'true' }}
7660

7761
- name: Setup Node.JS
7862
uses: ./.github/actions/nodejs
@@ -83,14 +67,15 @@ jobs:
8367
script: |
8468
core.exportVariable('ACTIONS_CACHE_URL', process.env.ACTIONS_CACHE_URL || '');
8569
core.exportVariable('ACTIONS_RUNTIME_TOKEN', process.env.ACTIONS_RUNTIME_TOKEN || '');
70+
if: ${{ steps.check-artifact.outputs.exists != 'true' }}
8671

8772
- name: Install Cargo binstall
8873
uses: cargo-bins/[email protected]
89-
if: ${{ steps.cache.outputs.cache-hit != 'true' }}
74+
if: ${{ steps.check-artifact.outputs.exists != 'true' }}
9075

9176
- name: Install wasm-bindgen-cli
9277
run: cargo binstall [email protected]
93-
if: ${{ steps.cache.outputs.cache-hit != 'true' }}
78+
if: ${{ steps.check-artifact.outputs.exists != 'true' }}
9479

9580
- name: Build packages
9681
run: yarn build
@@ -101,7 +86,7 @@ jobs:
10186
# SCCACHE_BUCKET: multi-runner-cache-x1xibo9c
10287
# SCCACHE_REGION: ${{ secrets.AWS_REGION }}
10388
# SCCACHE_S3_KEY_PREFIX: ${{ runner.os }}/sccache/wasm/wasm32
104-
if: ${{ steps.cache.outputs.cache-hit != 'true' }}
89+
if: ${{ steps.check-artifact.outputs.exists != 'true' }}
10590

10691
- name: Set suffix
10792
uses: actions/github-script@v6
@@ -149,16 +134,25 @@ jobs:
149134
echo ".idea" >> .gitignore
150135
echo ".ultra.cache.json" >> .gitignore
151136
echo "db/*" >> .gitignore
152-
if: ${{ steps.cache.outputs.cache-hit != 'true' }}
137+
if: ${{ steps.check-artifact.outputs.exists != 'true' }}
153138

154139
- name: Get modified files
155140
id: diff
156141
run: git ls-files --others --exclude-standard >> artifacts_list.txt
157-
if: ${{ steps.cache.outputs.cache-hit != 'true' }}
142+
if: ${{ steps.check-artifact.outputs.exists != 'true' }}
158143

159144
- name: Create an archive of built files
160145
run: xargs -a artifacts_list.txt tar cvf build-js-artifacts-${{ github.sha }}.tar
161-
if: ${{ steps.cache.outputs.cache-hit != 'true' }}
146+
if: ${{ steps.check-artifact.outputs.exists != 'true' }}
147+
148+
- name: Upload the archive of built files
149+
uses: actions/upload-artifact@v4
150+
with:
151+
name: build-js-artifacts-${{ github.sha }}
152+
path: build-js-artifacts-${{ github.sha }}.tar
153+
retention-days: 1
154+
if-no-files-found: error
155+
if: ${{ steps.check-artifact.outputs.exists != 'true' }}
162156

163157
release-drive-image:
164158
name: Release Drive image
@@ -252,21 +246,10 @@ jobs:
252246
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
253247
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
254248

255-
# - name: Retrieve JS build artifacts
256-
# uses: strophy/actions-cache@opendal-update
257-
# with:
258-
# bucket: multi-runner-cache-x1xibo9c
259-
# root: actions-cache
260-
# path: build-js-artifacts-${{ github.sha }}.tar
261-
# key: build-js-artifacts/${{ github.sha }}
262-
263-
- name: Retrieve JS build artifacts
264-
uses: actions/cache/restore@v4
249+
- name: Download JS build artifacts
250+
uses: actions/download-artifact@v4
265251
with:
266-
path: build-js-artifacts-${{ github.sha }}.tar
267-
key: build-js-artifacts-${{ github.sha }}
268-
fail-on-cache-miss: 'true'
269-
252+
name: build-js-artifacts-${{ github.sha }}
270253

271254
- name: Unpack JS build artifacts archive
272255
run: tar -xf build-js-artifacts-${{ github.sha }}.tar

.github/workflows/tests-build-js.yml

Lines changed: 14 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -13,68 +13,49 @@ jobs:
1313
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
1414
aws-region: ${{ secrets.AWS_REGION }}
1515

16-
# TODO: Use upload artifacts action instead of cache
17-
# - name: Cache build artifacts
18-
# uses: strophy/actions-cache@opendal-update
19-
# id: cache
20-
# with:
21-
# bucket: multi-runner-cache-x1xibo9c
22-
# root: actions-cache
23-
# path: build-js-artifacts-${{ github.sha }}.tar
24-
# key: build-js-artifacts/${{ github.sha }}
25-
26-
- name: Download JS build artifacts
27-
uses: actions/download-artifact@v4
16+
- uses: softwareforgood/check-artifact-v4-existence@v0
17+
id: check-artifact
2818
with:
2919
name: build-js-artifacts-${{ github.sha }}
3020

31-
- name: Check if artifacts exist
32-
id: exists
33-
run: |
34-
if test -f build-js-artifacts-${{ github.sha }}.tar; then
35-
echo "result=true" >> "$GITHUB_OUTPUT"
36-
else
37-
echo "result=false" >> "$GITHUB_OUTPUT"
38-
fi
39-
4021
- name: Check out repo
4122
uses: actions/checkout@v4
4223
with:
4324
fetch-depth: 0
44-
if: ${{ steps.exists.outputs.result != 'true' }}
25+
if: ${{ steps.check-artifact.outputs.exists != 'true' }}
4526

4627
- name: Login to DockerHub
4728
uses: docker/login-action@v3
4829
with:
4930
username: ${{ secrets.DOCKERHUB_USERNAME }}
5031
password: ${{ secrets.DOCKERHUB_TOKEN }}
51-
if: ${{ steps.exists.outputs.result != 'true' }}
32+
if: ${{ steps.check-artifact.outputs.exists != 'true' }}
5233

5334
- name: Setup Node.JS
5435
uses: ./.github/actions/nodejs
55-
if: ${{ steps.exists.outputs.result != 'true' }}
36+
if: ${{ steps.check-artifact.outputs.exists != 'true' }}
5637

5738
- name: Setup Rust
5839
uses: ./.github/actions/rust
5940
with:
6041
target: wasm32-unknown-unknown
61-
if: ${{ steps.exists.outputs.result != 'true' }}
42+
if: ${{ steps.check-artifact.outputs.exists != 'true' }}
6243

6344
- name: Configure sccache
6445
uses: actions/github-script@v7
6546
with:
6647
script: |
6748
core.exportVariable('ACTIONS_CACHE_URL', process.env.ACTIONS_CACHE_URL || '');
6849
core.exportVariable('ACTIONS_RUNTIME_TOKEN', process.env.ACTIONS_RUNTIME_TOKEN || '');
69-
if: ${{ steps.exists.outputs.result != 'true' }}
50+
if: ${{ steps.check-artifact.outputs.exists != 'true' }}
7051

7152
- name: Install Cargo binstall
7253
uses: cargo-bins/[email protected]
73-
if: ${{ steps.exists.outputs.result != 'true' }}
54+
if: ${{ steps.check-artifact.outputs.exists != 'true' }}
7455

7556
- name: Install wasm-bindgen-cli
7657
run: cargo binstall [email protected]
77-
if: ${{ steps.exists.outputs.result != 'true' }}
58+
if: ${{ steps.check-artifact.outputs.exists != 'true' }}
7859

7960
- name: Build JS packages
8061
run: yarn build
@@ -84,7 +65,7 @@ jobs:
8465
# SCCACHE_BUCKET: multi-runner-cache-x1xibo9c
8566
# SCCACHE_REGION: ${{ secrets.AWS_REGION }}
8667
# SCCACHE_S3_KEY_PREFIX: ${{ runner.os }}/sccache/wasm/wasm32
87-
if: ${{ steps.exists.outputs.result != 'true' }}
68+
if: ${{ steps.check-artifact.outputs.exists != 'true' }}
8869

8970
- name: Ignore only already cached artifacts
9071
run: |
@@ -96,16 +77,16 @@ jobs:
9677
echo ".idea" >> .gitignore
9778
echo ".ultra.exists.json" >> .gitignore
9879
echo "db/*" >> .gitignore
99-
if: ${{ steps.exists.outputs.result != 'true' }}
80+
if: ${{ steps.check-artifact.outputs.exists != 'true' }}
10081

10182
- name: Get modified files
10283
id: diff
10384
run: git ls-files --others --exclude-standard >> artifacts_list.txt
104-
if: ${{ steps.exists.outputs.result != 'true' }}
85+
if: ${{ steps.check-artifact.outputs.exists != 'true' }}
10586

10687
- name: Create an archive of built files
10788
run: xargs -a artifacts_list.txt tar cvf build-js-artifacts-${{ github.sha }}.tar
108-
if: ${{ steps.exists.outputs.result != 'true' }}
89+
if: ${{ steps.check-artifact.outputs.exists != 'true' }}
10990

11091
- name: Upload the archive of built files
11192
uses: actions/upload-artifact@v4
@@ -114,5 +95,5 @@ jobs:
11495
path: build-js-artifacts-${{ github.sha }}.tar
11596
retention-days: 1
11697
if-no-files-found: error
117-
if: ${{ steps.exists.outputs.result != 'true' }}
98+
if: ${{ steps.check-artifact.outputs.exists != 'true' }}
11899

.github/workflows/tests-codeql.yml

Lines changed: 3 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -30,20 +30,10 @@ jobs:
3030
- name: Setup Node.JS
3131
uses: ./.github/actions/nodejs
3232

33-
# - name: Restore JS build artifacts archive
34-
# uses: strophy/actions-cache@opendal-update
35-
# with:
36-
# bucket: multi-runner-cache-x1xibo9c
37-
# root: actions-cache
38-
# path: build-js-artifacts-${{ github.sha }}.tar
39-
# key: build-js-artifacts/${{ github.sha }}
40-
41-
- name: Restore JS build artifacts archive
42-
uses: actions/cache/restore@v4
33+
- name: Download JS build artifacts
34+
uses: actions/download-artifact@v4
4335
with:
44-
path: build-js-artifacts-${{ github.sha }}.tar
45-
key: build-js-artifacts-${{ github.sha }}
46-
fail-on-cache-miss: 'true'
36+
name: build-js-artifacts-${{ github.sha }}
4737

4838
- name: Unpack JS build artifacts archive
4939
run: tar -xf build-js-artifacts-${{ github.sha }}.tar

.github/workflows/tests-dashmate.yml

Lines changed: 3 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -41,20 +41,10 @@ jobs:
4141
- name: Setup Node.JS
4242
uses: ./.github/actions/nodejs
4343

44-
# - name: Restore JS build artifacts
45-
# uses: strophy/actions-cache@opendal-update
46-
# with:
47-
# bucket: multi-runner-cache-x1xibo9c
48-
# root: actions-cache
49-
# path: build-js-artifacts-${{ github.sha }}.tar
50-
# key: build-js-artifacts/${{ github.sha }}
51-
52-
- name: Restore JS build artifacts
53-
uses: actions/cache/restore@v4
44+
- name: Download JS build artifacts
45+
uses: actions/download-artifact@v4
5446
with:
55-
key: build-js-artifacts-${{ github.sha }}
56-
path: build-js-artifacts-${{ github.sha }}.tar
57-
fail-on-cache-miss: 'true'
47+
name: build-js-artifacts-${{ github.sha }}
5848

5949
- name: Unpack JS build artifacts archive
6050
run: tar -xvf build-js-artifacts-${{ github.sha }}.tar

.github/workflows/tests-js-package.yml

Lines changed: 6 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -35,20 +35,10 @@ jobs:
3535
- name: Setup Node.JS
3636
uses: ./.github/actions/nodejs
3737

38-
# - name: Restore JS build artifacts
39-
# uses: strophy/actions-cache@opendal-update
40-
# with:
41-
# bucket: multi-runner-cache-x1xibo9c
42-
# root: actions-cache
43-
# path: build-js-artifacts-${{ github.sha }}.tar
44-
# key: build-js-artifacts/${{ github.sha }}
45-
46-
- name: Restore JS build artifacts
47-
uses: actions/cache/restore@v4
38+
- name: Download JS build artifacts
39+
uses: actions/download-artifact@v4
4840
with:
49-
path: build-js-artifacts-${{ github.sha }}.tar
50-
key: build-js-artifacts-${{ github.sha }}
51-
fail-on-cache-miss: 'true'
41+
name: build-js-artifacts-${{ github.sha }}
5242

5343
- name: Unpack JS build artifacts archive
5444
run: tar -xf build-js-artifacts-${{ github.sha }}.tar
@@ -79,20 +69,10 @@ jobs:
7969
- name: Setup Node.JS
8070
uses: ./.github/actions/nodejs
8171

82-
# - name: Restore JS build artifacts
83-
# uses: strophy/actions-cache@opendal-update
84-
# with:
85-
# bucket: multi-runner-cache-x1xibo9c
86-
# root: actions-cache
87-
# path: build-js-artifacts-${{ github.sha }}.tar
88-
# key: build-js-artifacts/${{ github.sha }}
89-
90-
- name: Restore JS build artifacts
91-
uses: actions/cache/restore@v4
72+
- name: Download JS build artifacts
73+
uses: actions/download-artifact@v4
9274
with:
93-
path: build-js-artifacts-${{ github.sha }}.tar
94-
key: build-js-artifacts-${{ github.sha }}
95-
fail-on-cache-miss: 'true'
75+
name: build-js-artifacts-${{ github.sha }}
9676

9777
- name: Unpack JS build artifacts archive
9878
run: tar -xf build-js-artifacts-${{ github.sha }}.tar

0 commit comments

Comments
 (0)