2019-10-21 05:44:28 +08:00
|
|
|
name: CI
|
|
|
|
on:
|
|
|
|
pull_request:
|
2023-07-17 04:21:45 +08:00
|
|
|
merge_group:
|
2019-10-21 05:44:28 +08:00
|
|
|
|
|
|
|
jobs:
|
|
|
|
test:
|
|
|
|
name: Test
|
|
|
|
runs-on: ${{ matrix.os }}
|
|
|
|
strategy:
|
|
|
|
matrix:
|
|
|
|
build: [stable, beta, nightly, macos, windows, msrv]
|
|
|
|
include:
|
|
|
|
- build: stable
|
|
|
|
os: ubuntu-latest
|
|
|
|
rust: stable
|
|
|
|
- build: beta
|
|
|
|
os: ubuntu-latest
|
|
|
|
rust: beta
|
|
|
|
- build: nightly
|
|
|
|
os: ubuntu-latest
|
|
|
|
rust: nightly
|
|
|
|
- build: macos
|
|
|
|
os: macos-latest
|
|
|
|
rust: stable
|
|
|
|
- build: windows
|
|
|
|
os: windows-latest
|
|
|
|
rust: stable
|
|
|
|
- build: msrv
|
2022-12-15 21:52:15 +08:00
|
|
|
os: ubuntu-20.04
|
2022-12-14 23:19:37 +08:00
|
|
|
# sync MSRV with docs: guide/src/guide/installation.md and Cargo.toml
|
2023-11-30 06:36:39 +08:00
|
|
|
rust: 1.70.0
|
2019-10-21 05:44:28 +08:00
|
|
|
steps:
|
2023-04-03 03:35:08 +08:00
|
|
|
- uses: actions/checkout@v3
|
2019-10-21 05:44:28 +08:00
|
|
|
- name: Install Rust
|
|
|
|
run: bash ci/install-rust.sh ${{ matrix.rust }}
|
|
|
|
- name: Build and run tests
|
2023-02-13 23:43:10 +08:00
|
|
|
run: cargo test --locked
|
2019-10-21 05:44:28 +08:00
|
|
|
- name: Test no default
|
|
|
|
run: cargo test --no-default-features
|
|
|
|
|
|
|
|
rustfmt:
|
|
|
|
name: Rustfmt
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
2023-04-03 03:35:08 +08:00
|
|
|
- uses: actions/checkout@v3
|
2019-10-21 05:44:28 +08:00
|
|
|
- name: Install Rust
|
|
|
|
run: rustup update stable && rustup default stable && rustup component add rustfmt
|
2022-01-14 08:01:42 +08:00
|
|
|
- run: cargo fmt --check
|
2023-07-25 11:16:07 +08:00
|
|
|
|
2023-07-30 00:13:55 +08:00
|
|
|
# The success job is here to consolidate the total success/failure state of
|
|
|
|
# all other jobs. This job is then included in the GitHub branch protection
|
|
|
|
# rule which prevents merges unless all other jobs are passing. This makes
|
|
|
|
# it easier to manage the list of jobs via this yml file and to prevent
|
|
|
|
# accidentally adding new jobs without also updating the branch protections.
|
2023-07-25 11:16:07 +08:00
|
|
|
success:
|
|
|
|
name: Success gate
|
2023-07-30 00:13:55 +08:00
|
|
|
if: always()
|
2023-07-25 11:16:07 +08:00
|
|
|
needs:
|
|
|
|
- test
|
|
|
|
- rustfmt
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
2023-07-30 00:13:55 +08:00
|
|
|
- run: jq --exit-status 'all(.result == "success")' <<< '${{ toJson(needs) }}'
|
|
|
|
- name: Done
|
|
|
|
run: exit 0
|