name: CI
on:
push:
branches: [main]
pull_request:
schedule:
- cron: "17 6 * * 1"
env:
CARGO_TERM_COLOR: always
RUSTFLAGS: -D warnings
jobs:
test:
name: test / ${{ matrix.rust }}
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
rust: [stable, beta, nightly]
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@master
with:
toolchain: ${{ matrix.rust }}
- uses: Swatinem/rust-cache@v2
- run: cargo test --offline --locked
- run: cargo test --offline --locked --release
features:
name: feature combinations
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
- uses: Swatinem/rust-cache@v2
- run: cargo build --offline --no-default-features
- run: cargo build --offline --no-default-features --features alloc
- run: cargo build --offline --all-features
- run: cargo test --offline --no-default-features --features alloc
no-std:
name: no_std on a bare-metal target
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
with:
targets: thumbv7em-none-eabi
- uses: Swatinem/rust-cache@v2
- run: cargo build --offline --no-default-features --target thumbv7em-none-eabi
- run: cargo build --offline --no-default-features --features alloc --target thumbv7em-none-eabi
msrv:
name: MSRV 1.75
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@1.75.0
- uses: Swatinem/rust-cache@v2
- run: cargo build --offline --no-default-features
- run: cargo build --offline --all-features
- run: cargo test --offline -p cellwidth
oracles:
name: differential vs other implementations
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
- uses: Swatinem/rust-cache@v2
- run: cargo test --manifest-path oracles/Cargo.toml --locked
lint:
name: fmt, clippy, docs
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
with:
components: rustfmt, clippy
- uses: Swatinem/rust-cache@v2
- run: cargo fmt --all --check
- run: cargo fmt --manifest-path oracles/Cargo.toml --all --check
- run: cargo clippy --all-targets --all-features -- -D warnings
- run: cargo clippy --manifest-path oracles/Cargo.toml --all-targets -- -D warnings
- run: cargo clippy --manifest-path probe/Cargo.toml --all-targets -- -D warnings
- run: cargo fmt --manifest-path probe/Cargo.toml --all --check
- run: cargo doc --no-deps --all-features
env:
RUSTDOCFLAGS: -D warnings
miri:
name: miri
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@nightly
with:
components: miri
- uses: Swatinem/rust-cache@v2
- run: |
cargo miri test -p cellwidth -- \
--skip line_break_test --skip grapheme_break_test
coverage:
name: coverage
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
with:
components: llvm-tools-preview
- uses: taiki-e/install-action@cargo-llvm-cov
- uses: Swatinem/rust-cache@v2
- name: enforce full line and function coverage
run: |
cargo llvm-cov -p cellwidth --all-features \
--ignore-filename-regex 'tables\.rs' \
--fail-under-lines 100 --fail-under-functions 100 --summary-only
- name: upload lcov
run: cargo llvm-cov report --lcov --output-path lcov.info
- uses: actions/upload-artifact@v4
with:
name: lcov
path: lcov.info
fuzz:
name: fuzz smoke
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
target: [width, truncate, cell, lossless, wrap, table]
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@nightly
- uses: taiki-e/install-action@cargo-fuzz
- uses: Swatinem/rust-cache@v2
- run: cargo fuzz run ${{ matrix.target }} -- -max_total_time=60
working-directory: fuzz
semver:
name: semver
runs-on: ubuntu-latest
if: github.event_name == 'pull_request'
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: dtolnay/rust-toolchain@stable
- uses: taiki-e/install-action@cargo-semver-checks
- uses: Swatinem/rust-cache@v2
- run: cargo semver-checks --baseline-rev ${{ github.event.pull_request.base.sha }} -p cellwidth
package:
name: publish dry run
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
- uses: Swatinem/rust-cache@v2
- run: cargo publish --dry-run -p cellwidth --locked
terminals:
name: re-record real terminals
runs-on: ubuntu-latest
if: github.event_name == 'schedule'
continue-on-error: true
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
- uses: Swatinem/rust-cache@v2
- name: install terminals
run: |
sudo apt-get update
sudo apt-get install -y xvfb python3-gi gir1.2-vte-2.91 alacritty
curl -sSL https://sw.kovidgoyal.net/kitty/installer.sh \
| sh /dev/stdin dest=$HOME/.local launch=n
echo "$HOME/.local/kitty.app/bin" >> "$GITHUB_PATH"
- run: ./probe/drivers/run_all.sh
- name: fail if a terminal changed its mind
run: git diff --exit-code tests/data/terminals/
unicode-freshness:
name: unicode is current
runs-on: ubuntu-latest
if: github.event_name == 'schedule'
steps:
- uses: actions/checkout@v4
- run: ./tools/check_ucd_version.sh