Skip to content

Commit b56ce4b

Browse files
committed
Fix cross-platform builds after addiong GEOS dependency.
* GEOS couldn't build on MacOS due to CMake being to new :/. * GEOS couldn't build on Linux MUSL, due to missing an appropriate g++ setup :/. We're now downgrading cmake and are building in Docker on Linux :/.
1 parent ea00d0e commit b56ce4b

File tree

4 files changed

+189
-149
lines changed

4 files changed

+189
-149
lines changed

.github/workflows/release.yml

Lines changed: 141 additions & 144 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,12 @@ on:
55
tags:
66
- "v*.*.*"
77

8+
env:
9+
TOOLCHAIN_VERSION: 1.93.1
10+
CARGO_PROFILE_RELEASE_LTO: "fat"
11+
CARGO_PROFILE_RELEASE_CODEGEN_UNITS: "1"
12+
PNPM_OFFLINE: "TRUE"
13+
814
jobs:
915
changelog:
1016
runs-on: ubuntu-latest
@@ -18,250 +24,241 @@ jobs:
1824
awk "/## v${VERSION}.*/{include=1; next} /## v.*/{include=0} include && NF" CHANGELOG.md > ./CHANGELOG-release.md
1925
cat ./CHANGELOG-release.md
2026
21-
- name: Release Change log
27+
- name: Release Changelog
2228
uses: softprops/action-gh-release@v2
2329
with:
2430
generate_release_notes: true
2531
body_path: ./CHANGELOG-release.md
2632

27-
# release-x86_64-linux-glibc:
28-
# needs: changelog
29-
# runs-on: ubuntu-latest
30-
# steps:
31-
# - uses: actions/checkout@v3
32-
# with:
33-
# submodules: 'true'
34-
# - name: Install Dependencies
35-
# run: |
36-
# sudo apt-get update && \
37-
# sudo apt-get install -y --no-install-recommends curl libssl-dev pkg-config libclang-dev protobuf-compiler libprotobuf-dev zip
38-
# - uses: pnpm/action-setup@v4
39-
# with:
40-
# version: 9
41-
# - name: PNPM install
42-
# run: |
43-
# pnpm install
44-
# - uses: actions-rs/toolchain@v1
45-
# with:
46-
# toolchain: 1.93.0
47-
# target: x86_64-unknown-linux-gnu
48-
# default: true
49-
# - name: Rust Build
50-
# # NOTE: cargo links different binaries whether in the crate or workspace root :/.
51-
# run: |
52-
# cd crates/cli && \
53-
# CARGO_PROFILE_RELEASE_LTO=fat CARGO_PROFILE_RELEASE_CODEGEN_UNITS=1 PNPM_OFFLINE=TRUE \
54-
# cargo build --target x86_64-unknown-linux-gnu --release --bin trail && \
55-
# cd ../.. && \
56-
# zip -r -j trailbase_${{ github.ref_name }}_x86_64_linux_glibc.zip target/x86_64-unknown-linux-gnu/release/trail CHANGELOG.md LICENSE
57-
58-
# - name: Release binaries
59-
# uses: softprops/action-gh-release@v2
60-
# with:
61-
# fail_on_unmatched_files: true
62-
# files: trailbase_${{ github.ref_name }}_x86_64_linux_glibc.zip
63-
64-
release-x86_64-linux-static:
33+
# NOTE: We use Docker. Otherwise getting compatible versions for
34+
# musl-gcc, g++ (GEOS is C++) and rustc is borderline impossible.
35+
release-x86_64-linux-musl:
6536
needs: changelog
6637
runs-on: ubuntu-latest
38+
env:
39+
RUST_TARGET: x86_64-unknown-linux-musl
40+
DOCKER_WORKSPACE: /workspace
41+
6742
steps:
6843
- uses: actions/checkout@v3
6944
with:
70-
submodules: 'true'
71-
- name: Install Dependencies
72-
run: |
73-
sudo apt-get update && \
74-
sudo apt-get install -y --no-install-recommends curl libssl-dev pkg-config libclang-dev protobuf-compiler libprotobuf-dev zip musl-tools
45+
submodules: 'recursive'
7546
- uses: pnpm/action-setup@v4
7647
with:
7748
version: 9
7849
- name: PNPM install
50+
run: pnpm install
51+
52+
- name: Build a Builder Image
7953
run: |
80-
pnpm install
81-
- uses: actions-rs/toolchain@v1
82-
with:
83-
toolchain: 1.93.0
84-
target: x86_64-unknown-linux-musl
85-
default: true
86-
- name: Rust Build
54+
docker build -f Dockerfile.ci \
55+
--build-arg BASE_IMAGE_TAG=x86_64-musl \
56+
--build-arg RUST_TARGET=${{ env.RUST_TARGET }} \
57+
--build-arg RUST_TOOLCHAIN_VERSION=${{ env.TOOLCHAIN_VERSION }} \
58+
--build-arg WORKSPACE=${{ env.DOCKER_WORKSPACE }} \
59+
-t builder:latest .
60+
61+
- name: Rust Build using the Builder
8762
run: |
88-
cd crates/cli && \
89-
CARGO_PROFILE_RELEASE_LTO=fat CARGO_PROFILE_RELEASE_CODEGEN_UNITS=1 PNPM_OFFLINE=TRUE \
90-
cargo build --target x86_64-unknown-linux-musl --release --features=vendor-ssl,static-geos --bin trail && \
91-
cd ../.. && \
92-
zip -r -j trailbase_${{ github.ref_name }}_x86_64_linux.zip target/x86_64-unknown-linux-musl/release/trail CHANGELOG.md LICENSE
63+
env && \
64+
docker run --rm \
65+
-v ${{ github.workspace }}:${{ env.DOCKER_WORKSPACE }} \
66+
-e CARGO_PROFILE_RELEASE_LTO=${{ env.CARGO_PROFILE_RELEASE_LTO }} \
67+
-e CARGO_PROFILE_RELEASE_CODEGEN_UNITS=${{ env.CARGO_PROFILE_RELEASE_CODEGEN_UNITS }} \
68+
-e PNPM_OFFLINE=FALSE \
69+
builder:latest \
70+
/root/.cargo/bin/cargo build --target ${{ env.RUST_TARGET }} --release --features=static-geos --bin trail
9371
72+
- name: Package Artifacts
73+
run: |
74+
zip -r -j trailbase_${{ github.ref_name }}_x86_64_linux.zip target/${{ env.RUST_TARGET }}/release/trail CHANGELOG.md LICENSE
9475
- name: Release binaries
9576
uses: softprops/action-gh-release@v2
9677
with:
9778
fail_on_unmatched_files: true
9879
files: trailbase_${{ github.ref_name }}_x86_64_linux.zip
9980

100-
release-aarch64-linux-static:
81+
release-aarch64-linux-musl:
10182
needs: changelog
10283
runs-on: ubuntu-24.04-arm
84+
env:
85+
RUST_TARGET: aarch64-unknown-linux-musl
86+
DOCKER_WORKSPACE: /workspace
87+
10388
steps:
10489
- uses: actions/checkout@v3
10590
with:
106-
submodules: 'true'
107-
- name: Install Dependencies
108-
run: |
109-
sudo apt-get update && \
110-
sudo apt-get install -y --no-install-recommends curl libssl-dev pkg-config libclang-dev protobuf-compiler libprotobuf-dev zip musl-tools
91+
submodules: 'recursive'
11192
- uses: pnpm/action-setup@v4
11293
with:
11394
version: 9
11495
- name: PNPM install
96+
run: pnpm install
97+
98+
- name: Build a Builder Image
11599
run: |
116-
pnpm install
117-
- uses: actions-rs/toolchain@v1
118-
with:
119-
toolchain: 1.93.0
120-
target: aarch64-unknown-linux-musl
121-
default: true
122-
- name: Rust Build
100+
docker build -f Dockerfile.ci \
101+
--build-arg BASE_IMAGE_TAG=aarch64-musl \
102+
--build-arg RUST_TARGET=${{ env.RUST_TARGET }} \
103+
--build-arg RUST_TOOLCHAIN_VERSION=${{ env.TOOLCHAIN_VERSION }} \
104+
--build-arg WORKSPACE=${{ env.DOCKER_WORKSPACE }} \
105+
-t builder:latest .
106+
107+
- name: Rust Build using the Builder
123108
run: |
124-
cd crates/cli && \
125-
CARGO_PROFILE_RELEASE_LTO=fat CARGO_PROFILE_RELEASE_CODEGEN_UNITS=1 PNPM_OFFLINE=TRUE \
126-
cargo build --target aarch64-unknown-linux-musl --release --features=vendor-ssl,static-geos --bin trail && \
127-
cd ../.. && \
128-
zip -r -j trailbase_${{ github.ref_name }}_arm64_linux.zip target/aarch64-unknown-linux-musl/release/trail CHANGELOG.md LICENSE
109+
env && \
110+
docker run --rm \
111+
-v ${{ github.workspace }}:${{ env.DOCKER_WORKSPACE }} \
112+
-e CARGO_PROFILE_RELEASE_LTO=${{ env.CARGO_PROFILE_RELEASE_LTO }} \
113+
-e CARGO_PROFILE_RELEASE_CODEGEN_UNITS=${{ env.CARGO_PROFILE_RELEASE_CODEGEN_UNITS }} \
114+
-e PNPM_OFFLINE=FALSE \
115+
builder:latest \
116+
/root/.cargo/bin/cargo build --target ${{ env.RUST_TARGET }} --release --features=static-geos --bin trail
129117
118+
- name: Package Artifacts
119+
run: |
120+
zip -r -j trailbase_${{ github.ref_name }}_arm64_linux.zip target/${{ env.RUST_TARGET }}/release/trail CHANGELOG.md LICENSE
130121
- name: Release binaries
131122
uses: softprops/action-gh-release@v2
132123
with:
133124
fail_on_unmatched_files: true
134125
files: trailbase_${{ github.ref_name }}_arm64_linux.zip
135126

136-
release-wasm-auth-ui:
127+
release-aarch64-apple-darwin:
137128
needs: changelog
138-
runs-on: ubuntu-latest
129+
runs-on: macos-15
130+
env:
131+
RUST_TARGET: aarch64-apple-darwin
139132
steps:
140133
- uses: actions/checkout@v3
141134
with:
142-
submodules: 'true'
135+
submodules: 'recursive'
143136
- name: Install Dependencies
144-
run: |
145-
sudo apt-get update && \
146-
sudo apt-get install -y --no-install-recommends curl libssl-dev pkg-config libclang-dev protobuf-compiler libprotobuf-dev zip
147-
- uses: pnpm/action-setup@v4
148-
with:
149-
version: 9
137+
run: brew update && brew install protobuf pnpm
150138
- name: PNPM install
151-
run: |
152-
pnpm install
139+
run: pnpm install
140+
# CMake v4 is too new: https://github.com/georust/geos/issues/194
141+
- name: Downgrade CMake
142+
run: pipx install --force cmake==3.31
153143
- uses: actions-rs/toolchain@v1
154144
with:
155-
toolchain: 1.93.0
156-
target: wasm32-wasip2
145+
toolchain: ${{ env.TOOLCHAIN_VERSION }}
146+
target: ${{ env.RUST_TARGET }}
157147
default: true
158148
- name: Rust Build
159149
run: |
160-
cd crates/auth-ui && \
161-
make && \
162-
cd ../.. && \
163-
zip -r -j trailbase_${{ github.ref_name }}_wasm_auth_ui.zip target/wasm32-wasip2/release/auth_ui_component.wasm CHANGELOG.md LICENSE
164-
150+
env && \
151+
cargo build --target ${{ env.RUST_TARGET }} --release --features=static-geos --bin trail
152+
- name: Package Artifacts
153+
run: |
154+
zip -r -j trailbase_${{ github.ref_name }}_arm64_apple_darwin.zip target/${{ env.RUST_TARGET }}/release/trail CHANGELOG.md LICENSE
165155
- name: Release binaries
166156
uses: softprops/action-gh-release@v2
167157
with:
168158
fail_on_unmatched_files: true
169-
files: trailbase_${{ github.ref_name }}_wasm_auth_ui.zip
159+
files: trailbase_${{ github.ref_name }}_arm64_apple_darwin.zip
170160

171-
release-aarch64-apple-darwin:
161+
release-x86_64-apple-darwin:
172162
needs: changelog
173-
runs-on: macos-14
163+
runs-on: macos-15
164+
env:
165+
RUST_TARGET: x86_64-apple-darwin
174166
steps:
175167
- uses: actions/checkout@v3
176168
with:
177-
submodules: 'true'
169+
submodules: 'recursive'
178170
- name: Install Dependencies
179-
run: |
180-
brew update && brew install protobuf sqlite
181-
182-
- uses: pnpm/action-setup@v4
183-
with:
184-
version: 9
171+
run: brew update && brew install protobuf pnpm
185172
- name: PNPM install
186-
run: |
187-
pnpm install
173+
run: pnpm install
174+
# CMake v4 is too new: https://github.com/georust/geos/issues/194
175+
- name: Downgrade CMake
176+
run: pipx install --force cmake==3.31
188177
- uses: actions-rs/toolchain@v1
189178
with:
190-
toolchain: 1.93.0
191-
target: aarch64-apple-darwin
179+
toolchain: ${{ env.TOOLCHAIN_VERSION }}
180+
target: ${{ env.RUST_TARGET }}
192181
default: true
193182
- name: Rust Build
194183
run: |
195-
CARGO_PROFILE_RELEASE_LTO=fat CARGO_PROFILE_RELEASE_CODEGEN_UNITS=1 PNPM_OFFLINE=TRUE \
196-
cargo build --target aarch64-apple-darwin --release --features=static-geos --bin trail && \
197-
zip -r -j trailbase_${{ github.ref_name }}_arm64_apple_darwin.zip target/aarch64-apple-darwin/release/trail CHANGELOG.md LICENSE
198-
184+
env && \
185+
cargo build --target ${{ env.RUST_TARGET }} --release --features=static-geos --bin trail
186+
- name: Package Artifacts
187+
run: |
188+
zip -r -j trailbase_${{ github.ref_name }}_x86_64_apple_darwin.zip target/${{ env.RUST_TARGET }}/release/trail CHANGELOG.md LICENSE
199189
- name: Release binaries
200190
uses: softprops/action-gh-release@v2
201191
with:
202192
fail_on_unmatched_files: true
203-
files: trailbase_${{ github.ref_name }}_arm64_apple_darwin.zip
193+
files: trailbase_${{ github.ref_name }}_x86_64_apple_darwin.zip
204194

205-
release-x86_64-apple-darwin:
195+
release-x86_64-windows:
206196
needs: changelog
207-
runs-on: macos-14
197+
runs-on: windows-latest
198+
env:
199+
RUST_TARGET: x86_64-pc-windows-msvc
208200
steps:
209201
- uses: actions/checkout@v3
210202
with:
211-
submodules: 'true'
212-
- name: Install Dependencies
213-
run: |
214-
brew update && brew install protobuf sqlite
215-
216-
- uses: pnpm/action-setup@v4
203+
submodules: 'recursive'
204+
- uses: MinoruSekine/setup-scoop@v4.0.1
217205
with:
218-
version: 9
206+
buckets: extras
207+
apps: nodejs pnpm protobuf zip
219208
- name: PNPM install
220-
run: |
221-
pnpm install
209+
shell: bash
210+
run: pnpm install
222211
- uses: actions-rs/toolchain@v1
223212
with:
224-
toolchain: 1.93.0
225-
target: x86_64-apple-darwin
213+
toolchain: ${{ env.TOOLCHAIN_VERSION }}
214+
target: ${{ env.RUST_TARGET }}
226215
default: true
227216
- name: Rust Build
217+
shell: bash
228218
run: |
229-
CARGO_PROFILE_RELEASE_LTO=fat CARGO_PROFILE_RELEASE_CODEGEN_UNITS=1 PNPM_OFFLINE=TRUE \
230-
cargo build --target x86_64-apple-darwin --release --features=static-geos --bin trail && \
231-
zip -r -j trailbase_${{ github.ref_name }}_x86_64_apple_darwin.zip target/x86_64-apple-darwin/release/trail CHANGELOG.md LICENSE
232-
219+
env && \
220+
cargo build --target ${{ env.RUST_TARGET }} --release --features=static-geos --bin trail
221+
- name: Package Artifacts
222+
run: |
223+
zip -r -j trailbase_${{ github.ref_name }}_x86_64_windows.zip target/${{ env.RUST_TARGET }}/release/trail.exe CHANGELOG.md LICENSE
233224
- name: Release binaries
234225
uses: softprops/action-gh-release@v2
235226
with:
236227
fail_on_unmatched_files: true
237-
files: trailbase_${{ github.ref_name }}_x86_64_apple_darwin.zip
228+
files: trailbase_${{ github.ref_name }}_x86_64_windows.zip
238229

239-
release-x86_64-windows:
230+
release-wasm-auth-ui:
240231
needs: changelog
241-
runs-on: windows-latest
232+
runs-on: ubuntu-latest
233+
env:
234+
RUST_TARGET: wasm32-wasip2
242235
steps:
243236
- uses: actions/checkout@v3
244237
with:
245-
submodules: 'true'
246-
- uses: MinoruSekine/setup-scoop@v4.0.1
238+
submodules: 'recursive'
239+
- name: Install Dependencies
240+
run: |
241+
sudo apt-get update && \
242+
sudo apt-get install -y --no-install-recommends curl libssl-dev pkg-config libclang-dev protobuf-compiler libprotobuf-dev zip
243+
- uses: pnpm/action-setup@v4
247244
with:
248-
buckets: extras
249-
apps: nodejs pnpm protobuf zip
245+
version: 9
246+
- name: PNPM install
247+
run: pnpm install
250248
- uses: actions-rs/toolchain@v1
251249
with:
252-
toolchain: 1.93.0
253-
target: x86_64-pc-windows-msvc
250+
toolchain: ${{ env.TOOLCHAIN_VERSION }}
251+
target: ${{ env.RUST_TARGET }}
254252
default: true
255253
- name: Rust Build
256-
shell: bash
257254
run: |
258-
pnpm install && \
259-
CARGO_PROFILE_RELEASE_LTO=fat CARGO_PROFILE_RELEASE_CODEGEN_UNITS=1 PNPM_OFFLINE=TRUE \
260-
cargo build --target x86_64-pc-windows-msvc --release --features=static-geos --bin trail && \
261-
zip -r -j trailbase_${{ github.ref_name }}_x86_64_windows.zip target/x86_64-pc-windows-msvc/release/trail.exe CHANGELOG.md LICENSE
262-
255+
env && cd crates/auth-ui && \
256+
cargo build --target ${{ env.RUST_TARGET }} --release
257+
- name: Package Artifacts
258+
run: |
259+
zip -r -j trailbase_${{ github.ref_name }}_wasm_auth_ui.zip target/${{ env.RUST_TARGET }}/release/auth_ui_component.wasm CHANGELOG.md LICENSE
263260
- name: Release binaries
264261
uses: softprops/action-gh-release@v2
265262
with:
266263
fail_on_unmatched_files: true
267-
files: trailbase_${{ github.ref_name }}_x86_64_windows.zip
264+
files: trailbase_${{ github.ref_name }}_wasm_auth_ui.zip

0 commit comments

Comments
 (0)