ci: update .github/workflows/test.yml #43
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: TEST | |
env: | |
CARGO_TERM_COLOR: always | |
# MSRV: 1.56.0 | |
on: | |
push: | |
branches: | |
- main | |
jobs: | |
check: | |
name: Rust project | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Checkout google/comprehensive-rust code | |
uses: actions/checkout@v4 | |
with: | |
repository: google/comprehensive-rust | |
path: 'comprehensive-rust' | |
- name: Install formatting dependencies | |
run: | | |
sudo apt update | |
sudo apt install gettext yapf3 | |
# - id: setup | |
# name: Setup Toolchain | |
# uses: dtolnay/rust-toolchain@stable | |
# with: | |
# toolchain: stable | |
# components: llvm-tools-preview | |
# - name: Install Rust | |
# run: | | |
# rustup set profile minimal | |
# # rustup toolchain install 1.57 -c rust-docs | |
# # rustup default 1.57 | |
# rustup install 1.76.0 | |
# rustup default nightly-2024-02-04 | |
# - name: Install nightly rustfmt | |
# run: | | |
# rustup default nightly | |
# rustup component add rustfmt | |
# - name: Install latest nightly | |
# uses: actions-rs/toolchain@v1 | |
# with: | |
# toolchain: nightly | |
# override: true | |
# components: rustfmt, clippy | |
# - name: Update rustup | |
# run: rustup self update | |
# - name: Install Rust | |
# run: | | |
# rustup set profile minimal | |
# rustup toolchain install nightly -c rust-docs | |
# rustup default nightly | |
- id: setup | |
name: Setup Toolchain | |
uses: dtolnay/rust-toolchain@stable | |
with: | |
toolchain: stable | |
components: llvm-tools-preview | |
# - name: Install Rust | |
# id: install-rust | |
# uses: dtolnay/rust-toolchain@master | |
# with: | |
# # Pin nightly to specific version to avoid ahash breakage. | |
# # See https://github.com/tkaitchuck/aHash/issues/200 | |
# # TODO(mina86): Unpin once situation with ahash is resolved. | |
# # Hopefully we won’t need to patch. | |
# #toolchain: nightly | |
# toolchain: nightly-2024-02-05 | |
# components: clippy rustfmt miri | |
- name: Install mdbook | |
run: | | |
mkdir bin | |
curl -sSL https://github.com/rust-lang/mdBook/releases/download/v0.4.5/mdbook-v0.4.5-x86_64-unknown-linux-gnu.tar.gz | tar -xz --directory=bin | |
echo "$(pwd)/bin" >> $GITHUB_PATH | |
- run: mkdir dist | |
- run: git clone https://github.com/rust-lang-cn/rust-by-example-cn.git -b master rust-by-example-cn --depth 1 | |
- run: git clone https://github.com/rust-lang-cn/book-cn.git -b master book --depth 1 | |
- run: git clone https://github.com/rust-lang-cn/std-cn.git -b main std --depth 1 | |
- run: git clone https://github.com/rust-lang-cn/reference-cn.git -b master reference-cn --depth 1 | |
- run: git clone https://github.com/rust-lang-cn/rustdoc-cn.git -b master rustdoc-cn --depth 1 | |
- run: git clone https://github.com/rust-lang-cn/cargo-cn.git -b master cargo --depth 1 | |
- run: git clone https://github.com/rust-lang-cn/edition-guide-cn.git -b master edition-guide --depth 1 | |
- run: git clone https://github.com/rust-lang-cn/nomicon-zh-Hans.git -b main nomicon --depth 1 | |
- run: git clone https://github.com/rust-lang-cn/style-guide-cn.git -b main style-guide-cn --depth 1 | |
- run: git clone https://github.com/zzy/rust-cookbook-zh-cn.git -b master rust-cookbook-cn --depth 1 | |
- run: git clone https://github.com/jaywcjlove/reference.git -b gh-pages quick-reference --depth 1 | |
- run: git clone https://github.com/sunface/rust-course.git -b main rust-course --depth 1 | |
- run: git clone https://github.com/rustlang-cn/rusty-book.git -b main rusty-book --depth 1 | |
- run: git clone https://github.com/rustlang-cn/rust-algos.git -b gh-pages rust-algos --depth 1 | |
- run: git clone https://github.com/krahets/hello-algo.git -b gh-pages hello-algo --depth 1 | |
- run: cp -rp std/doc dist/std | |
- run: rm -rf book/.git | |
- run: rm -rf rust-by-example-cn/.git | |
- run: rm -rf comprehensive-rust/.git | |
- run: rm -rf quick-reference/.git | |
- run: cp -rp quick-reference dist/quick-reference | |
- run: rm -rf rust-algos/.git | |
- run: cp -rp rust-algos dist/rust-algos | |
- run: rm -rf hello-algo/.git | |
- run: cp -rp hello-algo dist/hello-algo | |
- run: rm -rf rust-course/.git | |
- run: rm -rf rusty-book/.git | |
- run: rm -rf style-guide-cn/.git | |
- run: rm -rf reference-cn/.git | |
- name: 📗 book | |
working-directory: book | |
run: | | |
mdbook build | |
rm -rf .git | |
ls -al | |
cp -rp ./book ../dist/book | |
- name: 📗 style-guide-cn | |
working-directory: style-guide-cn | |
run: | | |
mdbook build | |
rm -rf .git | |
ls -al | |
cp -rp ./book ../dist/style-guide-cn | |
- name: 📗 rust-by-example-cn | |
working-directory: rust-by-example-cn | |
run: | | |
mdbook build | |
rm -rf .git | |
ls -al | |
cp -rp ./book ../dist/rust-by-example-cn | |
- name: 📗 rust-course | |
working-directory: rust-course | |
run: | | |
mdbook build | |
rm -rf .git | |
ls -al | |
cp -rp ./book ../dist/rust-course | |
- name: 📗 rusty-book | |
working-directory: rusty-book | |
run: | | |
mdbook build | |
rm -rf .git | |
ls -al | |
cp -rp ./book ../dist/rusty-book | |
- name: 📗 rustdoc-cn | |
working-directory: rustdoc-cn | |
run: | | |
mdbook build | |
rm -rf .git | |
ls -al | |
cp -rp ./book ../dist/rustdoc | |
- name: 📗 reference-cn | |
working-directory: reference-cn | |
run: | | |
mdbook build | |
rm -rf .git | |
ls -al | |
cp -rp ./book ../dist/reference | |
- name: 📗 rust-cookbook-cn | |
working-directory: rust-cookbook-cn | |
run: | | |
mdbook build | |
rm -rf .git | |
cp -rp ./book ../dist/rust-cookbook | |
- name: 📗 cargo | |
working-directory: cargo | |
run: | | |
mdbook build | |
rm -rf .git | |
cp -rp ./book ../dist/cargo | |
- name: 📗 edition-guide | |
working-directory: edition-guide | |
run: | | |
mdbook build | |
rm -rf .git | |
cp -rp ./book ../dist/edition-guide | |
- name: 📗 nomicon | |
working-directory: nomicon | |
run: | | |
mdbook build | |
rm -rf .git | |
cp -rp ./book ../dist/nomicon | |
- name: Install Gettext | |
run: | | |
sudo apt update | |
sudo apt install gettext | |
- name: 📗 comprehensive-rust | |
working-directory: comprehensive-rust | |
env: | |
MDBOOK_BOOK__LANGUAGE: zh-CN | |
run: | | |
cargo clean | |
cargo build | |
cargo install mdbook --version 0.4.37 | |
cargo install --locked mdbook-svgbob --version 0.2.1 | |
cargo install --locked mdbook-i18n-helpers --version 0.3.3 | |
cargo install --locked i18n-report --version 0.2.0 | |
cargo install --locked mdbook-linkcheck | |
cargo install --path mdbook-exerciser | |
cargo install --path mdbook-course | |
mdbook build -d book/zh-CN | |
rm -rf .git | |
cp -rp ./book/zh-CN/html ../dist/comprehensive-rust | |
- name: Modify README.md | |
uses: jaywcjlove/github-action-modify-file-content@main | |
with: | |
path: README.md | |
body: "{{date:YYYY-MM-DD HH:mm:ss}}" | |