Skip to content

Commit 6a03bd3

Browse files
committed
ci: try using download artifact
1 parent 83f6659 commit 6a03bd3

File tree

1 file changed

+34
-15
lines changed

1 file changed

+34
-15
lines changed

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

Lines changed: 34 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -23,59 +23,68 @@ jobs:
2323
# path: build-js-artifacts-${{ github.sha }}.tar
2424
# key: build-js-artifacts/${{ github.sha }}
2525

26-
- name: Cache build artifacts
27-
uses: actions/cache@v4
26+
- name: Download JS build artifacts
27+
uses: actions/download-artifact@v4
2828
with:
29-
key: build-js-artifacts-${{ github.sha }}
30-
path: build-js-artifacts-${{ github.sha }}.tar
29+
name: build-js-artifacts-${{ github.sha }}
30+
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
3139
3240
- name: Check out repo
3341
uses: actions/checkout@v4
34-
if: ${{ steps.cache.outputs.cache-hit != 'true' }}
3542
with:
3643
fetch-depth: 0
44+
if: ${{ steps.exists.outputs.result != 'true' }}
3745

3846
- name: Login to DockerHub
3947
uses: docker/login-action@v3
40-
if: ${{ steps.cache.outputs.cache-hit != 'true' }}
4148
with:
4249
username: ${{ secrets.DOCKERHUB_USERNAME }}
4350
password: ${{ secrets.DOCKERHUB_TOKEN }}
51+
if: ${{ steps.exists.outputs.result != 'true' }}
4452

4553
- name: Setup Node.JS
4654
uses: ./.github/actions/nodejs
47-
if: ${{ steps.cache.outputs.cache-hit != 'true' }}
55+
if: ${{ steps.exists.outputs.result != 'true' }}
4856

4957
- name: Setup Rust
5058
uses: ./.github/actions/rust
51-
if: ${{ steps.cache.outputs.cache-hit != 'true' }}
5259
with:
5360
target: wasm32-unknown-unknown
61+
if: ${{ steps.exists.outputs.result != 'true' }}
5462

5563
- name: Configure sccache
5664
uses: actions/github-script@v7
5765
with:
5866
script: |
5967
core.exportVariable('ACTIONS_CACHE_URL', process.env.ACTIONS_CACHE_URL || '');
6068
core.exportVariable('ACTIONS_RUNTIME_TOKEN', process.env.ACTIONS_RUNTIME_TOKEN || '');
69+
if: ${{ steps.exists.outputs.result != 'true' }}
6170

6271
- name: Install Cargo binstall
6372
uses: cargo-bins/[email protected]
64-
if: ${{ steps.cache.outputs.cache-hit != 'true' }}
73+
if: ${{ steps.exists.outputs.result != 'true' }}
6574

6675
- name: Install wasm-bindgen-cli
6776
run: cargo binstall [email protected]
68-
if: ${{ steps.cache.outputs.cache-hit != 'true' }}
77+
if: ${{ steps.exists.outputs.result != 'true' }}
6978

7079
- name: Build JS packages
7180
run: yarn build
72-
if: ${{ steps.cache.outputs.cache-hit != 'true' }}
7381
env:
7482
RUSTC_WRAPPER: sccache
7583
SCCACHE_GHA_ENABLED: true
7684
# SCCACHE_BUCKET: multi-runner-cache-x1xibo9c
7785
# SCCACHE_REGION: ${{ secrets.AWS_REGION }}
7886
# SCCACHE_S3_KEY_PREFIX: ${{ runner.os }}/sccache/wasm/wasm32
87+
if: ${{ steps.exists.outputs.result != 'true' }}
7988

8089
- name: Ignore only already cached artifacts
8190
run: |
@@ -85,15 +94,25 @@ jobs:
8594
echo "node_modules" >> .gitignore
8695
echo ".nyc_output" >> .gitignore
8796
echo ".idea" >> .gitignore
88-
echo ".ultra.cache.json" >> .gitignore
97+
echo ".ultra.exists.json" >> .gitignore
8998
echo "db/*" >> .gitignore
90-
if: ${{ steps.cache.outputs.cache-hit != 'true' }}
99+
if: ${{ steps.exists.outputs.result != 'true' }}
91100

92101
- name: Get modified files
93102
id: diff
94103
run: git ls-files --others --exclude-standard >> artifacts_list.txt
95-
if: ${{ steps.cache.outputs.cache-hit != 'true' }}
104+
if: ${{ steps.exists.outputs.result != 'true' }}
96105

97106
- name: Create an archive of built files
98107
run: xargs -a artifacts_list.txt tar cvf build-js-artifacts-${{ github.sha }}.tar
99-
if: ${{ steps.cache.outputs.cache-hit != 'true' }}
108+
if: ${{ steps.exists.outputs.result != 'true' }}
109+
110+
- name: Upload the archive of built files
111+
uses: actions/upload-artifact@v4
112+
with:
113+
name: build-js-artifacts-${{ github.sha }}
114+
path: build-js-artifacts-${{ github.sha }}.tar
115+
retention-days: 1
116+
if-no-files-found: error
117+
if: ${{ steps.exists.outputs.result != 'true' }}
118+

0 commit comments

Comments
 (0)