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