-
Notifications
You must be signed in to change notification settings - Fork 0
217 lines (188 loc) · 7.21 KB
/
release.yml
File metadata and controls
217 lines (188 loc) · 7.21 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
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
name: Release
on:
push:
tags:
- 'v*.*.*'
workflow_dispatch:
inputs:
tag:
description: 'Tag to release'
required: true
type: string
permissions:
contents: write
env:
CARGO_TERM_COLOR: always
RUST_BACKTRACE: 1
jobs:
build-release:
name: Build ${{ matrix.target }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
include:
# Linux x86_64
- target: x86_64-unknown-linux-gnu
os: ubuntu-latest
archive: tar.gz
# Linux ARM64
- target: aarch64-unknown-linux-gnu
os: ubuntu-latest
archive: tar.gz
cross: true
# macOS Intel
- target: x86_64-apple-darwin
os: macos-latest
archive: tar.gz
# macOS Apple Silicon
- target: aarch64-apple-darwin
os: macos-latest
archive: tar.gz
# Windows x86_64
- target: x86_64-pc-windows-msvc
os: windows-latest
archive: zip
steps:
- uses: actions/checkout@v6
- name: Get version
id: version
run: |
if [ "${{ github.event_name }}" = "workflow_dispatch" ]; then
echo "version=${{ inputs.tag }}" >> $GITHUB_OUTPUT
else
echo "version=${GITHUB_REF#refs/tags/}" >> $GITHUB_OUTPUT
fi
shell: bash
- name: Install Rust
uses: dtolnay/rust-toolchain@631a55b12751854ce901bb631d5902ceb48146f7 # stable
with:
targets: ${{ matrix.target }}
- name: Install cross (for cross-compilation)
if: matrix.cross
run: cargo install cross --git https://github.com/cross-rs/cross
- name: Cache cargo
uses: actions/cache@v5
with:
path: |
~/.cargo/registry
~/.cargo/git
target
key: ${{ runner.os }}-${{ matrix.target }}-cargo-${{ hashFiles('**/Cargo.lock') }}
- name: Build release binary
run: |
if [ "${{ matrix.cross }}" = "true" ]; then
cross build --release --target ${{ matrix.target }} -p cpac-cli
else
cargo build --release --target ${{ matrix.target }} -p cpac-cli
fi
shell: bash
- name: Package binary (Unix)
if: matrix.archive == 'tar.gz'
run: |
cd target/${{ matrix.target }}/release
tar czf ../../../cpac-${{ steps.version.outputs.version }}-${{ matrix.target }}.tar.gz cpac
cd ../../..
- name: Package binary (Windows)
if: matrix.archive == 'zip'
run: |
cd target/${{ matrix.target }}/release
7z a ../../../cpac-${{ steps.version.outputs.version }}-${{ matrix.target }}.zip cpac.exe
cd ../../..
shell: bash
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: cpac-${{ matrix.target }}
path: cpac-${{ steps.version.outputs.version }}-${{ matrix.target }}.${{ matrix.archive }}
release:
name: Create Release
needs: build-release
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- name: Get version
id: version
run: |
if [ "${{ github.event_name }}" = "workflow_dispatch" ]; then
echo "version=${{ inputs.tag }}" >> $GITHUB_OUTPUT
else
echo "version=${GITHUB_REF#refs/tags/}" >> $GITHUB_OUTPUT
fi
- name: Download all artifacts
uses: actions/download-artifact@v4
with:
path: ./artifacts
merge-multiple: true
- name: Generate checksums
run: |
cd artifacts
sha256sum cpac-* > checksums.txt
cat checksums.txt
- name: Create GitHub Release
uses: softprops/action-gh-release@a06a81a03ee405af7f2048a818ed3f03bbf83c7b # v2
with:
tag_name: ${{ steps.version.outputs.version }}
name: CPAC ${{ steps.version.outputs.version }}
body: |
## CPAC ${{ steps.version.outputs.version }}
### 📦 Downloads
Choose the appropriate binary for your platform:
- **Linux (x86_64)**: `cpac-${{ steps.version.outputs.version }}-x86_64-unknown-linux-gnu.tar.gz`
- **Linux (ARM64)**: `cpac-${{ steps.version.outputs.version }}-aarch64-unknown-linux-gnu.tar.gz`
- **macOS (Intel)**: `cpac-${{ steps.version.outputs.version }}-x86_64-apple-darwin.tar.gz`
- **macOS (Apple Silicon)**: `cpac-${{ steps.version.outputs.version }}-aarch64-apple-darwin.tar.gz`
- **Windows (x86_64)**: `cpac-${{ steps.version.outputs.version }}-x86_64-pc-windows-msvc.zip`
### 📄 Documentation
- [Benchmarking Guide](https://github.com/cpsc-computing/cpac/blob/main/BENCHMARKING.md)
- [README](https://github.com/cpsc-computing/cpac/blob/main/README.md)
### ✅ Verification
All binaries are built with:
- Release profile: LTO, single codegen unit, stripped symbols
- Tested on: Ubuntu, macOS, Windows
- Full CI suite passing (fmt, clippy, tests, doc tests)
files: artifacts/*
draft: false
prerelease: false
publish-crates:
name: Publish to crates.io
needs: release
runs-on: ubuntu-latest
if: startsWith(github.ref, 'refs/tags/v')
steps:
- uses: actions/checkout@v6
- uses: dtolnay/rust-toolchain@631a55b12751854ce901bb631d5902ceb48146f7 # stable
- name: Publish crates
env:
CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }}
run: |
# Publish in dependency order
cargo publish -p cpac-types --token $CARGO_REGISTRY_TOKEN || true
sleep 30
cargo publish -p cpac-ssr --token $CARGO_REGISTRY_TOKEN || true
sleep 30
cargo publish -p cpac-transforms --token $CARGO_REGISTRY_TOKEN || true
sleep 30
cargo publish -p cpac-entropy --token $CARGO_REGISTRY_TOKEN || true
sleep 30
cargo publish -p cpac-frame --token $CARGO_REGISTRY_TOKEN || true
sleep 30
cargo publish -p cpac-dag --token $CARGO_REGISTRY_TOKEN || true
sleep 30
cargo publish -p cpac-crypto --token $CARGO_REGISTRY_TOKEN || true
sleep 30
cargo publish -p cpac-dict --token $CARGO_REGISTRY_TOKEN || true
sleep 30
cargo publish -p cpac-engine --token $CARGO_REGISTRY_TOKEN || true
sleep 30
cargo publish -p cpac-streaming --token $CARGO_REGISTRY_TOKEN || true
sleep 30
cargo publish -p cpac-archive --token $CARGO_REGISTRY_TOKEN || true
sleep 30
cargo publish -p cpac-cas --token $CARGO_REGISTRY_TOKEN || true
sleep 30
cargo publish -p cpac-domains --token $CARGO_REGISTRY_TOKEN || true
sleep 30
cargo publish -p cpac-ffi --token $CARGO_REGISTRY_TOKEN || true
sleep 30
cargo publish -p cpac-cli --token $CARGO_REGISTRY_TOKEN || true