-
Notifications
You must be signed in to change notification settings - Fork 1
245 lines (207 loc) · 8.39 KB
/
Copy pathrelease.yml
File metadata and controls
245 lines (207 loc) · 8.39 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
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
name: Release
on:
push:
tags:
- 'v*'
workflow_dispatch:
inputs:
version:
description: 'Version to release (e.g., v0.1.0)'
required: true
type: string
permissions:
contents: write
env:
# Pinned on purpose: see the note in ci.yml.
RUST_VERSION: "1.97.0"
CARGO_TERM_COLOR: always
jobs:
build:
name: Build ${{ matrix.target }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
include:
- target: x86_64-unknown-linux-gnu
os: ubuntu-latest
name: aingle-minimal-linux-x86_64
cortex_name: aingle-cortex-linux-x86_64
- target: aarch64-unknown-linux-gnu
os: ubuntu-latest
name: aingle-minimal-linux-aarch64
cortex_name: aingle-cortex-linux-aarch64
- target: x86_64-apple-darwin
os: macos-latest
name: aingle-minimal-macos-x86_64
cortex_name: aingle-cortex-macos-x86_64
- target: aarch64-apple-darwin
os: macos-latest
name: aingle-minimal-macos-aarch64
cortex_name: aingle-cortex-macos-aarch64
- target: x86_64-pc-windows-msvc
os: windows-latest
name: aingle-minimal-windows-x86_64.exe
cortex_name: aingle-cortex-windows-x86_64.exe
steps:
- uses: actions/checkout@v6
- name: Install Rust
uses: dtolnay/rust-toolchain@master
with:
toolchain: ${{ env.RUST_VERSION }}
targets: ${{ matrix.target }}
- name: Install system dependencies (Linux)
if: runner.os == 'Linux'
run: |
sudo apt-get update
sudo apt-get install -y libsodium-dev libssl-dev pkg-config
if [ "${{ matrix.target }}" = "aarch64-unknown-linux-gnu" ]; then
sudo apt-get install -y gcc-aarch64-linux-gnu
fi
- name: Install system dependencies (macOS)
if: runner.os == 'macOS'
run: |
brew install libsodium openssl@3
- name: Cache cargo registry
uses: actions/cache@v5
with:
path: |
~/.cargo/registry
~/.cargo/git
target
key: ${{ runner.os }}-${{ matrix.target }}-cargo-release-${{ hashFiles('**/Cargo.lock') }}
restore-keys: |
${{ runner.os }}-${{ matrix.target }}-cargo-release-
- name: Build aingle-minimal
run: cargo build --release --target ${{ matrix.target }} -p aingle_minimal --features rest
env:
CARGO_TARGET_AARCH64_UNKNOWN_LINUX_GNU_LINKER: aarch64-linux-gnu-gcc
- name: Build aingle-cortex
run: cargo build --release --target ${{ matrix.target }} -p aingle_cortex
env:
CARGO_TARGET_AARCH64_UNKNOWN_LINUX_GNU_LINKER: aarch64-linux-gnu-gcc
- name: Create archives (Unix)
if: runner.os != 'Windows'
run: |
mkdir -p dist
cp target/${{ matrix.target }}/release/aingle-minimal dist/${{ matrix.name }}
cp target/${{ matrix.target }}/release/aingle-cortex dist/${{ matrix.cortex_name }}
cd dist
tar -czvf ${{ matrix.name }}.tar.gz ${{ matrix.name }}
tar -czvf ${{ matrix.cortex_name }}.tar.gz ${{ matrix.cortex_name }}
- name: Create archives (Windows)
if: runner.os == 'Windows'
run: |
mkdir dist
copy target\${{ matrix.target }}\release\aingle-minimal.exe dist\${{ matrix.name }}
copy target\${{ matrix.target }}\release\aingle-cortex.exe dist\${{ matrix.cortex_name }}
cd dist
7z a -tzip ${{ matrix.name }}.zip ${{ matrix.name }}
7z a -tzip ${{ matrix.cortex_name }}.zip ${{ matrix.cortex_name }}
- name: Upload aingle-minimal artifact
uses: actions/upload-artifact@v7
with:
name: ${{ matrix.name }}
path: dist/${{ matrix.name }}.*
- name: Upload aingle-cortex artifact
uses: actions/upload-artifact@v7
with:
name: ${{ matrix.cortex_name }}
path: dist/${{ matrix.cortex_name }}.*
release:
name: Create Release
needs: build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- name: Download all artifacts
uses: actions/download-artifact@v8
with:
path: artifacts
- name: Display structure of downloaded files
run: ls -laR artifacts/
- name: Generate changelog
id: changelog
run: |
echo "## Changes" > CHANGELOG.md
git log --pretty=format:"- %s (%h)" $(git describe --tags --abbrev=0 HEAD^)..HEAD >> CHANGELOG.md 2>/dev/null || echo "- Initial release" >> CHANGELOG.md
- name: Create Release
uses: softprops/action-gh-release@v3
with:
files: artifacts/**/*
body_path: CHANGELOG.md
draft: false
prerelease: ${{ contains(github.ref, '-alpha') || contains(github.ref, '-beta') || contains(github.ref, '-rc') }}
generate_release_notes: true
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# Publish to crates.io (optional, requires CARGO_REGISTRY_TOKEN secret)
publish:
name: Publish to crates.io
needs: release
runs-on: ubuntu-latest
if: startsWith(github.ref, 'refs/tags/v') && !contains(github.ref, '-')
steps:
- uses: actions/checkout@v6
- name: Install Rust
uses: dtolnay/rust-toolchain@master
with:
toolchain: ${{ env.RUST_VERSION }}
- name: Install system dependencies
run: |
sudo apt-get update
sudo apt-get install -y libsodium-dev libssl-dev pkg-config
# Phase 1: Crates with no internal dependencies
- name: Publish aingle_graph
run: cargo publish -p aingle_graph --token ${{ secrets.CARGO_REGISTRY_TOKEN }}
continue-on-error: true
- name: Publish aingle_zk
run: cargo publish -p aingle_zk --token ${{ secrets.CARGO_REGISTRY_TOKEN }}
continue-on-error: true
- name: Publish ineru
run: cargo publish -p ineru --token ${{ secrets.CARGO_REGISTRY_TOKEN }}
continue-on-error: true
- name: Publish aingle_ai
run: cargo publish -p aingle_ai --token ${{ secrets.CARGO_REGISTRY_TOKEN }}
continue-on-error: true
- name: Publish ai_hash
run: cargo publish -p ai_hash --token ${{ secrets.CARGO_REGISTRY_TOKEN }}
continue-on-error: true
# aingle_wal has no internal aingle deps → belongs in Phase 1. It is an
# (optional, `cluster`-feature) dependency of aingle_cortex, so crates.io
# requires it published before cortex can be published.
- name: Publish aingle_wal
run: cargo publish -p aingle_wal --token ${{ secrets.CARGO_REGISTRY_TOKEN }}
continue-on-error: true
- name: Wait for crates.io index update
run: sleep 30
# Phase 2: Crates depending on Phase 1
- name: Publish aingle_zome_types
run: cargo publish -p aingle_zome_types --token ${{ secrets.CARGO_REGISTRY_TOKEN }}
continue-on-error: true
- name: Publish aingle_logic
run: cargo publish -p aingle_logic --token ${{ secrets.CARGO_REGISTRY_TOKEN }}
continue-on-error: true
- name: Publish kaneru
run: cargo publish -p kaneru --token ${{ secrets.CARGO_REGISTRY_TOKEN }}
continue-on-error: true
# aingle_ingest (deps: aingle_graph) — a NON-optional dependency of
# aingle_cortex. It was missing from the pipeline, which is why the 0.7.0
# cortex publish failed and crates.io stayed at 0.6.3.
- name: Publish aingle_ingest
run: cargo publish -p aingle_ingest --token ${{ secrets.CARGO_REGISTRY_TOKEN }}
continue-on-error: true
# aingle_raft (deps: aingle_wal, aingle_graph, ineru — all Phase 1) — an
# (optional, `cluster`-feature) dependency of aingle_cortex.
- name: Publish aingle_raft
run: cargo publish -p aingle_raft --token ${{ secrets.CARGO_REGISTRY_TOKEN }}
continue-on-error: true
- name: Wait for crates.io index update
run: sleep 30
# Phase 3: Crates depending on Phase 2
- name: Publish aingle_cortex
run: cargo publish -p aingle_cortex --token ${{ secrets.CARGO_REGISTRY_TOKEN }}
continue-on-error: true
- name: Publish aingle_minimal
run: cargo publish -p aingle_minimal --token ${{ secrets.CARGO_REGISTRY_TOKEN }}
continue-on-error: true