Skip to content

Commit 48cb87d

Browse files
committed
Adding a simple crates.io release workflow, including minimum supported version validation.
1 parent 7dddf9c commit 48cb87d

3 files changed

Lines changed: 67 additions & 0 deletions

File tree

.github/workflows/build.yml

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ env:
44
# A fixed version used for testing, so that the builds don't
55
# spontaneously break after a few years.
66
RUST_VERSION: "1.90.0"
7+
MIN_RUST_VERSION: "1.85.0"
78
CARGO_TERM_COLOR: always
89

910
jobs:
@@ -50,6 +51,21 @@ jobs:
5051
- name: check
5152
run: cargo +${RUST_VERSION} test
5253

54+
# Validate minimum supported Rust version declared in `Cargo.toml`.
55+
# Note that warnings are allowed as some may appear due to backwards
56+
# compatiblity issues.
57+
minimum-supported:
58+
name: Minimum version
59+
runs-on: ubuntu-latest
60+
steps:
61+
- uses: actions/checkout@v4
62+
- name: Install rust version
63+
run: rustup install ${MIN_RUST_VERSION}
64+
- name: check
65+
run: cargo +${MIN_RUST_VERSION} check --all-features
66+
- name: check
67+
run: cargo +${MIN_RUST_VERSION} test --all-features
68+
5369
# Run tests on macOS.
5470
test-macos:
5571
needs: check

.github/workflows/release.yml

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
name: Publish to crates.io
2+
3+
on:
4+
push:
5+
tags:
6+
- 'v*.*.*'
7+
- 'v*.*.*-alpha.*'
8+
- 'v*.*.*-beta.*'
9+
10+
env:
11+
MIN_RUST_VERSION: "1.85.0"
12+
13+
jobs:
14+
# Validate minimum supported Rust version declared in `Cargo.toml`.
15+
# Note that warnings are allowed as some may appear due to backwards
16+
# compatiblity issues.
17+
minimum-supported:
18+
name: Minimum version
19+
runs-on: ubuntu-latest
20+
steps:
21+
- uses: actions/checkout@v4
22+
- name: Install rust version
23+
run: rustup install ${MIN_RUST_VERSION}
24+
- name: check
25+
run: cargo +${MIN_RUST_VERSION} check --all-features
26+
- name: check
27+
run: cargo +${MIN_RUST_VERSION} test --all-features
28+
29+
crates_io_publish:
30+
name: Publish (Crates.io)
31+
needs:
32+
- minimum-supported
33+
runs-on: ubuntu-latest
34+
steps:
35+
- uses: actions/checkout@v4
36+
- name: Install rust version
37+
run: rustup install ${MIN_RUST_VERSION}
38+
- run: cargo publish --token "${{ env.CRATES_IO_API_TOKEN }}"
39+
env:
40+
CRATES_IO_API_TOKEN: ${{ secrets.CRATES_IO_API_TOKEN }}
41+
- name: Create draft release
42+
uses: softprops/action-gh-release@v2
43+
with:
44+
tag_name: ${{ steps.version.outputs.tag }}
45+
draft: true
46+
body: "This is a release draft generated by Github Actions..."
47+
env:
48+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

Cargo.toml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,9 @@ build = "build.rs"
77
description = "Bindings for CU Decision Diagram library (CUDD)"
88
repository = "https://github.com/pclewis/cudd-sys"
99
license = "CC0-1.0"
10+
# This is the minimum version that support Rust 2024. If you ever
11+
# increase this version, please also update in both Github Actions workflows.
12+
rust-version = "1.85"
1013

1114
[dependencies]
1215
libc = "0.2"

0 commit comments

Comments
 (0)