-
Notifications
You must be signed in to change notification settings - Fork 1
151 lines (122 loc) · 4.04 KB
/
publish.yml
File metadata and controls
151 lines (122 loc) · 4.04 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
name: Publish
on:
push:
tags: ['v*']
env:
CARGO_TERM_COLOR: always
RUST_BACKTRACE: 1
jobs:
ci:
name: CI
runs-on: blacksmith-2vcpu-ubuntu-2404
steps:
- uses: actions/checkout@v6
- name: Install Rust
uses: dtolnay/rust-toolchain@stable
with:
components: rustfmt, clippy
- name: Cache cargo
uses: Swatinem/rust-cache@v2
- name: Check formatting
run: cargo fmt --all -- --check
- name: Build (all features)
run: cargo build -p echidna --features "bytecode,taylor,laurent,stde,serde,faer,nalgebra,ndarray,parallel"
- name: Test echidna
run: cargo test -p echidna --features "bytecode,taylor,laurent,stde,serde,faer,nalgebra,ndarray,parallel"
- name: Test echidna-optim
run: cargo test -p echidna-optim
- name: Clippy
run: cargo clippy --features "bytecode,taylor,laurent,stde,serde,faer,nalgebra,ndarray,parallel" -- -D warnings
- name: Build docs
run: cargo doc --no-deps --features "bytecode,taylor,laurent,stde,serde,faer,nalgebra,ndarray,parallel"
env:
RUSTDOCFLAGS: -D warnings
- name: Install cargo-deny
run: cargo install cargo-deny --locked
- name: Check dependency policies
run: cargo deny check
publish-echidna:
name: Publish echidna
needs: [ci]
runs-on: blacksmith-2vcpu-ubuntu-2404
environment: release
permissions:
id-token: write
contents: read
steps:
- uses: actions/checkout@v6
- name: Install Rust
uses: dtolnay/rust-toolchain@stable
- name: Cache cargo
uses: Swatinem/rust-cache@v2
- name: Validate tag matches Cargo.toml version
run: |
TAG="${GITHUB_REF#refs/tags/v}"
VERSION=$(cargo metadata --format-version=1 --no-deps | jq -r '.packages[] | select(.name == "echidna") | .version')
echo "Tag version: $TAG"
echo "Cargo.toml version: $VERSION"
if [ "$TAG" != "$VERSION" ]; then
echo "ERROR: Tag v$TAG does not match Cargo.toml version $VERSION"
exit 1
fi
- name: Dry run
run: cargo publish -p echidna --dry-run
- name: Authenticate with crates.io
id: crates-io-auth
uses: rust-lang/crates-io-auth-action@v1
- name: Publish echidna
run: cargo publish -p echidna
env:
CARGO_REGISTRY_TOKEN: ${{ steps.crates-io-auth.outputs.token }}
publish-optim:
name: Publish echidna-optim
needs: [publish-echidna]
runs-on: blacksmith-2vcpu-ubuntu-2404
environment: release
permissions:
id-token: write
contents: read
steps:
- uses: actions/checkout@v6
- name: Install Rust
uses: dtolnay/rust-toolchain@stable
- name: Cache cargo
uses: Swatinem/rust-cache@v2
- name: Dry run
run: cargo publish -p echidna-optim --dry-run
- name: Authenticate with crates.io
id: crates-io-auth
uses: rust-lang/crates-io-auth-action@v1
- name: Publish echidna-optim
run: cargo publish -p echidna-optim
env:
CARGO_REGISTRY_TOKEN: ${{ steps.crates-io-auth.outputs.token }}
release:
name: Create GitHub Release
needs: [publish-echidna]
runs-on: blacksmith-2vcpu-ubuntu-2404
permissions:
contents: write
steps:
- uses: actions/checkout@v6
- name: Extract changelog for this version
id: changelog
run: |
TAG="${GITHUB_REF#refs/tags/v}"
CHANGELOG=$(awk -v ver="$TAG" '
/^## \[/ {
if (found) exit
if ($0 ~ "\\[" ver "\\]") found=1
next
}
found { print }
' CHANGELOG.md)
if [ -z "$CHANGELOG" ]; then
CHANGELOG="Release v$TAG"
fi
echo "$CHANGELOG" > /tmp/changelog.txt
- name: Create GitHub Release
uses: softprops/action-gh-release@v2
with:
body_path: /tmp/changelog.txt
generate_release_notes: false