Implement Save On Reset (#910) #1444
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: CI | |
on: | |
pull_request: | |
push: | |
branches: | |
- 'master' | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
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/release-downloader@v1.10 | |
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/release-downloader@v1.9 | |
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 | |
run: npm run lint | |
- name: Build Frontend | |
run: npm run publish | |
- name: Cache screenshots | |
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 | |
run: | | |
echo "::add-matcher::.github/workflows/test-failures.json" | |
npm run test | |
- name: Upload screenshots | |
if: 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 dist/*.wasm) | |
wasm-opt --all-features -O4 "$WASM_FILE" -o "$WASM_FILE" | |
- name: Add CNAME file | |
if: github.repository == 'LiveSplit/LiveSplitOne' && github.ref == 'refs/heads/master' | |
run: cp ./.github/workflows/CNAME ./dist/CNAME | |
- name: Deploy | |
if: 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: ./dist | |
force_orphan: true |