2024-05-24 22:45:59 +08:00
|
|
|
name: "CI"
|
|
|
|
|
|
|
|
on:
|
2024-05-24 22:47:14 +08:00
|
|
|
push:
|
|
|
|
branches:
|
|
|
|
- main
|
2024-05-24 22:45:59 +08:00
|
|
|
pull_request:
|
|
|
|
branches:
|
|
|
|
- main
|
|
|
|
|
|
|
|
jobs:
|
2024-05-25 00:15:38 +08:00
|
|
|
build:
|
2024-05-24 23:00:03 +08:00
|
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
2024-05-25 00:15:38 +08:00
|
|
|
- uses: actions/checkout@v4
|
2024-05-25 00:26:15 +08:00
|
|
|
with:
|
|
|
|
fetch-depth: 0
|
2024-05-25 00:15:38 +08:00
|
|
|
- uses: actions-rust-lang/setup-rust-toolchain@v1
|
2024-08-06 23:09:04 +08:00
|
|
|
- name: Install exercise plugin
|
2024-05-25 00:15:38 +08:00
|
|
|
run: cargo install --path helpers/mdbook-exercise-linker
|
2024-08-06 23:09:04 +08:00
|
|
|
- name: Install link shortener plugin
|
|
|
|
run: cargo install --path helpers/mdbook-link-shortener
|
2024-08-05 23:52:15 +08:00
|
|
|
- name: Install mdbook-pandoc and related dependencies
|
|
|
|
run: |
|
|
|
|
cargo install mdbook-pandoc --locked --version 0.7.1
|
|
|
|
sudo apt-get update
|
|
|
|
sudo apt-get install -y fonts-noto
|
|
|
|
|
|
|
|
export PANDOC_VERSION=3.3
|
|
|
|
curl -LsSf https://github.com/jgm/pandoc/releases/download/${PANDOC_VERSION}/pandoc-${PANDOC_VERSION}-linux-amd64.tar.gz | tar zxf -
|
|
|
|
echo "$PWD/pandoc-${PANDOC_VERSION}/bin" >> $GITHUB_PATH
|
|
|
|
shell: bash
|
|
|
|
- name: Setup TeX Live
|
|
|
|
uses: teatimeguest/setup-texlive-action@v3
|
|
|
|
with:
|
|
|
|
packages:
|
|
|
|
scheme-basic
|
|
|
|
luatex
|
|
|
|
lualatex-math
|
|
|
|
luacolor
|
|
|
|
luatexbase
|
|
|
|
luaotfload
|
|
|
|
framed
|
|
|
|
unicode-math
|
|
|
|
xcolor
|
|
|
|
geometry
|
|
|
|
longtable
|
|
|
|
booktabs
|
|
|
|
array
|
|
|
|
lua-ul
|
|
|
|
etoolbox
|
|
|
|
fancyvrb
|
|
|
|
footnote
|
|
|
|
selnolig
|
|
|
|
natbib
|
|
|
|
csquotes
|
|
|
|
bookmark
|
|
|
|
xurl
|
|
|
|
amsmath
|
|
|
|
setspace
|
|
|
|
iftex
|
|
|
|
- name: Check `tlmgr` version
|
|
|
|
run: tlmgr --version
|
2024-05-25 00:15:38 +08:00
|
|
|
- uses: taiki-e/install-action@v2
|
|
|
|
with:
|
|
|
|
tool: mdbook
|
2024-05-24 22:45:59 +08:00
|
|
|
- name: Build book
|
2024-08-06 23:09:04 +08:00
|
|
|
env:
|
|
|
|
LINK_SHORTENER_VERIFY: "true"
|
2024-05-24 22:45:59 +08:00
|
|
|
run: |
|
|
|
|
cd book
|
2024-05-25 00:15:38 +08:00
|
|
|
mdbook build
|
2024-05-24 22:45:59 +08:00
|
|
|
- name: Link Checker
|
|
|
|
uses: lycheeverse/lychee-action@v1
|
|
|
|
with:
|
|
|
|
fail: true
|
|
|
|
args: |
|
|
|
|
--exclude-loopback
|
|
|
|
--require-https
|
|
|
|
--no-progress
|
2024-08-05 23:52:15 +08:00
|
|
|
book/book/html/
|
|
|
|
# Upload the HTML book as an artifact
|
2024-05-25 00:15:38 +08:00
|
|
|
- uses: actions/upload-artifact@v4
|
|
|
|
with:
|
|
|
|
name: book
|
2024-08-05 23:52:15 +08:00
|
|
|
# When you support multiple formats, the output directory changes
|
|
|
|
# to include the format in its path.
|
|
|
|
path: book/book/html
|
|
|
|
- uses: actions/upload-artifact@v4
|
|
|
|
with:
|
2024-08-06 23:09:04 +08:00
|
|
|
name: online-pdf
|
2024-08-05 23:52:15 +08:00
|
|
|
path: book/book/pandoc/pdf/100-exercises-to-learn-rust.pdf
|
2024-08-06 23:09:04 +08:00
|
|
|
- uses: actions/upload-artifact@v4
|
|
|
|
with:
|
|
|
|
name: paperback
|
|
|
|
path: book/book/pandoc/paperback/100-exercises-to-learn-rust.pdf
|
|
|
|
|
|
|
|
is_fresh:
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
|
|
- uses: actions/checkout@v3
|
|
|
|
- run: sudo apt-get update && sudo apt-get install -y jq
|
|
|
|
- run: |
|
|
|
|
./helpers/json2redirects.sh book/link2alias.json > site/redirects
|
|
|
|
# Verify nothing has changed, meaning that the redirect file is up-to-date
|
|
|
|
- run: |
|
|
|
|
git diff --exit-code site/redirects
|
2024-05-25 00:15:38 +08:00
|
|
|
|
|
|
|
formatter:
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
|
|
- uses: actions/checkout@v3
|
|
|
|
- uses: dprint/check@v2.2
|