-
Notifications
You must be signed in to change notification settings - Fork 3
234 lines (197 loc) · 7.21 KB
/
build.yml
File metadata and controls
234 lines (197 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
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
name: Build
on:
push:
branches: [main]
tags: ['v*']
pull_request:
branches: [main]
workflow_dispatch:
permissions:
actions: read
contents: read
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Checkout Sigma
uses: actions/checkout@v4
with:
repository: adsharma/sigma.js
ref: icebug-arrow-graph
path: .deps/sigma.js
- name: Install Node.js
uses: actions/setup-node@v4
with:
node-version: 24
cache: 'npm'
- name: Install dependencies
run: npm ci
- name: Run linter
run: npm run lint
build:
needs: lint
strategy:
fail-fast: false
matrix:
include:
- platform: macos-latest
target: aarch64-apple-darwin
bundles: dmg
- platform: ubuntu-latest
target: x86_64-unknown-linux-gnu
bundles: "appimage deb"
- platform: ubuntu-24.04-arm
target: aarch64-unknown-linux-gnu
bundles: "appimage deb"
- platform: windows-latest
target: x86_64-pc-windows-msvc
bundles: "msi nsis"
runs-on: ${{ matrix.platform }}
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Checkout ladybug
uses: actions/checkout@v4
with:
repository: LadybugDB/ladybug
fetch-depth: 1
path: ladybug
- name: Checkout Sigma
uses: actions/checkout@v4
with:
repository: adsharma/sigma.js
ref: icebug-arrow-graph
path: .deps/sigma.js
- name: Install Node.js
uses: actions/setup-node@v4
with:
node-version: 24
cache: 'npm'
- name: Install Rust stable
uses: dtolnay/rust-toolchain@stable
- name: Cache Tauri CLI
id: cache-tauri-cli
uses: actions/cache@v4
with:
path: |
~/.cargo/bin/cargo-tauri*
~/.cargo/registry
~/.cargo/git
key: ${{ runner.os }}-${{ matrix.target }}-cargo-tauri-v2-${{ hashFiles('src-tauri/Cargo.lock') }}
- name: Install Tauri CLI (cargo plugin)
shell: bash
run: cargo tauri --version || cargo install tauri-cli --locked
- name: Install dependencies (macOS)
if: matrix.platform == 'macos-latest'
run: |
brew install apache-arrow create-dmg libomp
- name: Install dependencies (Linux)
if: matrix.platform == 'ubuntu-latest' || matrix.platform == 'ubuntu-24.04-arm'
run: |
sudo apt-get update
sudo apt-get install -y libgtk-3-dev libgirepository1.0-dev libwebkit2gtk-4.1-dev libappindicator3-dev patchelf librsvg2-dev libfuse2
- name: Install frontend dependencies
run: npm ci
- name: Build Sigma package
run: |
npm ci --prefix .deps/sigma.js
npm run build --prefix .deps/sigma.js
- name: Enable pnpm
run: corepack enable
- name: Resolve compatible lbug artifact run
working-directory: ladybug
shell: bash
env:
GITHUB_TOKEN: ${{ github.token }}
run: |
SHA="$(git rev-parse HEAD)"
API_URL="https://api.github.com/repos/LadybugDB/ladybug/actions/workflows/build-and-deploy.yml/runs"
AUTH_HEADER="Authorization: Bearer $GITHUB_TOKEN"
ACCEPT_HEADER="Accept: application/vnd.github+json"
VERSION_HEADER="X-GitHub-Api-Version: 2022-11-28"
RUN_ID="$(
curl -fsSL \
-H "$AUTH_HEADER" \
-H "$ACCEPT_HEADER" \
-H "$VERSION_HEADER" \
"$API_URL?head_sha=$SHA&status=success&per_page=1" \
| python -c 'import json,sys; data=json.load(sys.stdin); runs=data.get("workflow_runs") or []; print(runs[0]["id"] if runs else "")'
)"
if [ -z "$RUN_ID" ]; then
RUN_ID="$(
curl -fsSL \
-H "$AUTH_HEADER" \
-H "$ACCEPT_HEADER" \
-H "$VERSION_HEADER" \
"$API_URL?branch=main&status=success&per_page=1" \
| python -c 'import json,sys; data=json.load(sys.stdin); runs=data.get("workflow_runs") or []; print(runs[0]["id"] if runs else "")'
)"
fi
if [ -z "$RUN_ID" ]; then
echo "Could not find a successful LadybugDB/ladybug build-and-deploy run." >&2
exit 1
fi
echo "Using Ladybug build-and-deploy RUN_ID=$RUN_ID for SHA=$SHA"
echo "LBUG_PRECOMPILED_RUN_ID=$RUN_ID" >> "$GITHUB_ENV"
- name: Download liblbug
env:
GH_TOKEN: ${{ github.token }}
LBUG_TARGET_DIR: ${{ github.workspace }}/src-tauri/liblbug
run: bash scripts/download-liblbug.sh
- name: Download icebug
env:
ICEBUG_TARGET_DIR: ${{ github.workspace }}/src-tauri/icebug
run: bash scripts/download_icebug.sh
- name: Stage macOS dylibs
if: matrix.platform == 'macos-latest'
run: bash scripts/stage_macos_frameworks.sh
- name: Build Tauri app (Linux)
if: matrix.platform == 'ubuntu-latest' || matrix.platform == 'ubuntu-24.04-arm'
run: pnpm tauri build --target ${{ matrix.target }} --bundles ${{ matrix.bundles }} --verbose
env:
# Needed for linuxdeploy AppImage bundling on CI runners
APPIMAGE_EXTRACT_AND_RUN: "1"
# Ensure linuxdeploy can resolve and bundle liblbug.so
LD_LIBRARY_PATH: ${{ github.workspace }}/src-tauri/liblbug
NO_STRIP: "true" # https://github.com/tauri-apps/tauri/issues/14796
- name: Build Tauri app (macOS)
if: matrix.platform == 'macos-latest'
run: pnpm tauri build --target ${{ matrix.target }} --bundles ${{ matrix.bundles }} --features icebug-analytics --verbose
env:
CXXFLAGS: -I/opt/homebrew/opt/libomp/include
- name: Build Tauri app (Windows)
if: matrix.platform == 'windows-latest'
run: pnpm tauri build --target ${{ matrix.target }} --bundles ${{ matrix.bundles }} --verbose
- name: Upload artifacts
uses: actions/upload-artifact@v4
with:
name: bundles-${{ matrix.platform }}
path: |
src-tauri/target/${{ matrix.target }}/release/bundle/**/*.dmg
src-tauri/target/${{ matrix.target }}/release/bundle/**/*.msi
src-tauri/target/${{ matrix.target }}/release/bundle/**/*.exe
src-tauri/target/${{ matrix.target }}/release/bundle/**/*.AppImage
src-tauri/target/${{ matrix.target }}/release/bundle/**/*.deb
release:
needs: build
if: startsWith(github.ref, 'refs/tags/v')
runs-on: ubuntu-latest
permissions:
actions: read
contents: write
steps:
- name: Download all artifacts
uses: actions/download-artifact@v4
with:
path: artifacts
- name: Create Release
uses: softprops/action-gh-release@v1
with:
files: artifacts/**/*
draft: true
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}