|
| 1 | +on: |
| 2 | + push: |
| 3 | + branches: [main, release] |
| 4 | + pull_request: |
| 5 | + types: [opened, synchronize, reopened] |
| 6 | + merge_group: |
| 7 | + |
| 8 | +name: CI |
| 9 | + |
| 10 | +# Cancel previous workflows if they are the same workflow on same ref (branch/tags) |
| 11 | +# with the same event (push/pull_request) even they are in progress. |
| 12 | +# This setting will help reduce the number of duplicated workflows. |
| 13 | +concurrency: |
| 14 | + group: ${{ github.workflow }}-${{ github.ref }}-${{ github.event_name }} |
| 15 | + cancel-in-progress: true |
| 16 | + |
| 17 | +env: |
| 18 | + CARGO_ARGS: --no-default-features --features stdlib,zlib,importlib,encodings,ssl,jit |
| 19 | + |
| 20 | +jobs: |
| 21 | + rust_tests: |
| 22 | + if: ${{ !contains(github.event.pull_request.labels.*.name, 'skip:ci') }} |
| 23 | + env: |
| 24 | + RUST_BACKTRACE: full |
| 25 | + name: Run rust tests |
| 26 | + runs-on: ${{ matrix.os }} |
| 27 | + strategy: |
| 28 | + matrix: |
| 29 | + os: [ubuntu-latest, windows-latest] |
| 30 | + fail-fast: false |
| 31 | + steps: |
| 32 | + - uses: actions/checkout@v3 |
| 33 | + - uses: dtolnay/rust-toolchain@stable |
| 34 | + - name: Set up the Mac environment |
| 35 | + run: brew install autoconf automake libtool |
| 36 | + if: runner.os == 'macOS' |
| 37 | + |
| 38 | + - uses: Swatinem/rust-cache@v2 |
| 39 | + |
| 40 | + - name: run tests |
| 41 | + run: cargo test --all --all-features |
| 42 | + |
| 43 | + lint: |
| 44 | + name: Check Rust code with rustfmt and clippy |
| 45 | + runs-on: ubuntu-latest |
| 46 | + steps: |
| 47 | + - uses: actions/checkout@v3 |
| 48 | + - uses: dtolnay/rust-toolchain@stable |
| 49 | + with: |
| 50 | + components: rustfmt, clippy |
| 51 | + - name: run rustfmt |
| 52 | + run: cargo fmt --all -- --check |
| 53 | + - name: run clippy |
| 54 | + run: cargo clippy --all --all-features -- -Dwarnings |
0 commit comments