Update rapidyenc and simplify future updates #64
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Build | |
on: | |
push: | |
paths: | |
- 'src/**' | |
- '.github/workflows/build.yml' | |
jobs: | |
build_macos: | |
name: Build macOS | |
runs-on: macos-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
- name: List Xcode installations | |
run: sudo ls -1 /Applications | grep "Xcode" | |
- name: Select Xcode 15.3 | |
run: sudo xcode-select -s /Applications/Xcode_15.3.app/Contents/Developer | |
- name: Build | |
run: | | |
export ZERO_AR_DATE=1 | |
cmake -S src -B src/build \ | |
-DCMAKE_OSX_ARCHITECTURES="x86_64;arm64" \ | |
-DCMAKE_OSX_DEPLOYMENT_TARGET=12.0 | |
cmake --build src/build --target rapidyenc_static -j$(sysctl -n hw.ncpu) | |
cp src/build/rapidyenc_static/librapidyenc.a librapidyenc_darwin.a | |
- name: Upload static library | |
uses: actions/upload-artifact@v3 | |
with: | |
name: static | |
path: librapidyenc_darwin.a | |
build_windows: | |
name: Build Windows x64 | |
runs-on: windows-latest | |
defaults: | |
run: | |
shell: msys2 {0} | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
- uses: msys2/setup-msys2@v2 | |
with: | |
msystem: MINGW64 | |
update: true | |
pacboy: >- | |
gcc:p | |
cmake:p | |
ninja:p | |
- name: Build | |
run: | | |
cmake -S src -B src/build -G Ninja | |
cmake --build src/build --config Release --target rapidyenc_static | |
cp src/build/rapidyenc_static/librapidyenc.a librapidyenc_windows_amd64.a | |
- name: Upload shared library | |
uses: actions/upload-artifact@v3 | |
with: | |
name: static | |
path: librapidyenc_windows_amd64.a | |
build_linux: | |
name: Build ${{ matrix.platform }} | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
include: | |
- platform: linux/amd64 | |
library: librapidyenc_linux_amd64.a | |
- platform: linux/arm64 | |
library: librapidyenc_linux_arm64.a | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
- name: Set up QEMU | |
if: matrix.platform == 'linux/arm64' | |
uses: docker/setup-qemu-action@v3 | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v3 | |
- name: Build cross-compilation environment | |
uses: docker/build-push-action@v4 | |
with: | |
context: . | |
tags: builder/${{ matrix.platform }}:latest | |
platforms: ${{ matrix.platform }} | |
load: true | |
cache-from: type=gha | |
cache-to: type=gha,mode=max | |
push: false | |
- name: Build with Docker | |
uses: addnab/docker-run-action@v3 | |
with: | |
image: builder/${{ matrix.platform }}:latest | |
options: | | |
--platform ${{ matrix.platform }} | |
--volume ${{ github.workspace }}:/workspace | |
--workdir /workspace | |
run: | | |
cmake -S src -B src/build \ | |
-D CMAKE_BUILD_TYPE=Release | |
cmake --build src/build --target rapidyenc_static -j$(sysctl -n hw.ncpu) | |
cp src/build/rapidyenc_static/librapidyenc.a ${{ matrix.library }} | |
- name: Upload static library | |
uses: actions/upload-artifact@v3 | |
with: | |
name: static | |
path: ${{ matrix.library }} | |
test: | |
name: Test ${{ matrix.os }} go/${{ matrix.go }} | |
strategy: | |
matrix: | |
os: [ubuntu-latest, macos-latest, windows-latest] | |
go: [1.22] | |
runs-on: ${{ matrix.os }} | |
needs: [build_linux, build_macos, build_windows] | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
- name: Install Go ${{ matrix.go }} | |
uses: actions/setup-go@v4 | |
with: | |
go-version: ${{ matrix.go }} | |
- uses: actions/download-artifact@v3 | |
with: | |
name: static | |
path: lib | |
- name: Run tests | |
run: go run gotest.tools/gotestsum@latest --junitfile unit-tests.xml --format pkgname -- ./... | |
- name: Test Summary | |
uses: test-summary/action@v2 | |
with: | |
paths: "unit-tests.xml" | |
if: always() | |
publish: | |
name: Publish rapidyenc build | |
runs-on: ubuntu-latest | |
needs: [test] | |
permissions: | |
# Give the default GITHUB_TOKEN write permission to commit and push the | |
# added or changed files to the repository. | |
contents: write | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
with: | |
ref: ${{ github.head_ref }} | |
- uses: actions/download-artifact@v3 | |
with: | |
name: static | |
- uses: stefanzweifel/git-auto-commit-action@v5 | |
with: | |
file_pattern: '*.a' | |
commit_message: Built rapidyenc |