-
Notifications
You must be signed in to change notification settings - Fork 15
187 lines (183 loc) · 6.77 KB
/
Copy pathrelease.yml
File metadata and controls
187 lines (183 loc) · 6.77 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
name: Release
on:
push:
tags:
- 'v*.*.*'
workflow_dispatch:
inputs:
version:
description: "Version to build (without leading 'v')"
required: true
permissions:
contents: write # needed for softprops/action-gh-release
env:
CARGO_TERM_COLOR: always
jobs:
build:
name: Build (${{ matrix.target }}${{ matrix.artifact_suffix }})
runs-on: ${{ matrix.runner }}
container:
# An expression evaluating to empty means "no container" — the job runs
# directly on the runner. A literal `image: ''` fails schema validation,
# but an expression does not, which is what makes this pattern work.
image: ${{ matrix.container }}
timeout-minutes: 90
strategy:
fail-fast: false
matrix:
include:
- target: x86_64-unknown-linux-gnu
runner: ubuntu-24.04
os_label: linux
container: ""
artifact_suffix: ""
- target: aarch64-unknown-linux-gnu
runner: ubuntu-24.04-arm
os_label: linux
container: ""
artifact_suffix: ""
# Debian 12 (bookworm) ships glibc 2.36. Building inside the image
# pins the ABI floor by construction, independent of whatever glibc
# the host runner image happens to carry, so these archives keep
# working on bookworm-based deployments.
- target: x86_64-unknown-linux-gnu
runner: ubuntu-24.04
os_label: linux
container: "debian:12"
artifact_suffix: "-debian12"
- target: aarch64-unknown-linux-gnu
runner: ubuntu-24.04-arm
os_label: linux
container: "debian:12"
artifact_suffix: "-debian12"
# x86_64-apple-darwin temporarily disabled: GitHub is deprecating
# macos-13 runners and jobs queue 24h+ before timing out. Restore
# this row once a macos-* Intel runner is reliably available again.
- target: aarch64-apple-darwin
runner: macos-14
os_label: macos
container: ""
artifact_suffix: ""
env:
CC: clang
CXX: clang++
steps:
# Runs before checkout so git is present for the clone and for the
# Corrosion FetchContent. The image has no sudo and runs as root.
# xz-utils backs `tar -cJf` and perl provides `shasum`; neither is in
# the base image. libprotobuf-dev supplies the well-known .proto files
# under /usr/include/google/protobuf/, which lance-encoding's build
# script imports; protobuf-compiler only Recommends it, so
# --no-install-recommends drops it and protoc fails to resolve
# google/protobuf/empty.proto.
- name: Install build dependencies (container)
if: matrix.container != ''
run: |
apt-get update
apt-get install -y --no-install-recommends \
build-essential \
ca-certificates \
clang \
cmake \
curl \
git \
libprotobuf-dev \
libssl-dev \
perl \
pkg-config \
protobuf-compiler \
xz-utils
- uses: actions/checkout@v4
- name: Mark workspace safe for git (container)
if: matrix.container != ''
run: git config --global --add safe.directory '*'
- uses: actions-rust-lang/setup-rust-toolchain@v1
with:
target: ${{ matrix.target }}
- uses: Swatinem/rust-cache@v2
with:
# Suffix keeps the container and host builds of the same triple from
# sharing a cache — they link against different glibc versions.
key: ${{ matrix.target }}${{ matrix.artifact_suffix }}
- name: Install protobuf (Linux)
if: matrix.os_label == 'linux' && matrix.container == ''
run: sudo apt-get update && sudo apt-get install -y protobuf-compiler
- name: Install protobuf (macOS)
if: matrix.os_label == 'macos'
run: brew install protobuf
- name: Resolve version
id: ver
run: |
if [ "${{ github.event_name }}" = "workflow_dispatch" ]; then
echo "version=${{ inputs.version }}" >>"$GITHUB_OUTPUT"
else
echo "version=${GITHUB_REF_NAME#v}" >>"$GITHUB_OUTPUT"
fi
- name: Configure + build
run: |
cmake -S . -B build -DCMAKE_BUILD_TYPE=Release
cmake --build build --parallel
- name: Install to staging prefix
run: cmake --install build --prefix stage
- name: Tar
id: pack
run: |
VERSION=${{ steps.ver.outputs.version }}
TARGET=${{ matrix.target }}
SUFFIX=${{ matrix.artifact_suffix }}
ARCHIVE="lance-c-v${VERSION}-${TARGET}${SUFFIX}.tar.xz"
tar -C stage -cJf "${ARCHIVE}" .
shasum -a 256 "${ARCHIVE}" > "${ARCHIVE}.sha256"
shasum -a 512 "${ARCHIVE}" > "${ARCHIVE}.sha512"
echo "archive=${ARCHIVE}" >>"$GITHUB_OUTPUT"
- name: Upload as workflow artifact
uses: actions/upload-artifact@v4
with:
name: ${{ matrix.target }}${{ matrix.artifact_suffix }}
path: |
${{ steps.pack.outputs.archive }}
${{ steps.pack.outputs.archive }}.sha256
${{ steps.pack.outputs.archive }}.sha512
if-no-files-found: error
retention-days: 14
publish:
name: Publish GitHub Release
needs: build
runs-on: ubuntu-24.04
if: startsWith(github.ref, 'refs/tags/v')
steps:
- uses: actions/checkout@v4
- uses: actions/download-artifact@v4
with:
path: dist
merge-multiple: true
- name: Aggregate SHA512SUMS
run: |
cd dist
cat *.sha512 > SHA512SUMS
ls -lah
- name: Emit recipe-update snippet
run: |
cd dist
echo "## Suggested recipe updates" > recipe-snippets.md
echo '```cmake' >> recipe-snippets.md
echo '# ports/lance-c/portfile.cmake — paste these set() lines' >> recipe-snippets.md
for f in *.tar.xz; do
sha=$(awk '{print $1}' "${f}.sha512")
triple_target="${f#lance-c-v*-}"
triple_target="${triple_target%.tar.xz}"
echo "set(LANCE_C_SHA512_${triple_target} \"${sha}\")"
done >> recipe-snippets.md
echo '```' >> recipe-snippets.md
cat recipe-snippets.md
- name: Publish release
uses: softprops/action-gh-release@v2
with:
files: |
dist/*.tar.xz
dist/*.sha256
dist/*.sha512
dist/SHA512SUMS
generate_release_notes: true
fail_on_unmatched_files: true
prerelease: ${{ contains(github.ref_name, '-beta') || contains(github.ref_name, '-rc') }}