Skip to content

Commit f0379ff

Browse files
authored
chore: use cargo build to build enterprise artifacts (#1310)
1 parent f9c95b0 commit f0379ff

File tree

3 files changed

+38
-29
lines changed

3 files changed

+38
-29
lines changed

.github/workflows/release.yml

Lines changed: 37 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ jobs:
8787
name: artifacts-plan-dist-manifest
8888
path: plan-dist-manifest.json
8989

90-
# Build and packages all the platform-specific things
90+
# Build and packages all the platform-specific things (OSS)
9191
build-local-artifacts:
9292
name: build-local-artifacts (${{ join(matrix.targets, ', ') }})
9393
# Let the initial task tell us to not run (currently very blunt)
@@ -165,6 +165,7 @@ jobs:
165165
${{ steps.cargo-dist.outputs.paths }}
166166
${{ env.BUILD_MANIFEST_NAME }}
167167
168+
# Enterprise build (manual via cargo + tar.gz)
168169
build-enterprise-artifacts:
169170
name: build-enterprise-artifacts (${{ join(matrix.targets, ', ') }})
170171
needs:
@@ -177,7 +178,6 @@ jobs:
177178
container: ${{ matrix.container && matrix.container.image || null }}
178179
env:
179180
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
180-
BUILD_MANIFEST_NAME: target/distrib/enterprise-${{ join(matrix.targets, '-') }}-dist-manifest.json
181181
steps:
182182
- name: enable windows longpaths
183183
run: |
@@ -193,34 +193,48 @@ jobs:
193193
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y
194194
echo "$HOME/.cargo/bin" >> $GITHUB_PATH
195195
fi
196-
- name: Install dist
197-
run: ${{ matrix.install_dist.run }}
198-
- name: Fetch local artifacts
199-
uses: actions/download-artifact@v6
200-
with:
201-
pattern: artifacts-*
202-
path: target/distrib/
203-
merge-multiple: true
204196
- name: Install dependencies
205197
run: |
206198
${{ matrix.packages_install }}
207-
- name: Build enterprise artifacts
208-
run: |
209-
dist build ${{ needs.plan.outputs.tag-flag }} --features enterprise --print=linkage --output-format=json ${{ matrix.dist_args }} > dist-manifest.json
210-
echo "dist ran successfully"
211-
- id: rename-enterprise
212-
name: Rename artifacts with enterprise suffix
199+
- id: build-enterprise
200+
name: Build enterprise artifacts
213201
shell: bash
202+
env:
203+
RELEASE_TAG: ${{ needs.plan.outputs.tag }}
214204
run: |
215205
set -euo pipefail
216206
mkdir -p renamed
217-
mapfile -t files < <(dist print-upload-files-from-manifest --manifest dist-manifest.json)
218-
for f in "${files[@]}"; do
219-
base="$(basename "$f")"
220-
new_base="$(echo "$base" | sed 's/^unleash-edge/unleash-edge-enterprise/')"
221-
cp "$f" "renamed/$new_base"
207+
208+
# RELEASE_TAG is something like "unleash-edge-v1.2.3"
209+
tag="${RELEASE_TAG:-}"
210+
version="$tag"
211+
if [[ "$tag" == unleash-edge-v* ]]; then
212+
# Strip "unleash-edge-" so we keep "v1.2.3" (and any suffix)
213+
version="${tag#unleash-edge-}"
214+
fi
215+
if [[ -z "$version" ]]; then
216+
version="dev"
217+
fi
218+
219+
# Build and package for each target in this matrix entry
220+
for target in ${{ join(matrix.targets, ' ') }}; do
221+
echo "Building enterprise binary for $target"
222+
cargo build --release --bin unleash-edge --features enterprise --target "$target"
223+
224+
bin_path="target/$target/release/unleash-edge"
225+
if [[ "$target" == *"windows"* ]]; then
226+
bin_path="$bin_path.exe"
227+
fi
228+
229+
archive="renamed/unleash-edge-enterprise-${version}-${target}.tar.xz"
230+
tar -cJf "$archive" -C "$(dirname "$bin_path")" "$(basename "$bin_path")"
231+
232+
if command -v sha256sum >/dev/null 2>&1; then
233+
sha256sum "$archive" > "${archive}.sha256"
234+
else
235+
shasum -a 256 "$archive" > "${archive}.sha256"
236+
fi
222237
done
223-
cp dist-manifest.json "$BUILD_MANIFEST_NAME"
224238
225239
echo "paths<<EOF" >> "$GITHUB_OUTPUT"
226240
for f in renamed/*; do
@@ -232,8 +246,7 @@ jobs:
232246
with:
233247
name: artifacts-enterprise-build-local-${{ join(matrix.targets, '_') }}
234248
path: |
235-
${{ steps.rename-enterprise.outputs.paths }}
236-
${{ env.BUILD_MANIFEST_NAME }}
249+
${{ steps.build-enterprise.outputs.paths }}
237250
238251
# Build and package all the platform-agnostic(ish) things
239252
build-global-artifacts:

.github/workflows/test-with-coverage.yaml

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -39,14 +39,11 @@ jobs:
3939
cache-on-failure: true
4040
- name: Check formatting with cargo fmt
4141
run: cargo fmt --all -- --check
42-
- name: Build so our integration tests have a binary
43-
run: |
44-
cargo build
4542
- name: Install required cargo packages for reporting test coverage
4643
run: cargo install cargo-llvm-cov
4744
- name: Run cargo-llvm-cov
4845
run: |
49-
cargo llvm-cov --all-features --lcov --output-path ./test-results.lcov --no-clean
46+
cargo llvm-cov --all-features --lcov --output-path ./test-results.lcov
5047
- name: Upload to coveralls
5148
uses: coverallsapp/github-action@v2
5249
with:

README.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
# Unleash Edge
22

3-
[![crates.io](https://img.shields.io/crates/v/unleash-edge?label=latest)](https://crates.io/crates/unleash-edge)
43
[![Documentation](https://docs.rs/unleash-edge/badge.svg?version=latest)](https://docs.rs/unleash-edge/latest)
54
[![Dependency Status](https://deps.rs/crate/unleash-edge/19.11.0/status.svg)](https://deps.rs/crate/unleash-edge/19.11.0)
65
[![CI](https://github.com/Unleash/unleash-edge/actions/workflows/test-with-coverage.yaml/badge.svg)](https://github.com/Unleash/unleash-edge/actions/workflows/test-with-coverage.yaml)

0 commit comments

Comments
 (0)