Skip to content

Commit c9d54d9

Browse files
ci: release Alpine binaries (#4)
1 parent 192e348 commit c9d54d9

File tree

3 files changed

+112
-0
lines changed

3 files changed

+112
-0
lines changed
Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
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+
22+
concurrency:
23+
group: ${{ github.workflow }}-${{ github.ref }}
24+
cancel-in-progress: true
25+
26+
jobs:
27+
28+
release-alpine:
29+
name: Build binaries on Alpine
30+
runs-on: ubuntu-latest
31+
timeout-minutes: 300
32+
33+
strategy:
34+
matrix:
35+
platform: [amd64, arm64]
36+
37+
steps:
38+
- uses: actions/checkout@v3
39+
with:
40+
fetch-depth: 0
41+
submodules: recursive
42+
43+
- uses: docker/setup-qemu-action@v2
44+
- uses: docker/setup-buildx-action@v2
45+
- uses: docker/build-push-action@v3
46+
with:
47+
context: ./docker/alpine
48+
load: true
49+
tags: build:latest
50+
platforms: linux/${{matrix.platform}}
51+
build-args: ARCH=${{matrix.platform}}
52+
cache-from: type=gha
53+
cache-to: type=gha,mode=max
54+
55+
- name: build binaries on ${{ matrix.platform }}
56+
run: |
57+
docker run --rm -v $PWD:/app build /app/docker/alpine/build.sh
58+
59+
- name: upload
60+
uses: actions/upload-artifact@master
61+
with:
62+
name: snctl-cpp-alpine-${{ matrix.platform }}
63+
path: |
64+
snctl-cpp
65+
sncloud.ini
66+
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: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
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+
export VCPKG_FORCE_SYSTEM_BINARIES=1
20+
./vcpkg/bootstrap-vcpkg.sh
21+
cmake -B build-$ARCH
22+
cmake --build build-$ARCH
23+
cp ./build-$ARCH/snctl-cpp .

0 commit comments

Comments
 (0)