commit e50871c2969199f18b9ca8b0e5ae8198af80f94c
parent 1ea8f9d276fd616b593629fe1d65d7ca7e6af389
Author: Robin Bron <robin.bron@yourhosting.nl>
Date: Sun, 1 Mar 2026 14:10:32 +0100
Add workflows to auto-test and auto-build
Diffstat:
4 files changed, 135 insertions(+), 1 deletion(-)
diff --git a/.github/FUNDING.yml b/.github/FUNDING.yml
@@ -0,0 +1,3 @@
+# f4d2ed80-57b6-46e6-b245-5049428a931d
+github: finwo
+liberapay: finwo
diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml
@@ -0,0 +1,106 @@
+---
+
+name: Build
+on:
+ push:
+ tags:
+ - '*'
+
+jobs:
+ version:
+ name: Extract version
+ runs-on: ubuntu-latest
+ outputs:
+ version: ${{ steps.version.outputs.version }}
+ steps:
+ - name: Extract version
+ id: version
+ run: echo "version=${GITHUB_REF#refs/tags/v}" >> $GITHUB_OUTPUT
+
+ build:
+ name: Build ${{ matrix.name }}
+ runs-on: ${{ matrix.runs-on }}
+ needs: version
+ strategy:
+ matrix:
+ include:
+ - name: linux-amd64
+ runs-on: ubuntu-latest
+ bin: udphole-core-linux-amd64
+ cross: false
+
+ - name: linux-arm64
+ runs-on: ubuntu-latest
+ bin: udphole-core-linux-arm64
+ cross: true
+ arch: aarch64
+
+ - name: linux-armv7
+ runs-on: ubuntu-latest
+ bin: udphole-core-linux-armv7
+ cross: true
+ arch: armv7
+
+ - name: linux-riscv64
+ runs-on: ubuntu-latest
+ bin: udphole-core-linux-riscv64
+ cross: true
+ arch: riscv64
+
+ # - name: windows-amd64
+ # runs-on: windows-latest
+ # bin: udphole-core-windows-amd64.exe
+ # cross: false
+
+ - name: darwin-arm64
+ runs-on: macos-latest
+ bin: udphole-core-darwin-arm64
+ cross: false
+
+ steps:
+ - uses: actions/checkout@v4
+
+ - if: matrix.runs-on == 'windows-latest'
+ name: Add mingw64 to PATH
+ shell: bash
+ run: |
+ echo "/c/msys64/mingw64/bin" >> $GITHUB_PATH
+
+ - uses: finwo/dep@main
+ name: Install dep
+
+ - name: Install dependencies
+ shell: bash
+ run: cd core && dep install
+
+ - if: matrix.cross
+ uses: uraimo/run-on-arch-action@v2
+ name: Build
+ with:
+ arch: ${{ matrix.arch }}
+ distro: ubuntu_latest
+ githubToken: ${{ github.token }}
+ install: |
+ apt-get update -y
+ apt-get install -yq build-essential
+ run: |
+ cd core
+ make -j udphole VERSION=${{ needs.version.outputs.version }}
+ mv udphole ${{ matrix.bin }}
+
+ - if: '!matrix.cross'
+ name: Build
+ shell: bash
+ run: |
+ cd core
+ make -j udphole VERSION=${{ needs.version.outputs.version }}
+ mv udphole ${{ matrix.bin }}
+
+ - name: Upload to release
+ uses: svenstaro/upload-release-action@v2
+ with:
+ repo_token: ${{ secrets.GITHUB_TOKEN }}
+ file: core/${{ matrix.bin }}
+ file_glob: false
+ overwrite: true
+ tag: ${{ github.ref }}
diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml
@@ -0,0 +1,25 @@
+---
+
+name: Test
+on:
+ push:
+ branches:
+ - main
+
+jobs:
+ test:
+ name: Test
+ runs-on: ubuntu-latest
+ steps:
+ - uses: actions/checkout@v4
+
+ - uses: finwo/dep@main
+ name: Install dep
+
+ - name: Install dependencies
+ shell: bash
+ run: cd core && dep install
+
+ - name: Run tests
+ shell: bash
+ run: cd core && make test
diff --git a/Makefile b/Makefile
@@ -95,7 +95,7 @@ doc/license.man: LICENSE.md
pandoc LICENSE.md -f markdown -t man --standalone=false -o doc/license.man
$(BIN).1: doc/udphole.1.in doc/cli_doc.man doc/license.man
- VERSION=$(VERSION) envsubst '$$VERSION' < doc/upbx.1.in | sed '/__COMMANDS_MAN__/r doc/cli_doc.man' | sed '/__COMMANDS_MAN__/d' | sed '/__LICENSE_MAN__/r doc/license.man' | sed '/__LICENSE_MAN__/d' > $(BIN).1
+ VERSION=$(VERSION) envsubst '$$VERSION' < doc/udphole.1.in | sed '/__COMMANDS_MAN__/r doc/cli_doc.man' | sed '/__COMMANDS_MAN__/d' | sed '/__LICENSE_MAN__/r doc/license.man' | sed '/__LICENSE_MAN__/d' > $(BIN).1
# .cc.o:
# $(CPP) $< $(CPPFLAGS) -c -o $@