From ad5b8f2c909e87c3780ea61f524b09ca90bde495 Mon Sep 17 00:00:00 2001 From: Anubhav Rawal Date: Thu, 14 Aug 2025 00:45:57 +0000 Subject: [PATCH 1/4] Add build artifact workflow --- .github/workflows/build-release.yml | 62 +++++++++++++++++++++++++++++ 1 file changed, 62 insertions(+) create mode 100644 .github/workflows/build-release.yml diff --git a/.github/workflows/build-release.yml b/.github/workflows/build-release.yml new file mode 100644 index 0000000..3e0852f --- /dev/null +++ b/.github/workflows/build-release.yml @@ -0,0 +1,62 @@ +name: Build and Package SystemLogForwarder + +on: + push: + branches: + - main + pull_request: + workflow_dispatch: + +jobs: + build: + name: Build ${{ matrix.arch }} + runs-on: ${{ matrix.runner }} + strategy: + fail-fast: false + matrix: + include: + - arch: x86_64 + runner: ubuntu-latest + - arch: arm64 + runner: ubuntu-24.04-arm + + steps: + - name: Checkout code + uses: actions/checkout@v4 + + - name: Install dependencies + run: | + sudo apt-get update + sudo apt-get install -y build-essential cmake pkg-config git libssl-dev + + - name: Set version + id: version + run: echo "VERSION=$(cat version)" >> $GITHUB_OUTPUT + + - name: Configure CMake + run: cmake -B build -DCMAKE_BUILD_TYPE=MinSizeRel -DGGL_LOG_LEVEL=INFO + + - name: Build + run: make -C build -j$(nproc) + + - name: Strip binary + run: strip build/bin/system-log-forwarder + + - name: Create package + run: | + mkdir -p ${{ github.workspace }}/zipfile + zip -9 ${{ github.workspace }}/zipfile/system-log-forwarder-${{ matrix.arch }}-${{ steps.version.outputs.VERSION }}.zip -j build/bin/system-log-forwarder + + - name: md5sums + run: | + md5sum ${{ github.workspace }}/zipfile/* + + - name: Upload artifact + uses: actions/upload-artifact@v4 + with: + name: + system-log-forwarder-${{ matrix.arch }}-${{ + steps.version.outputs.VERSION }} + path: | + ${{ github.workspace }}/zipfile/* + retention-days: 1 From bed41a468d271f7a51aa27648eeadc6b84a5321c Mon Sep 17 00:00:00 2001 From: Anubhav Rawal Date: Thu, 14 Aug 2025 00:51:38 +0000 Subject: [PATCH 2/4] Add libsystemd dependency --- .github/workflows/build-release.yml | 2 +- README.md | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build-release.yml b/.github/workflows/build-release.yml index 3e0852f..52da52a 100644 --- a/.github/workflows/build-release.yml +++ b/.github/workflows/build-release.yml @@ -27,7 +27,7 @@ jobs: - name: Install dependencies run: | sudo apt-get update - sudo apt-get install -y build-essential cmake pkg-config git libssl-dev + sudo apt-get install -y build-essential cmake pkg-config git libssl-dev libsystemd-dev - name: Set version id: version diff --git a/README.md b/README.md index 97253ff..f4d1a59 100644 --- a/README.md +++ b/README.md @@ -19,7 +19,7 @@ To build the project, you will need the following build dependencies: On Ubuntu, these can be installed with: ```sh -sudo apt update && sudo apt install build-essential pkg-config cmake git libssl-dev +sudo apt update && sudo apt install build-essential pkg-config cmake git libssl-dev libsystemd-dev ``` To make a release build configured for minimal size, run: From 170b02e096a5c99b3aa8d319bb719fc7c2741296 Mon Sep 17 00:00:00 2001 From: Anubhav Rawal Date: Thu, 14 Aug 2025 01:08:26 +0000 Subject: [PATCH 3/4] Add nix cross compile --- .github/workflows/build-podman.yml | 60 ++++++++++++++++++++++++++++++ 1 file changed, 60 insertions(+) create mode 100644 .github/workflows/build-podman.yml diff --git a/.github/workflows/build-podman.yml b/.github/workflows/build-podman.yml new file mode 100644 index 0000000..5e5ea31 --- /dev/null +++ b/.github/workflows/build-podman.yml @@ -0,0 +1,60 @@ +name: Build ARM64 with Podman + +on: + push: + branches: + - main + pull_request: + workflow_dispatch: + +jobs: + build: + name: Cross-compile to ARM64 + runs-on: ubuntu-latest + + steps: + - name: Checkout code + uses: actions/checkout@v4 + + - name: Set up QEMU + uses: docker/setup-qemu-action@v3 + with: + platforms: arm64 + + - name: Set up Podman + run: | + sudo apt-get update + sudo apt-get install -y podman + + - name: Set version + id: version + run: echo "VERSION=$(cat version)" >> $GITHUB_OUTPUT + + - name: Build ARM64 in container + run: | + podman run --rm -v $PWD:/workspace --platform linux/arm64 \ + ubuntu:24.04 bash -c " + cd /workspace && \ + apt-get update && \ + apt-get install -y build-essential cmake pkg-config git libssl-dev libsystemd-dev && \ + cmake -B build -DCMAKE_BUILD_TYPE=MinSizeRel -DGGL_LOG_LEVEL=INFO && \ + make -C build -j\$(nproc) && \ + strip build/bin/system-log-forwarder + " + + - name: Create package + run: | + mkdir -p ${{ github.workspace }}/zipfile + zip -9 ${{ github.workspace }}/zipfile/system-log-forwarder-arm64-${{ steps.version.outputs.VERSION }}.zip -j build/bin/system-log-forwarder + + - name: md5sums + run: | + md5sum ${{ github.workspace }}/zipfile/* + + - name: Upload artifact + uses: actions/upload-artifact@v4 + with: + name: system-log-forwarder-arm64-${{ steps.version.outputs.VERSION }} + path: | + ${{ github.workspace }}/zipfile/* + retention-days: 1 From 7e4c08e045fafa6ec59f42ee8dc6059389a87914 Mon Sep 17 00:00:00 2001 From: Anubhav Rawal Date: Thu, 14 Aug 2025 02:01:57 +0000 Subject: [PATCH 4/4] Fix double zipping --- .github/workflows/build-podman.yml | 6 +++--- .github/workflows/build-release.yml | 10 +++++----- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/.github/workflows/build-podman.yml b/.github/workflows/build-podman.yml index 5e5ea31..aad0def 100644 --- a/.github/workflows/build-podman.yml +++ b/.github/workflows/build-podman.yml @@ -42,10 +42,10 @@ jobs: strip build/bin/system-log-forwarder " - - name: Create package + - name: Save package run: | - mkdir -p ${{ github.workspace }}/zipfile - zip -9 ${{ github.workspace }}/zipfile/system-log-forwarder-arm64-${{ steps.version.outputs.VERSION }}.zip -j build/bin/system-log-forwarder + mkdir -p ${{ github.workspace }}/zipfile/ + cp build/bin/system-log-forwarder ${{ github.workspace }}/zipfile/ - name: md5sums run: | diff --git a/.github/workflows/build-release.yml b/.github/workflows/build-release.yml index 52da52a..6f8980f 100644 --- a/.github/workflows/build-release.yml +++ b/.github/workflows/build-release.yml @@ -17,8 +17,8 @@ jobs: include: - arch: x86_64 runner: ubuntu-latest - - arch: arm64 - runner: ubuntu-24.04-arm + # - arch: arm64 + # runner: ubuntu-24.04-arm steps: - name: Checkout code @@ -42,10 +42,10 @@ jobs: - name: Strip binary run: strip build/bin/system-log-forwarder - - name: Create package + - name: Save package run: | - mkdir -p ${{ github.workspace }}/zipfile - zip -9 ${{ github.workspace }}/zipfile/system-log-forwarder-${{ matrix.arch }}-${{ steps.version.outputs.VERSION }}.zip -j build/bin/system-log-forwarder + mkdir -p ${{ github.workspace }}/zipfile/ + cp build/bin/system-log-forwarder ${{ github.workspace }}/zipfile/ - name: md5sums run: |