From 83f4a683cd5704a604e3a2433c5b9831eddb75b2 Mon Sep 17 00:00:00 2001 From: Timo Behrendt Date: Sat, 27 Dec 2025 12:40:15 +0100 Subject: [PATCH] ci: add simple test pipeline (#5) Reviewed-on: https://gitea.t000-n.de/t.behrendt/UsbMakroBoard/pulls/5 Co-authored-by: Timo Behrendt Co-committed-by: Timo Behrendt --- .gitea/workflows/cd.yaml | 86 ++++++++++++++++++++++++++++++++++++++++ .gitea/workflows/ci.yaml | 24 +++++++++++ 2 files changed, 110 insertions(+) create mode 100644 .gitea/workflows/cd.yaml create mode 100644 .gitea/workflows/ci.yaml diff --git a/.gitea/workflows/cd.yaml b/.gitea/workflows/cd.yaml new file mode 100644 index 0000000..29e6ebb --- /dev/null +++ b/.gitea/workflows/cd.yaml @@ -0,0 +1,86 @@ +name: CD + +on: + push: + branches: + - main + paths: + - "src/**" + - "CMakeLists.txt" + - "schemas/**" + workflow_dispatch: + +jobs: + build: + strategy: + matrix: + include: + - runner: linux_amd64 + arch: amd64 + artifact_name: usbmakroboard-amd64 + - runner: linux_arm64 + arch: arm64 + artifact_name: usbmakroboard-arm64 + runs-on: + - ubuntu-latest + - ${{ matrix.runner }} + steps: + - uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6 + with: + fetch-depth: 0 + - run: | + sudo apt-get update + sudo apt-get install -y build-essential cmake zip + - name: Build + run: | + mkdir -p build + cd build + cmake .. + cmake --build . + - run: | + test -f build/usbmakroboard && echo "Binary built successfully" || exit 1 + - run: | + cd build + zip usbmakroboard-linux-${{ matrix.arch }}.zip usbmakroboard + - run: | + cd build + sha256sum usbmakroboard-linux-${{ matrix.arch }}.zip > usbmakroboard-linux-${{ matrix.arch }}.zip.sha256 + - name: Upload artifacts + uses: ChristopherHX/gitea-upload-artifact@v4 + with: + name: ${{ matrix.artifact_name }} + path: | + build/usbmakroboard-linux-${{ matrix.arch }}.zip + build/usbmakroboard-linux-${{ matrix.arch }}.zip.sha256 + retention-days: 1 + + release: + needs: build + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6 + with: + fetch-depth: 0 + - uses: https://gitea.t000-n.de/t.behrendt/conventional-semantic-git-tag-increment@0.1.22 + id: tag + with: + token: ${{ secrets.GITEA_TOKEN }} + prerelease: ${{ github.event_name == 'workflow_dispatch' }} + - uses: https://gitea.t000-n.de/t.behrendt/actions/release-git-tag@0.1.0 + with: + tag: ${{ steps.tag.outputs.new-tag }} + - uses: ChristopherHX/gitea-download-artifact@v4 + with: + path: artifacts + - name: Create release + uses: akkuman/gitea-release-action@v1 + with: + tag_name: ${{ steps.tag.outputs.new-tag }} + name: ${{ steps.tag.outputs.new-tag }} + files: | + artifacts/usbmakroboard-amd64/usbmakroboard-linux-amd64.zip + artifacts/usbmakroboard-amd64/usbmakroboard-linux-amd64.zip.sha256 + artifacts/usbmakroboard-arm64/usbmakroboard-linux-arm64.zip + artifacts/usbmakroboard-arm64/usbmakroboard-linux-arm64.zip.sha256 + prerelease: ${{ github.event_name == 'workflow_dispatch' }} + token: ${{ secrets.GITHUB_TOKEN }} diff --git a/.gitea/workflows/ci.yaml b/.gitea/workflows/ci.yaml new file mode 100644 index 0000000..3110c82 --- /dev/null +++ b/.gitea/workflows/ci.yaml @@ -0,0 +1,24 @@ +name: CI + +on: + pull_request: + +jobs: + build: + runs-on: + - ubuntu-latest + - linux_amd64 + steps: + - uses: actions/checkout@v4 + - run: | + sudo apt-get update + sudo apt-get install -y build-essential cmake + - name: Configure and build + run: | + mkdir -p build + cd build + cmake .. + cmake --build . + - name: Verify binary + run: | + test -f build/usbmakroboard && echo "Binary built successfully" || exit 1