Skip to content

Wrap source lines in mdbook-i18n-normalize #341

Wrap source lines in mdbook-i18n-normalize

Wrap source lines in mdbook-i18n-normalize #341

Workflow file for this run

name: tests
on:
pull_request:
push:
branches:
- main
env:
CARGO_TERM_COLOR: always
FORCE_COLOR: 3
jobs:
test:
name: Test
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- uses: Swatinem/rust-cache@v2
with:
save-if: ${{ github.ref == 'refs/heads/main' }}
- name: Test
run: cargo test
test-other-books:
strategy:
matrix:
include:
# Update the refs below once in a while.
- repo: rust-lang/book
ref: 5b6c1ceaa62ecbd6caef08df39b33b3938e99deb
- repo: google/comprehensive-rust
ref: 0dfd087538ed4b52cf30cafb3b9add49cd6d204a
name: Test with ${{ matrix.repo }}
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- uses: Swatinem/rust-cache@v2
with:
save-if: ${{ github.ref == 'refs/heads/main' }}
- name: Install tools
run: |
sudo apt install gettext
# Debug builds are fine and slightly faster.
cargo install --debug --path i18n-helpers
cargo install --debug --locked --version 0.4.35 mdbook
- name: Checkout ${{ matrix.repo }}
uses: actions/checkout@v4
with:
repository: ${{ matrix.repo }}
ref: ${{ matrix.ref }}
path: example-book
- name: Test extracting text
working-directory: example-book
run: |
MDBOOK_OUTPUT='{"xgettext": {"pot-file": "messages.pot"}}' mdbook build -d po
msgfmt -o /dev/null --statistics po/messages.pot
fuzz:
name: Fuzz test
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Install nightly Rust
run: rustup default nightly
- uses: Swatinem/rust-cache@v2
with:
# Default is "v0-rust"
# Use a separate key to prevent collision with main cache
prefix-key: "fuzz"
# Cache only on main build
save-if: ${{ github.ref == 'refs/heads/main' }}
cache-directories: |
i18n-helpers/fuzz/target
i18n-helpers/fuzz/corpus
- name: Install cargo-fuzz
run: cargo install cargo-fuzz
- name: Run group_events fuzzer and minimize corpus
run: |
cd i18n-helpers
cargo fuzz run group_events -- -only_ascii=1 -max_total_time=30
cargo fuzz cmin group_events
- name: Run normalize fuzzer and minimize corpus
run: |
cd i18n-helpers
cargo fuzz run normalize -- -only_ascii=1 -max_total_time=30
cargo fuzz cmin normalize
- name: Run gettext fuzzer and minimize corpus
run: |
cd i18n-helpers
cargo fuzz run gettext -- -only_ascii=1 -max_total_time=30
cargo fuzz cmin normalize
clippy:
name: Clippy
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- uses: Swatinem/rust-cache@v2
- name: Clippy
run: cargo clippy -- -D clippy::dbg_macro -D clippy::print_stdout -D clippy::print_stderr -D clippy::all
- name: Clippy on fuzzers
working-directory: ./i18n-helpers/fuzz
run: cargo clippy -- -D clippy::dbg_macro -D clippy::print_stdout -D clippy::print_stderr -D clippy::all
format:
name: Format
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
# We use an unstable rustmft feature and we thus need the
# nightly channel to enforce the formatting.
- name: Setup Rust nightly
run: rustup default nightly
- name: Install rustfmt
run: rustup component add rustfmt
- name: Check Formatting
uses: dprint/[email protected]