diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 321cc28..2ae15c8 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -4,6 +4,7 @@ env: # A fixed version used for testing, so that the builds don't # spontaneously break after a few years. RUST_VERSION: "1.90.0" + MIN_RUST_VERSION: "1.85.0" CARGO_TERM_COLOR: always jobs: @@ -50,6 +51,21 @@ jobs: - name: check run: cargo +${RUST_VERSION} test + # Validate minimum supported Rust version declared in `Cargo.toml`. + # Note that warnings are allowed as some may appear due to backwards + # compatiblity issues. + minimum-supported: + name: Minimum version + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - name: Install rust version + run: rustup install ${MIN_RUST_VERSION} + - name: check + run: cargo +${MIN_RUST_VERSION} check --all-features + - name: check + run: cargo +${MIN_RUST_VERSION} test --all-features + # Run tests on macOS. test-macos: needs: check diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..ef47bf8 --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,51 @@ +name: Publish to crates.io + +on: + push: + tags: + - 'v*.*.*' + - 'v*.*.*-alpha.*' + - 'v*.*.*-beta.*' + - 'v*.*.*-rc.*' + +env: + MIN_RUST_VERSION: "1.85.0" + +jobs: + # Validate minimum supported Rust version declared in `Cargo.toml`. + # Note that warnings are allowed as some may appear due to backwards + # compatiblity issues. + minimum-supported: + name: Minimum version + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - name: Install rust version + run: rustup install ${MIN_RUST_VERSION} + - name: check + run: cargo +${MIN_RUST_VERSION} check --all-features + - name: check + run: cargo +${MIN_RUST_VERSION} test --all-features + + crates_io_publish: + name: Publish (Crates.io) + needs: + - minimum-supported + permissions: + contents: write # required to create a release + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - name: Install rust version + run: rustup install ${MIN_RUST_VERSION} + - run: cargo publish --token "${{ env.CRATES_IO_API_TOKEN }}" + env: + CRATES_IO_API_TOKEN: ${{ secrets.CRATES_IO_API_TOKEN }} + - name: Create draft release + uses: softprops/action-gh-release@v2 + with: + tag_name: ${{ steps.version.outputs.tag }} + draft: true + body: "This is a release draft generated by Github Actions..." + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/Cargo.toml b/Cargo.toml index ded97db..fbbc1e8 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -7,6 +7,9 @@ build = "build.rs" description = "Bindings for CU Decision Diagram library (CUDD)" repository = "https://github.com/pclewis/cudd-sys" license = "CC0-1.0" +# This is the minimum version that support Rust 2024. If you ever +# increase this version, please also update in both Github Actions workflows. +rust-version = "1.85" [dependencies] libc = "0.2"