-
Notifications
You must be signed in to change notification settings - Fork 39
95 lines (82 loc) · 3.25 KB
/
tests-build-js.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
on:
workflow_call:
jobs:
build-js:
name: Build JS
runs-on: ubuntu-24.04
timeout-minutes: 10
steps:
- uses: softwareforgood/check-artifact-v4-existence@v0
id: check-artifact
with:
name: js-build-${{ github.sha }}
- name: Check out repo
uses: actions/checkout@v4
with:
fetch-depth: 0
if: ${{ steps.check-artifact.outputs.exists != 'true' }}
- name: Login to DockerHub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
if: ${{ steps.check-artifact.outputs.exists != 'true' }}
- name: Setup Node.JS
uses: ./.github/actions/nodejs
if: ${{ steps.check-artifact.outputs.exists != 'true' }}
- name: Setup Rust
uses: ./.github/actions/rust
with:
target: wasm32-unknown-unknown
if: ${{ steps.check-artifact.outputs.exists != 'true' }}
- name: Setup sccache
uses: ./.github/actions/sccache
with:
bucket: ${{ vars.CACHE_S3_BUCKET }}
region: ${{ vars.CACHE_REGION }}
endpoint: ${{ vars.CACHE_S3_ENDPOINT }}
access_key_id: ${{ secrets.CACHE_KEY_ID }}
secret_access_key: ${{ secrets.CACHE_SECRET_KEY }}
if: ${{ steps.check-artifact.outputs.exists != 'true' }}
- name: Install Cargo binstall
uses: cargo-bins/[email protected]
if: ${{ steps.check-artifact.outputs.exists != 'true' }}
- name: Install wasm-bindgen-cli
run: cargo binstall [email protected]
if: ${{ steps.check-artifact.outputs.exists != 'true' }}
- name: Install Binaryen
run: |
wget https://github.com/WebAssembly/binaryen/releases/download/version_121/binaryen-version_121-x86_64-linux.tar.gz -P /tmp
tar -xzf /tmp/binaryen-version_121-x86_64-linux.tar.gz -C /tmp
sudo cp -r /tmp/binaryen-version_121/* /usr/local/
if: ${{ steps.check-artifact.outputs.exists != 'true' }}
- name: Build JS packages
run: yarn build
if: ${{ steps.check-artifact.outputs.exists != 'true' }}
- name: Ignore only already cached artifacts
run: |
find . -name '.gitignore' -exec rm -f {} +
echo ".yarn" >> .gitignore
echo "target" >> .gitignore
echo "node_modules" >> .gitignore
echo ".nyc_output" >> .gitignore
echo ".idea" >> .gitignore
echo ".ultra.exists.json" >> .gitignore
echo "db/*" >> .gitignore
if: ${{ steps.check-artifact.outputs.exists != 'true' }}
- name: Get modified files
id: diff
run: |
echo "files<<EOF" >> $GITHUB_OUTPUT
git ls-files --others --exclude-standard >> $GITHUB_OUTPUT
echo "EOF" >> $GITHUB_OUTPUT
if: ${{ steps.check-artifact.outputs.exists != 'true' }}
- name: Upload the archive of built files
uses: actions/upload-artifact@v4
with:
name: js-build-${{ github.sha }}
path: ${{ steps.diff.outputs.files }}
retention-days: 1
if-no-files-found: error
include-hidden-files: true
if: ${{ steps.check-artifact.outputs.exists != 'true' }}