Checks on pull request #2555
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: ci | |
run-name: Checks on pull request | |
on: | |
push: | |
branches: [master] | |
pull_request: null | |
env: | |
RUST_VERSION: 1.84.1 | |
NIGHTLY_RUST_VERSION: nightly-2025-02-04 | |
SCIP_VERSION: 8.0.3 | |
CARGO_NET_GIT_FETCH_WITH_CLI: "true" | |
permissions: read-all | |
jobs: | |
trunk-check: | |
name: Trunk Check | |
runs-on: ubuntu-latest | |
permissions: | |
contents: read | |
checks: write | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Trunk Check | |
uses: trunk-io/trunk-action@v1 | |
clippy_check: | |
name: Clippy Check | |
runs-on: ubuntu-latest | |
steps: | |
- name: Provide Access to Private Repos | |
uses: webfactory/ssh-agent@v0.9.0 | |
with: | |
ssh-private-key: | | |
${{ secrets.SSH_PRIVATE_KEY }} | |
${{ secrets.SSH_PRIVATE_KEY_BASE }} | |
- name: Install Rust toolchain | |
uses: dtolnay/rust-toolchain@master | |
with: | |
toolchain: ${{ env.RUST_VERSION }} | |
components: clippy | |
- uses: Swatinem/rust-cache@v2 | |
- uses: actions/checkout@v4 | |
- name: Run Clippy | |
run: cargo clippy --all-targets --all-features -- -D warnings | |
build: | |
name: Cargo Build and Test Workspace | |
runs-on: ubuntu-latest | |
steps: | |
- name: Provide Access to Private Repos | |
uses: webfactory/ssh-agent@v0.9.0 | |
with: | |
ssh-private-key: | | |
${{ secrets.SSH_PRIVATE_KEY }} | |
${{ secrets.SSH_PRIVATE_KEY_BASE }} | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Install Rust toolchain | |
uses: dtolnay/rust-toolchain@master | |
with: | |
toolchain: ${{ env.RUST_VERSION }} | |
- uses: Swatinem/rust-cache@v2 | |
- name: Build Workspace | |
run: cargo build --release | |
- name: Install cargo-nextest | |
uses: baptiste0928/cargo-install@v3 | |
with: | |
crate: cargo-nextest | |
locked: true | |
- name: Run Workspace Tests | |
run: cargo nextest run --release --locked | |
- name: Run Experimental Workspace Tests | |
run: cargo nextest run --release --locked --features experimental-types -- experimental | |
build_with_solver: | |
name: Cargo Build and Test Workspace With Solver | |
runs-on: ubuntu-latest | |
steps: | |
- name: Provide Access to Private Repos | |
uses: webfactory/ssh-agent@v0.9.0 | |
with: | |
ssh-private-key: | | |
${{ secrets.SSH_PRIVATE_KEY }} | |
${{ secrets.SSH_PRIVATE_KEY_BASE }} | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- uses: conda-incubator/setup-miniconda@v3 | |
with: | |
activate-environment: test | |
allow-softlinks: true | |
- name: Install dependencies (SCIPOptSuite) | |
run: | | |
conda install -y --prefix $CONDA/envs/test --channel conda-forge scip | |
echo "LD_LIBRARY_PATH=$CONDA/envs/test/lib" >> "${GITHUB_ENV}" | |
echo "CONDA_PREFIX=$CONDA/envs/test" >> "${GITHUB_ENV}" | |
- name: Install Rust toolchain | |
uses: dtolnay/rust-toolchain@master | |
with: | |
toolchain: ${{ env.RUST_VERSION }} | |
- uses: Swatinem/rust-cache@v2 | |
- name: Build Workspace With Solver | |
run: cargo build --release --features solver-scip | |
- name: Install cargo-nextest | |
uses: baptiste0928/cargo-install@v3 | |
with: | |
crate: cargo-nextest | |
locked: true | |
- name: Run Workspace Tests With Solver | |
run: cargo nextest run --release --locked --features solver-scip | |
cargo-unused-deps-check: | |
name: Cargo Unused Dependencies Check | |
runs-on: ubuntu-latest | |
steps: | |
- name: Provide Access to Private Repos | |
uses: webfactory/ssh-agent@v0.9.0 | |
with: | |
ssh-private-key: | | |
${{ secrets.SSH_PRIVATE_KEY }} | |
${{ secrets.SSH_PRIVATE_KEY_BASE }} | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Install toolchain | |
uses: dtolnay/rust-toolchain@master | |
with: | |
toolchain: ${{ env.NIGHTLY_RUST_VERSION }} # `cargo-udeps` requires nightly to run | |
- uses: Swatinem/rust-cache@v2 | |
- name: Install cargo-udeps | |
uses: baptiste0928/cargo-install@v3 | |
with: | |
crate: cargo-udeps | |
locked: true | |
- name: Check Unused Deps | |
run: cargo udeps --locked --all-targets | |
cargo-toml-lint-check: | |
name: Cargo.toml Link Check | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Install Rust toolchain | |
uses: dtolnay/rust-toolchain@master | |
with: | |
toolchain: ${{ env.RUST_VERSION }} | |
- uses: Swatinem/rust-cache@v2 | |
- name: Install Cargo.toml linter | |
run: cargo install --locked cargo-toml-lint | |
- name: Run Cargo.toml linter | |
run: git ls-files | grep Cargo.toml$ | xargs --verbose -n 1 cargo-toml-lint | |
publish: | |
runs-on: ubuntu-latest | |
needs: | |
[ | |
trunk-check, | |
clippy_check, | |
build, | |
build_with_solver, | |
cargo-unused-deps-check, | |
cargo-toml-lint-check, | |
] | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Install Rust toolchain | |
uses: dtolnay/rust-toolchain@master | |
with: | |
toolchain: ${{ env.RUST_VERSION }} | |
- uses: Swatinem/rust-cache@v2 | |
- uses: katyo/publish-crates@v2 | |
id: publish-crates | |
with: | |
registry-token: ${{ secrets.CARGO_REGISTRY_TOKEN }} | |
dry-run: ${{ github.event_name != 'push' }} | |
ignore-unpublished-changes: true | |
- name: List published crates | |
if: ${{ steps.publish-crates.outputs.published != '' }} | |
run: | | |
LIST="${{ join(fromJSON(steps.publish-crates.outputs.published).*.name, ', ') }}" | |
echo "Published crates: $LIST" |