-
Notifications
You must be signed in to change notification settings - Fork 27
236 lines (205 loc) · 7.35 KB
/
cli-release.yml
File metadata and controls
236 lines (205 loc) · 7.35 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
name: CLI Release
on:
push:
tags: ['v*']
env:
LANG: C.UTF-8
jobs:
build-frontend:
name: Build Frontend Assets
runs-on: blacksmith-4vcpu-ubuntu-2404
steps:
- uses: actions/checkout@v6
- name: Setup Node.js
uses: actions/setup-node@v6
with:
node-version: '22'
- name: Build frontend assets
run: |
mkdir -p static/public/assets/css
mkdir -p static/public/assets/web-components/dist/js
mkdir -p static/public/assets/web-components/dist/css
npm ci
npx tailwindcss -i ./static/public/assets/css/tailwind.css -o ./static/public/assets/css/tailwind.min.css --minify
cd web-components
npm ci
NODE_ENV=production npx vite build --mode production --sourcemap false
- name: Upload frontend artifact
uses: actions/upload-artifact@v7
with:
name: frontend-assets
path: |
static/public/assets/css/tailwind.min.css
static/public/assets/web-components/dist
retention-days: 1
build-linux-x64:
name: Build Linux x86_64
needs: build-frontend
runs-on: blacksmith-4vcpu-ubuntu-2404
container:
image: ghcr.io/monoscope-tech/monoscope-deps:latest
credentials:
username: ${{ github.repository_owner }}
password: ${{ secrets.GH_TOKEN }}
env:
CABAL_DIR: /root/.cabal
steps:
- uses: actions/checkout@v6
- name: Download frontend artifacts
uses: actions/download-artifact@v8
with:
name: frontend-assets
path: static/public/assets
- name: Cache dist-newstyle
uses: actions/cache@v5
with:
path: dist-newstyle
key: cli-linux-x64-${{ hashFiles('**/*.cabal', '**/cabal.project*') }}-${{ github.sha }}
restore-keys: |
cli-linux-x64-${{ hashFiles('**/*.cabal', '**/cabal.project*') }}-
cli-linux-x64-
- name: Build CLI binary
run: cabal build exe:monoscope -j --ghc-options="-O2 +RTS -A64m -n2m -RTS"
- name: Package binary
run: |
BIN=$(cabal list-bin exe:monoscope | tail -n1)
strip "$BIN"
cp "$BIN" monoscope
tar czf monoscope-linux-x86_64.tar.gz monoscope
- name: Upload artifact
uses: actions/upload-artifact@v7
with:
name: monoscope-linux-x86_64
path: monoscope-linux-x86_64.tar.gz
retention-days: 5
build-linux-arm64:
name: Build Linux ARM64
needs: build-frontend
continue-on-error: true
runs-on: blacksmith-4vcpu-ubuntu-2404-arm
container:
image: ghcr.io/monoscope-tech/monoscope-deps:latest
credentials:
username: ${{ github.repository_owner }}
password: ${{ secrets.GH_TOKEN }}
env:
CABAL_DIR: /root/.cabal
steps:
- uses: actions/checkout@v6
- name: Download frontend artifacts
uses: actions/download-artifact@v8
with:
name: frontend-assets
path: static/public/assets
- name: Cache dist-newstyle
uses: actions/cache@v5
with:
path: dist-newstyle
key: cli-linux-arm64-dist-${{ hashFiles('**/*.cabal', '**/cabal.project*') }}-${{ github.sha }}
restore-keys: |
cli-linux-arm64-dist-${{ hashFiles('**/*.cabal', '**/cabal.project*') }}-
cli-linux-arm64-dist-
- name: Build CLI binary
run: cabal build exe:monoscope -j --ghc-options="-O2 +RTS -A64m -n2m -RTS"
- name: Package binary
run: |
BIN=$(cabal list-bin exe:monoscope | tail -n1)
strip "$BIN"
cp "$BIN" monoscope
tar czf monoscope-linux-arm64.tar.gz monoscope
- name: Upload artifact
uses: actions/upload-artifact@v7
with:
name: monoscope-linux-arm64
path: monoscope-linux-arm64.tar.gz
retention-days: 5
build-macos-arm64:
name: Build macOS ARM64
needs: build-frontend
runs-on: blacksmith-6vcpu-macos-15
steps:
- uses: actions/checkout@v6
- name: Download frontend artifacts
uses: actions/download-artifact@v8
with:
name: frontend-assets
path: static/public/assets
- name: Install GHC and Cabal
uses: haskell-actions/setup@v2
with:
ghc-version: '9.12.2'
cabal-version: '3.14'
- name: Cache Cabal
uses: actions/cache@v5
with:
path: ~/.cabal
key: cli-macos-arm64-cabal-${{ hashFiles('**/*.cabal', '**/cabal.project*') }}
restore-keys: cli-macos-arm64-cabal-
- name: Cache dist-newstyle
uses: actions/cache@v5
with:
path: dist-newstyle
key: cli-macos-arm64-dist-${{ hashFiles('**/*.cabal', '**/cabal.project*') }}
restore-keys: cli-macos-arm64-dist-
- name: Install system deps
run: |
brew install pkg-config libpq librdkafka snappy lz4 zstd grpc openssl protobuf
PREFIX=$(brew --prefix)
KEGONLY="snappy libpq librdkafka lz4 zstd openssl"
# Symlink keg-only libs/headers into /usr/local so configure scripts and GHC linker find them
sudo mkdir -p /usr/local/lib /usr/local/include
for f in $KEGONLY; do
pf="$PREFIX/opt/$f"
[ -d "$pf/lib" ] && find "$pf/lib" -maxdepth 1 \( -name "*.dylib" -o -name "*.a" \) -exec sudo ln -sf {} /usr/local/lib/ \;
[ -d "$pf/include" ] && sudo cp -rn "$pf/include/." /usr/local/include/ 2>/dev/null || true
done
# pkg-config paths as belt-and-suspenders
PKG_PATH=$(for f in $KEGONLY grpc; do echo -n "$PREFIX/opt/$f/lib/pkgconfig:"; done)
echo "PKG_CONFIG_PATH=${PKG_PATH%:}" >> $GITHUB_ENV
echo "$PREFIX/opt/libpq/bin" >> $GITHUB_PATH
- name: Build CLI binary
run: cabal build exe:monoscope -j --ghc-options="-O2 +RTS -A64m -n2m -RTS"
- name: Package binary
run: |
BIN=$(cabal list-bin exe:monoscope | tail -n1)
strip "$BIN"
cp "$BIN" monoscope
tar czf monoscope-darwin-arm64.tar.gz monoscope
- name: Upload artifact
uses: actions/upload-artifact@v7
with:
name: monoscope-darwin-arm64
path: monoscope-darwin-arm64.tar.gz
retention-days: 5
release:
name: Create GitHub Release
needs: [build-linux-x64, build-linux-arm64, build-macos-arm64]
runs-on: blacksmith-4vcpu-ubuntu-2404
permissions:
contents: write
steps:
- uses: actions/checkout@v6
- name: Download all artifacts
uses: actions/download-artifact@v8
with:
path: artifacts
merge-multiple: true
- name: Generate checksums
run: |
cd artifacts
sha256sum *.tar.gz > checksums.txt
cat checksums.txt
- name: Create release
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
cd artifacts
ASSETS=$(ls *.tar.gz checksums.txt 2>/dev/null | tr '\n' ' ')
if gh release view "$GITHUB_REF_NAME" &>/dev/null; then
gh release upload "$GITHUB_REF_NAME" $ASSETS --clobber
else
gh release create "$GITHUB_REF_NAME" \
--title "Monoscope ${GITHUB_REF_NAME}" \
--generate-notes \
$ASSETS
fi