diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 9bb83ed..24bfe42 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -2,101 +2,96 @@ name: Tests and Lints on: [push, pull_request] +env: + RUSTFLAGS: "-Dwarnings" + jobs: - build_test_format_lint: - name: ${{matrix.command.name}} (${{matrix.toolchain}}) + rust_check: + name: Rust check runs-on: ubuntu-latest strategy: - fail-fast: false - matrix: - toolchain: [stable, 1.75.0] - command: - - name: Check - command: check - args: --all-features --all --all-targets - - name: Test - command: test - args: --all-features - include: - - toolchain: stable - command: - name: Format - command: fmt - args: -- --check - - toolchain: stable - command: - name: Lint - command: clippy - args: --all-features --tests --benches -- -D clippy::all -D warnings - - toolchain: stable - command: - name: Doc - command: doc - args: --all-features --all + fail-fast: true + + steps: + - uses: actions/checkout@v3 + + - name: Install toolchain + uses: actions-rust-lang/setup-rust-toolchain@v1 + + - name: cargo check + run: cargo check --bins --tests --all-features + + rust_format: + name: Rust format + runs-on: ubuntu-latest + + strategy: + fail-fast: true steps: - - uses: actions/checkout@v2 - with: - submodules: true + - uses: actions/checkout@v3 - name: Install toolchain - uses: actions-rs/toolchain@v1 - with: - toolchain: ${{ matrix.toolchain }} - profile: minimal - override: true - default: true - components: rustfmt, clippy - - - name: Rust cache - uses: Swatinem/rust-cache@v2 - with: - key: ${{ runner.os }}-${{ matrix.command.name }}-${{ matrix.toolchain }} - - - name: ${{matrix.command.name}} - uses: actions-rs/cargo@v1 - with: - command: ${{matrix.command.command}} - args: ${{matrix.command.args}} - - build_test_format_lint_optional: - name: ${{matrix.command.name}} (${{matrix.toolchain}}, optional) + uses: actions-rust-lang/setup-rust-toolchain@v1 + with: + components: rustfmt + + - name: cargo format + uses: actions-rust-lang/rustfmt@v1 + + rust_lint: + name: Rust lint runs-on: ubuntu-latest + needs: ["rust_check", "rust_format"] strategy: - fail-fast: false + fail-fast: true matrix: - toolchain: [beta, nightly] - command: - - name: Check - command: check - args: --all-features --all --all-targets - - name: Test - command: test - args: --all-features + toolchain: [null, "stable", "beta", "nightly"] + + steps: + - uses: actions/checkout@v3 + + - name: Install toolchain + uses: actions-rust-lang/setup-rust-toolchain@v1 + with: + components: clippy + toolchain: ${{matrix.toolchain}} + + - name: cargo clippy + run: cargo clippy --bins --tests --all-features + + rust_test: + name: Rust test + runs-on: ubuntu-latest + needs: ["rust_check", "rust_format"] + + strategy: + fail-fast: true + + steps: + - uses: actions/checkout@v3 + + - name: Install toolchain + uses: actions-rust-lang/setup-rust-toolchain@v1 + + - name: cargo test + run: cargo test --all-features + + rust_doc: + name: Rust doc + runs-on: ubuntu-latest + needs: ["rust_check", "rust_format"] + + strategy: + fail-fast: true steps: - - uses: actions/checkout@v2 - with: - submodules: true + - uses: actions/checkout@v3 - name: Install toolchain - uses: actions-rs/toolchain@v1 - with: - toolchain: ${{ matrix.toolchain }} - profile: minimal - override: true - default: true - components: rustfmt, clippy - - - name: Rust cache - uses: Swatinem/rust-cache@v2 - with: - key: ${{ runner.os }}-${{ matrix.command.name }}-${{ matrix.toolchain }}-optional - - - name: ${{matrix.command.name}} - uses: actions-rs/cargo@v1 - with: - command: ${{matrix.command.command}} - args: ${{matrix.command.args}} + uses: actions-rust-lang/setup-rust-toolchain@v1 + + - name: cargo doc + run: cargo doc --all-features diff --git a/Cargo.toml b/Cargo.toml index 5466c19..85fdb66 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -10,7 +10,7 @@ documentation = "https://docs.rs/matchtigs" homepage = "https://github.com/algbio/matchtigs" repository = "https://github.com/algbio/matchtigs" edition = "2021" -rust-version = "1.75.0" +rust-version = "1.80.1" license-file = "LICENSE.txt" [lib] diff --git a/rust-toolchain.toml b/rust-toolchain.toml new file mode 100644 index 0000000..d0a2aaf --- /dev/null +++ b/rust-toolchain.toml @@ -0,0 +1,2 @@ +[toolchain] +channel = "1.80.1" \ No newline at end of file