-
Notifications
You must be signed in to change notification settings - Fork 29
147 lines (122 loc) · 4.58 KB
/
ci.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
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
name: CI
on:
pull_request:
push:
branches:
- "master"
jobs:
build:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
label:
- Web
- Tauri
include:
- label: Web
dist_path: dist
- label: Tauri
dist_path: src-tauri/target/dist
steps:
- name: Checkout commit
uses: actions/checkout@v4
with:
submodules: recursive
# This forces the entire history to be cloned, which is necessary for
# the changelog generation to work correctly.
fetch-depth: 0
- name: Install Node
uses: actions/setup-node@v4
with:
node-version: "lts/*"
- name: Install Rust
uses: hecrj/setup-rust-action@v2
with:
rust-version: nightly
components: rust-src
targets: wasm32-unknown-unknown
- name: Download binaryen
if: github.repository == 'LiveSplit/LiveSplitOne' && github.ref == 'refs/heads/master'
uses: robinraju/[email protected]
with:
repository: "WebAssembly/binaryen"
latest: true
fileName: "binaryen-*-x86_64-linux.tar.gz"
out-file-path: "/home/runner/.cargo/bin"
- name: Install binaryen
if: github.repository == 'LiveSplit/LiveSplitOne' && github.ref == 'refs/heads/master'
run: |
cd ~/.cargo/bin
tar -xzf binaryen-*-x86_64-linux.tar.gz
mv binaryen*/bin/wasm* .
- name: Choose wasm-bindgen-cli version
run: echo "version=$(cd livesplit-core && cargo tree -i wasm-bindgen --features wasm-web --target wasm32-unknown-unknown --depth 0 | sed 's/.* v//g')" >> $GITHUB_OUTPUT
id: wasm-bindgen
- name: Download wasm-bindgen-cli
uses: robinraju/[email protected]
with:
repository: "rustwasm/wasm-bindgen"
tag: ${{ steps.wasm-bindgen.outputs.version }}
fileName: "wasm-bindgen-${{ steps.wasm-bindgen.outputs.version }}-x86_64-unknown-linux-musl.tar.gz"
out-file-path: "/home/runner/.cargo/bin"
- name: Install wasm-bindgen-cli
run: |
cd ~/.cargo/bin
tar -xzf wasm-bindgen-${{ steps.wasm-bindgen.outputs.version }}-x86_64-unknown-linux-musl.tar.gz
mv wasm-bindgen-${{ steps.wasm-bindgen.outputs.version }}-x86_64-unknown-linux-musl/wasm* .
- name: Install npm packages
run: npm ci -f
env:
DETECT_CHROMEDRIVER_VERSION: true
- name: Build Core
run: npm run build:core:deploy
- name: Run eslint (Web)
if: matrix.label == 'Web'
run: npm run lint
- name: Build Frontend (Web)
if: matrix.label == 'Web'
run: npm run publish
- name: Build Frontend (Tauri)
if: matrix.label == 'Tauri'
run: npm run tauri:build-html
- name: Generate Icons (Tauri)
if: matrix.label == 'Tauri'
run: npm run tauri:icons
- name: Cache screenshots (Web)
if: matrix.label == 'Web'
uses: actions/cache@v4
with:
path: test/screenshots
key: ${{ runner.os }}-screenshots-${{ hashFiles('test/rendering-test.js') }}
restore-keys: ${{ runner.os }}-screenshots-
- name: Run tests (Web)
if: matrix.label == 'Web'
run: |
echo "::add-matcher::.github/workflows/test-failures.json"
npm run test
- name: Upload screenshots (Web)
if: matrix.label == 'Web' && (success() || failure())
uses: actions/upload-artifact@v4
with:
name: Screenshots
path: test/screenshots
- name: Optimize
if: github.repository == 'LiveSplit/LiveSplitOne' && github.ref == 'refs/heads/master'
run: |
WASM_FILE=$(ls ${{ matrix.dist_path }}/*.wasm)
wasm-opt --all-features -O4 "$WASM_FILE" -o "$WASM_FILE"
- name: Build (Tauri)
if: matrix.label == 'Tauri'
run: npm run tauri:publish
- name: Add CNAME file (Web)
if: matrix.label == 'Web' && github.repository == 'LiveSplit/LiveSplitOne' && github.ref == 'refs/heads/master'
run: cp ./.github/workflows/CNAME ./${{ matrix.dist_path }}/CNAME
- name: Deploy (Web)
if: matrix.label == 'Web' && github.repository == 'LiveSplit/LiveSplitOne' && github.ref == 'refs/heads/master'
uses: peaceiris/actions-gh-pages@v4
with:
deploy_key: ${{ secrets.ACTIONS_DEPLOY_KEY }}
publish_branch: gh-pages
publish_dir: ./${{ matrix.dist_path }}
force_orphan: true