Skip to content

chore(deps): lock file maintenance #1929

chore(deps): lock file maintenance

chore(deps): lock file maintenance #1929

Workflow file for this run

name: github-pages
on:
push:
branches:
- main
pull_request:
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
test-wasm:
name: Test Wasm
runs-on: macos-15
steps:
- name: Checkout the repo
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
with:
sparse-checkout: |
rs/wasm
- name: Cache Cargo
id: cache-cargo
uses: actions/cache@1bd1e32a3bdc45362d1e726936510720a7c30a57 # v4
with:
path: |
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
target/
key: wasm-${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
- name: Install Cargo
if: steps.cache-cargo.outputs.cache-hit != 'true'
run: |
cargo install wasm-bindgen-cli
cargo install wasm-pack
- name: Test Wasm
working-directory: rs/wasm
run: |
wasm-pack test --headless --chrome
build-wasm:
name: Build Wasm
runs-on: macos-15
needs: test-wasm
steps:
- name: Checkout the repo
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
with:
sparse-checkout: |
rs/wasm
- name: Cache Cargo
id: cache-cargo
uses: actions/cache@1bd1e32a3bdc45362d1e726936510720a7c30a57 # v4
with:
path: |
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
target/
key: wasm-${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
- name: Install Cargo
if: steps.cache-cargo.outputs.cache-hit != 'true'
run: |
cargo install wasm-bindgen-cli
cargo install wasm-pack
- name: Build Wasm
working-directory: rs/wasm
run: |
wasm-pack build --target web
- name: Upload wasm_pkg
uses: actions/upload-artifact@65c4c4a1ddee5b72f698fdd19549f0f0fb45cf08 # v4
with:
name: wasm-book
path: rs/wasm/pkg
if-no-files-found: error
test-js:
name: Test JS
runs-on: macos-15
steps:
- name: Checkout the repo
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
with:
sparse-checkout: |
js
- name: Setup Bun
uses: oven-sh/setup-bun@4bc047ad259df6fc24a6c9b0f9a0cb08cf17fbe5 # v2
with:
bun-version: "latest"
no-cache: true
- name: Install
working-directory: js
run: |
bun install
- name: Test Bun
working-directory: js
run: |
bun test
build-js:
name: Build JS
runs-on: macos-15
needs: [test-js, build-wasm]
steps:
- name: Checkout the repo
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
with:
sparse-checkout: |
js
- name: Cache dependencies
uses: actions/cache@1bd1e32a3bdc45362d1e726936510720a7c30a57 # v4
with:
path: |
~/.bun/install/cache
js/node_modules
key: js-${{ runner.os }}-bun-${{ hashFiles('**/bun.lock') }}
restore-keys: js-${{ runner.os }}-bun-
- name: Download wasm_pkg
uses: actions/download-artifact@fa0a91b85d4f404e444e00e005971372dc801d16 # v4
with:
name: wasm-book
path: pkg
- name: Copy wasm_js
run: |
cp pkg/wasm_book.js js
- name: Setup Bun
uses: oven-sh/setup-bun@4bc047ad259df6fc24a6c9b0f9a0cb08cf17fbe5 # v2
with:
bun-version: "latest"
no-cache: true
- name: Install
working-directory: js
run: |
bun install --production
bun create-highlight.bun.sh
- name: Build
working-directory: js
run: |
bun run build.js
- name: Upload JS
uses: actions/upload-artifact@65c4c4a1ddee5b72f698fdd19549f0f0fb45cf08 # v4
with:
name: build-js
path: js/dist
if-no-files-found: error
build-scss:
name: Build SCSS
runs-on: macos-15
steps:
- name: Checkout the repo
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
with:
sparse-checkout: |
scss
scss/catppuccin
- name: Setup Bun
uses: oven-sh/setup-bun@4bc047ad259df6fc24a6c9b0f9a0cb08cf17fbe5 # v2
with:
bun-version: "latest"
no-cache: true
- name: Build SCSS
working-directory: scss
run: |
bun install --production
bun run build.js
- name: Upload CSS
uses: actions/upload-artifact@65c4c4a1ddee5b72f698fdd19549f0f0fb45cf08 # v4
with:
name: css
path: scss/dist
if-no-files-found: error
convert-woff2:
name: Convert WOFF2
runs-on: macos-15
steps:
- name: Checkout the repo
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
with:
sparse-checkout: |
fonts
- name: Cache Woff2 output
id: cache-woff2
uses: actions/cache@1bd1e32a3bdc45362d1e726936510720a7c30a57 # v4
with:
path: fonts/woff2
key: python-${{ runner.os }}-fonts-${{ hashFiles('fonts/**') }}
restore-keys: |
python-${{ runner.os }}-fonts-
- name: Install Poetry
if: steps.cache-woff2.outputs.cache-hit != 'true'
run: |
curl -sSL https://install.python-poetry.org | python -
echo "$HOME/.local/bin" >> $GITHUB_PATH
- name: Install Dependencies
if: steps.cache-woff2.outputs.cache-hit != 'true'
working-directory: fonts
run: |
set -e
poetry install
- name: Convert and Copy Woff2
if: steps.cache-woff2.outputs.cache-hit != 'true'
working-directory: fonts
run: |
set -e
mkdir -p woff2
poetry run python convert.py NerdFontsSymbolsOnly/SymbolsNerdFontMono-Regular.ttf woff2
poetry run python convert.py Open_Sans/static/OpenSans-BoldItalic.ttf woff2
poetry run python convert.py Open_Sans/static/OpenSans-Italic.ttf woff2
cp "Fira Code/FiraCode-VF.woff2" woff2
- name: Upload font artifacts
uses: actions/upload-artifact@65c4c4a1ddee5b72f698fdd19549f0f0fb45cf08 # v4
with:
name: woff2
path: fonts/woff2
if-no-files-found: error
test-mdbook-backend:
name: Test mdBook Backend
runs-on: macos-15
steps:
- name: Checkout the repo
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
with:
sparse-checkout: |
rs/mdbook-footnote
- name: Cache Cargo
uses: actions/cache@1bd1e32a3bdc45362d1e726936510720a7c30a57 # v4
with:
path: |
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
target/
key: test-backend-${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
- name: Test Cargo (mdbook-footnote)
working-directory: rs/mdbook-footnote
run: |
cargo test --verbose
build-and-deploy:
name: Build and Deploy
runs-on: macos-15
if: ${{ github.ref == 'refs/heads/main' }}
needs: [build-wasm, build-js, build-scss, convert-woff2, test-mdbook-backend]
steps:
- name: Checkout the repo
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
with:
sparse-checkout: |
.
rs/mdbook-footnote
src
theme
- name: Download All Artifacts
uses: actions/download-artifact@fa0a91b85d4f404e444e00e005971372dc801d16 # v4
with:
path: artifacts
- name: Copy Files
run: |
cp artifacts/wasm-book/wasm_book_bg.wasm src
cp artifacts/build-js/* src
cp -r artifacts/woff2 src
cp -r artifacts/css src
- name: Cache Cargo
id: cache-cargo
uses: actions/cache@1bd1e32a3bdc45362d1e726936510720a7c30a57 # v4
with:
path: |
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
target/
key: backend-${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
- name: Setup Backend
if: steps.cache-cargo.outputs.cache-hit != 'true'
run: |
cargo install mdbook-admonish
cargo install mdbook-tailor
cargo install --path ./rs/mdbook-footnote
- name: Setup mdBook
uses: peaceiris/actions-mdbook@ee69d230fe19748b7abf22df32acaa93833fad08 # v2
with:
mdbook-version: "0.4.43"
- name: Build mdBook
run: |
mdbook build
- name: Generate Page List
working-directory: book
run: |
sed \
-e 's|<ol class="section">|<ol>|g' \
-e 's|<li class="chapter-item expanded ">|<li>|g' \
-e 's| target="_parent"||g' \
toc.html > pagelist.html
- name: Remove Unneeded Files
working-directory: book
run: |
rm ayu-highlight.css
rm clipboard.min.js
rm elasticlunr.min.js
rm favicon.png
rm fonts.css
rm highlight.css
rm highlight.js
rm searcher.js
rm toc.html
rm toc.js
rm tomorrow-night.css
rm css/chrome.css
rm css/variables.css
rm mark.min.js
rm searchindex.js
rm -rf FontAwesome
rm -rf fonts
- name: List Segments
run: |
ls -alR book
- name: Deploy
uses: peaceiris/actions-gh-pages@4f9cc6602d3f66b9c108549d475ec49e8ef4d45e # v4
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: book