diff --git a/.github/dependabot.yml b/.github/dependabot.yml new file mode 100644 index 000000000..822574943 --- /dev/null +++ b/.github/dependabot.yml @@ -0,0 +1,15 @@ +# To get started with Dependabot version updates, you'll need to specify which +# package ecosystems to update and where the package manifests are located. +# Please see the documentation for all configuration options: +# https://docs.github.com/github/administering-a-repository/configuration-options-for-dependency-updates + +version: 2 +updates: + - package-ecosystem: "cargo" + directory: "/" + schedule: + interval: "weekly" + - package-ecosystem: "github-actions" + directory: "/" + schedule: + interval: "weekly" diff --git a/.github/workflows/format.yml b/.github/workflows/format.yml new file mode 100644 index 000000000..d6aafa6cf --- /dev/null +++ b/.github/workflows/format.yml @@ -0,0 +1,24 @@ +name: Check Format + +on: + pull_request: + branches-ignore: ["dependabot/**"] + +env: + # Lets us format with unstable rustfmt options + RUST_CHANNEL: nightly + +jobs: + check_format: + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v4 + + # Check formatting of Rust files + - name: Install Rust toolchain + run: | + rustup toolchain install --profile minimal --component rustfmt --no-self-update ${{ env.RUST_CHANNEL }} + rustup default ${{ env.RUST_CHANNEL }} + - name: Run cargo format + run: cargo +nightly fmt --all --check diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml index 1eb59afa0..85ca91d82 100644 --- a/.github/workflows/rust.yml +++ b/.github/workflows/rust.yml @@ -1,62 +1,74 @@ -name: Rust +name: Run Tests on: push: - branches: ["develop"] + branches: + - "develop" pull_request: - branches: ["develop"] + workflow_dispatch: env: - CARGO_TERM_COLOR: always - RUST_CHANNEL: stable - # Lets us format with unstable rustfmt options - RUST_FMT_CHANNEL: nightly + RUST_CHANNEL: "stable" + RUST_COV_CHANNEL: "nightly" jobs: + test-covereage: + runs-on: "ubuntu-latest" + steps: + - uses: actions/checkout@v4 + with: + submodules: true + - name: Install Rust toolchain + uses: moonrepo/setup-rust@v0 + with: + cache: false + channel: ${{ env.RUST_COV_CHANNEL }} + - name: Install grcov + uses: SierraSoftworks/setup-grcov@v1 + with: + github-token: ${{ secrets.GITHUB_TOKEN }} + - name: Run cargo test + run: cargo test --locked + env: + CARGO_INCREMENTAL: "0" + RUSTFLAGS: "-Zprofile -Ccodegen-units=1 -Copt-level=0 -Clink-dead-code -Coverflow-checks=off -Zpanic_abort_tests -Cpanic=abort" + RUSTDOCFLAGS: "-Cpanic=abort" + - name: Collect covereage data + run: grcov . --binary-path target/debug/deps/ -s . -t lcov --ignore-not-existing --ignore '../**' --ignore '/*' -o ./lcov.info + - uses: codecov/codecov-action@v4 + with: + token: ${{ secrets.CODECOV_TOKEN }} + file: ./lcov.info test: runs-on: ${{ matrix.os }} strategy: matrix: - os: [ubuntu-latest, windows-latest] + os: [windows-latest, macos-latest] steps: - uses: actions/checkout@v4 with: submodules: true - name: Install Rust toolchain - run: | - rustup toolchain install --profile minimal --no-self-update ${{ env.RUST_CHANNEL }} - rustup default ${{ env.RUST_CHANNEL }} - - name: Run sccache-cache - uses: mozilla-actions/sccache-action@v0.0.5 - - name: Run cargo test - run: cargo test --features splr,cadical,kissat,intel-sat,ipasir-up - if: matrix.os == 'ubuntu-latest' + uses: moonrepo/setup-rust@v0 + with: + cache: false + channel: ${{ env.RUST_COV_CHANNEL }} - name: Run cargo test - run: cargo test -p pindakaas --features splr,cadical,ipasir-up + run: cargo test -p pindakaas --features splr,cadical,ipasir-up,trace if: matrix.os == 'windows-latest' + - name: Run cargo test + run: cargo test --all-features + if: matrix.os != 'windows-latest' clippy: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 + - name: Install Rust toolchain and clippy + uses: moonrepo/setup-rust@v0 with: - submodules: true - - name: Install Rust toolchain - run: | - rustup toolchain install --profile minimal --component clippy --no-self-update ${{ env.RUST_CHANNEL }} - rustup default ${{ env.RUST_CHANNEL }} - - name: Run sccache-cache - uses: mozilla-actions/sccache-action@v0.0.5 + channel: ${{ env.RUST_CHANNEL }} + components: clippy - name: Run clippy - run: cargo clippy --tests --features splr,cadical,kissat,intel-sat,ipasir-up -- -D warnings - format: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v4 - with: - submodules: true - - name: Install Rust toolchain - run: | - rustup toolchain install --profile minimal --component rustfmt --no-self-update ${{ env.RUST_FMT_CHANNEL }} - rustup default ${{ env.RUST_CHANNEL }} - - name: Run cargo format - run: cargo +nightly fmt --all --check + run: cargo clippy --tests -- -D warnings + - name: Run clippy with all features + run: cargo clippy --tests --all-features -- -D warnings