Skip to content

Commit 724d54a

Browse files
committed
ci: release Alpine binaries
1 parent 192e348 commit 724d54a

File tree

3 files changed

+118
-0
lines changed

3 files changed

+118
-0
lines changed
Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
# Copyright 2025 Yunze Xu
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License");
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
#
7+
# http://www.apache.org/licenses/LICENSE-2.0
8+
#
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.
14+
15+
name: Release Linux binaries
16+
17+
on:
18+
push:
19+
tags:
20+
- 'v*'
21+
# TODO: remove the following condition
22+
pull_request:
23+
branches:
24+
- main
25+
26+
concurrency:
27+
group: ${{ github.workflow }}-${{ github.ref }}
28+
cancel-in-progress: true
29+
30+
jobs:
31+
32+
release-alpine:
33+
name: Build binaries on Alpine
34+
runs-on: ubuntu-latest
35+
timeout-minutes: 300
36+
37+
strategy:
38+
matrix:
39+
platform: [amd64, arm64]
40+
41+
steps:
42+
- name: actions/checkout@v3
43+
with:
44+
fetch-depth: 0
45+
submodules: recursive
46+
47+
- uses: docker/setup-qemu-action@v2
48+
- uses: docker/setup-buildx-action@v2
49+
- uses: docker/build-push-action@v3
50+
with:
51+
context: ./docker/alpine
52+
load: true
53+
tags: build:latest
54+
platforms: linux/${{matrix.platform}}
55+
build-args: ARCH=${{matrix.platform}}
56+
cache-from: type=gha
57+
cache-to: type=gha,mode=max
58+
59+
- name: build binaries on ${{ matrix.platform }}
60+
run: |
61+
docker run --rm -v $PWD:/app build /app/docker/alpine/build.sh
62+
63+
- name: upload
64+
uses: actions/upload-artifact@master
65+
with:
66+
name: snctl-cpp-alpine-${{ matrix.platform }}
67+
path: |
68+
snctl-cpp
69+
sncloud.ini
70+
install.sh

docker/alpine/Dockerfile

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
# Copyright 2025 Yunze Xu
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License");
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
#
7+
# http://www.apache.org/licenses/LICENSE-2.0
8+
#
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.
14+
15+
FROM alpine:3.21
16+
17+
ARG ARCH
18+
ENV ARCH=${ARCH}
19+
20+
RUN apk update
21+
# These tools are required by vcpkg and dependencies like openssl
22+
RUN apk add gcc g++ cmake git curl ninja make zip perl linux-headers bash pkgconfig
23+
WORKDIR /app

docker/alpine/build.sh

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
#!/bin/ash
2+
# Copyright 2025 Yunze Xu
3+
#
4+
# Licensed under the Apache License, Version 2.0 (the "License");
5+
# you may not use this file except in compliance with the License.
6+
# You may obtain a copy of the License at
7+
#
8+
# http://www.apache.org/licenses/LICENSE-2.0
9+
#
10+
# Unless required by applicable law or agreed to in writing, software
11+
# distributed under the License is distributed on an "AS IS" BASIS,
12+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
# See the License for the specific language governing permissions and
14+
# limitations under the License.
15+
16+
set -e
17+
18+
cd /app
19+
if [ $ARCH == "arm64" ]; then
20+
export VCPKG_FORCE_SYSTEM_BINARIES=1
21+
fi
22+
./vcpkg/bootstrap-vcpkg.sh
23+
cmake -B build-$ARCH
24+
cmake --build build-$ARCH
25+
cp ./build-$ARCH/snctl-cpp .

0 commit comments

Comments
 (0)