Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
66 changes: 66 additions & 0 deletions .github/workflows/release-linux.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
# Copyright 2025 Yunze Xu
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

name: Release Linux binaries

on:
push:
tags:
- 'v*'

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:

release-alpine:
name: Build binaries on Alpine
runs-on: ubuntu-latest
timeout-minutes: 300

strategy:
matrix:
platform: [amd64, arm64]

steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
submodules: recursive

- uses: docker/setup-qemu-action@v2
- uses: docker/setup-buildx-action@v2
- uses: docker/build-push-action@v3
with:
context: ./docker/alpine
load: true
tags: build:latest
platforms: linux/${{matrix.platform}}
build-args: ARCH=${{matrix.platform}}
cache-from: type=gha
cache-to: type=gha,mode=max

- name: build binaries on ${{ matrix.platform }}
run: |
docker run --rm -v $PWD:/app build /app/docker/alpine/build.sh

- name: upload
uses: actions/upload-artifact@master
with:
name: snctl-cpp-alpine-${{ matrix.platform }}
path: |
snctl-cpp
sncloud.ini
install.sh
23 changes: 23 additions & 0 deletions docker/alpine/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# Copyright 2025 Yunze Xu
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

FROM alpine:3.21

ARG ARCH
ENV ARCH=${ARCH}

RUN apk update
# These tools are required by vcpkg and dependencies like openssl
RUN apk add gcc g++ cmake git curl ninja make zip perl linux-headers bash pkgconfig
WORKDIR /app
23 changes: 23 additions & 0 deletions docker/alpine/build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
#!/bin/ash
# Copyright 2025 Yunze Xu
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

set -e

cd /app
export VCPKG_FORCE_SYSTEM_BINARIES=1
./vcpkg/bootstrap-vcpkg.sh
cmake -B build-$ARCH
cmake --build build-$ARCH
cp ./build-$ARCH/snctl-cpp .