Repository navigation
249 lines (216 loc) · 7.75 KB
/
Copy pathdevelop-ci.yml
File metadata and controls
249 lines (216 loc) · 7.75 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
246
247
248
249
name: Develop CI
on:
push:
branches:
- develop
pull_request:
branches:
- develop
workflow_dispatch:
permissions:
contents: read
env:
CARGO_TERM_COLOR: always
RUSTFLAGS: "-D warnings"
jobs:
quality:
name: Quality gate
if: >-
github.event_name != 'push' ||
!contains(join(github.event.commits.*.message, ' '), '[skip-ci]')
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Install Linux dependencies
run: |
sudo apt-get update
sudo apt-get install -y \
build-essential \
pkg-config \
libasound2-dev
- name: Install configured Rust toolchain
run: |
rustup show
rustup component add rustfmt clippy
- name: Cache Cargo
uses: actions/cache@v4
with:
path: |
~/.cargo/registry
~/.cargo/git
target
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
restore-keys: |
${{ runner.os }}-cargo-
- name: Check formatting
run: cargo fmt --all -- --check
- name: Cargo check
run: cargo check --workspace --all-targets --all-features --locked
- name: Cargo clippy
run: cargo clippy --workspace --all-targets --all-features --locked -- -D warnings
- name: Run all tests
run: cargo test --workspace --all-targets --all-features --locked
- name: Validate bundled indicator sources
run: cargo run --locked -p flowsurface-indicator-engine --bin flowsurface-indicator -- test data/indicators/sources --namespace core
- name: Validate catalog indicator sources
run: cargo run --locked -p flowsurface-indicator-engine --bin flowsurface-indicator -- test indicators/sources --namespace catalog
prepare-release:
name: Prepare develop prerelease
needs:
- quality
if: github.event_name == 'push' || github.event_name == 'workflow_dispatch'
runs-on: ubuntu-latest
permissions:
contents: write
outputs:
tag: ${{ steps.release.outputs.tag }}
steps:
- name: Checkout repository history
uses: actions/checkout@v4
with:
fetch-depth: 0
fetch-tags: true
- name: Create draft prerelease
id: release
env:
GH_TOKEN: ${{ github.token }}
GH_REPO: ${{ github.repository }}
run: |
short_sha="${GITHUB_SHA::7}"
tag="develop-${short_sha}"
notes_file="${RUNNER_TEMP}/develop-release-notes.md"
echo "tag=${tag}" >> "$GITHUB_OUTPUT"
previous_tag=""
previous_distance=""
while IFS= read -r candidate; do
if [ "$candidate" = "$tag" ]; then
continue
fi
if git rev-parse --verify --quiet "refs/tags/${candidate}^{commit}" >/dev/null && \
git merge-base --is-ancestor "$candidate" "$GITHUB_SHA"; then
distance="$(git rev-list --count "${candidate}..${GITHUB_SHA}")"
if [ -z "$previous_distance" ] || [ "$distance" -lt "$previous_distance" ]; then
previous_tag="$candidate"
previous_distance="$distance"
fi
fi
done < <(
gh release list \
--limit 100 \
--json tagName,isDraft,isPrerelease \
--jq '.[] | select(.isDraft == false and .isPrerelease == true and (.tagName | startswith("develop-"))) | .tagName'
)
{
echo "# Flowdepth Beta"
echo
echo "Automated beta build from the \`develop\` branch at commit [\`${short_sha}\`](https://github.com/${GH_REPO}/commit/${GITHUB_SHA})."
echo
echo "Platforms: Windows x64, Linux x64, and universal macOS. The application binary remains named \`flowsurface\` for upstream compatibility."
echo
echo "> This is experimental beta software. Back up important layouts before updating; regressions may occur."
echo
if [ -n "$previous_tag" ]; then
echo "## Changes since [\`${previous_tag}\`](https://github.com/${GH_REPO}/releases/tag/${previous_tag})"
echo
git log "${previous_tag}..${GITHUB_SHA}" \
--pretty=format:'- [`%h`](https://github.com/'"${GH_REPO}"'/commit/%H) %s'
echo
echo
echo "[View full diff](https://github.com/${GH_REPO}/compare/${previous_tag}...${GITHUB_SHA})"
else
echo "## Changes"
echo
echo "No previous published develop build was found."
echo
git log -1 "$GITHUB_SHA" \
--pretty=format:'- [`%h`](https://github.com/'"${GH_REPO}"'/commit/%H) %s'
echo
fi
} > "$notes_file"
if gh release view "$tag" >/dev/null 2>&1; then
gh release edit "$tag" \
--title "Flowdepth Beta develop-${short_sha}" \
--notes-file "$notes_file"
else
gh release create "$tag" \
--target "$GITHUB_SHA" \
--title "Flowdepth Beta develop-${short_sha}" \
--notes-file "$notes_file" \
--draft \
--prerelease
fi
build:
name: Build ${{ matrix.target.name }}
needs:
- prepare-release
runs-on: ${{ matrix.target.os }}
permissions:
contents: write
strategy:
fail-fast: false
matrix:
target:
- name: Windows x64
os: windows-latest
command: bash scripts/build-windows.sh x86_64
package: target/release/flowsurface-x86_64-windows.zip
- name: Linux x64
os: ubuntu-latest
command: bash scripts/package-linux.sh package x86_64
package: target/release/flowsurface-x86_64-linux.tar.gz
- name: macOS universal
os: macos-15-intel
command: bash scripts/build-macos.sh universal
package: target/release/flowsurface-universal-macos.tar.gz
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Install Linux dependencies
if: runner.os == 'Linux'
run: |
sudo apt-get update
sudo apt-get install -y \
build-essential \
pkg-config \
libudev-dev \
libxkbcommon-dev \
libasound2-dev
- name: Install configured Rust toolchain
run: rustup show
- name: Cache Cargo
uses: actions/cache@v4
with:
path: |
~/.cargo/registry
~/.cargo/git
target
key: ${{ runner.os }}-cargo-release-${{ hashFiles('**/Cargo.lock') }}
restore-keys: |
${{ runner.os }}-cargo-release-
${{ runner.os }}-cargo-
- name: Build package
run: ${{ matrix.target.command }}
- name: Upload package to GitHub Release
shell: bash
env:
GH_TOKEN: ${{ github.token }}
GH_REPO: ${{ github.repository }}
RELEASE_TAG: ${{ needs.prepare-release.outputs.tag }}
PACKAGE_PATH: ${{ matrix.target.package }}
run: gh release upload "$RELEASE_TAG" "$PACKAGE_PATH" --clobber
publish-release:
name: Publish develop prerelease
needs:
- prepare-release
- build
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- name: Publish prerelease
env:
GH_TOKEN: ${{ github.token }}
GH_REPO: ${{ github.repository }}
RELEASE_TAG: ${{ needs.prepare-release.outputs.tag }}
run: gh release edit "$RELEASE_TAG" --draft=false --prerelease