1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132
|
name: Rust
on:
push:
branches: [ master ]
pull_request:
branches: [ master ]
env:
CARGO_INCREMENTAL: 0
CARGO_TERM_COLOR: always
RUST_BACKTRACE: 1
RUSTFLAGS: -D warnings
RUSTDOCFLAGS: -D warnings --cfg docsrs
jobs:
get-package-info:
runs-on: ubuntu-latest
outputs:
msrv: ${{ steps.msrv.outputs.metadata }}
name: ${{ steps.name.outputs.metadata }}
version: ${{ steps.version.outputs.metadata }}
steps:
- uses: actions/checkout@v4
- name: Get MSRV
id: msrv
uses: nicolaiunrein/cargo-get@v1.4.0
with:
subcommand: 'package.rust_version'
- name: Get package name
id: name
uses: nicolaiunrein/cargo-get@v1.4.0
with:
subcommand: 'package.name'
- name: Get package version
id: version
uses: nicolaiunrein/cargo-get@v1.4.0
with:
subcommand: 'package.version'
build_test:
needs: get-package-info
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ ubuntu-latest, windows-latest ]
rust:
- ${{ needs.get-package-info.outputs.msrv }}
- stable
- beta
- nightly
steps:
- uses: actions/checkout@v4
- name: Install toolchain
uses: dtolnay/rust-toolchain@master
with:
toolchain: ${{ matrix.rust }}
components: rustfmt, clippy
- name: Use tinyvec 1.6.0
if: matrix.rust == ${{ needs.get-package-info.outputs.msrv }}
run: cargo update -p tinyvec --precise 1.6.0
- name: Build
run: cargo build --verbose
- name: Run tests with all features
run: cargo test --all-features --verbose
- name: Run tests without features
run: cargo test --no-default-features --verbose
- name: Package
run: cargo package --offline
- name: Test package
working-directory: target/package/${{ needs.get-package-info.outputs.name }}-${{ needs.get-package-info.outputs.version }}/
run: cargo test --offline
- name: Test package without features
working-directory: target/package/${{ needs.get-package-info.outputs.name }}-${{ needs.get-package-info.outputs.version }}/
run: cargo test --no-default-features --offline
docs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Install toolchain
uses: dtolnay/rust-toolchain@master
with:
toolchain: nightly
- name: Build docs
run: cargo doc --all-features --verbose
lints:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Install toolchain
uses: dtolnay/rust-toolchain@master
with:
toolchain: stable
components: rustfmt, clippy
- name: Check formatting
run: cargo fmt --all --check
- name: Check clippy
run: cargo clippy --all-features --lib --tests --examples --verbose
- name: Check fuzz tests with clippy
working-directory: fuzz
run: cargo clippy --all-features --all-targets --verbose
- name: Check fuzz tests formatting
working-directory: fuzz
run: cargo fmt --all --check
bench-lints:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Install toolchain
uses: dtolnay/rust-toolchain@master
with:
toolchain: nightly
components: rustfmt, clippy
- name: Check benchmarks with clippy
run: cargo clippy --all-features --benches --verbose
regen:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v5
with:
python-version: '3.12'
- name: Regen
run: cd scripts && python3 unicode.py
- name: Diff tables
run: diff src/tables.rs scripts/tables.rs
- name: Diff tests
run: diff tests/data/normalization_tests.rs scripts/normalization_tests.rs
|