From 2a5c0a0b4d44b530e63d35daf7f0d27c7ef856cb Mon Sep 17 00:00:00 2001 From: Duncan Tourolle Date: Fri, 8 May 2026 18:00:03 +0200 Subject: [PATCH] Add build infra --- .gitea/workflows/builder.yaml | 25 +++++++++++++ .gitea/workflows/test.yaml | 68 +++++++++++++++++++++++++++++++++++ Dockerfile.builder | 18 ++++++++++ 3 files changed, 111 insertions(+) create mode 100644 .gitea/workflows/builder.yaml create mode 100644 .gitea/workflows/test.yaml create mode 100644 Dockerfile.builder diff --git a/.gitea/workflows/builder.yaml b/.gitea/workflows/builder.yaml new file mode 100644 index 0000000..dc2e872 --- /dev/null +++ b/.gitea/workflows/builder.yaml @@ -0,0 +1,25 @@ +name: '🐳 Build Builder Image' + +on: + push: + branches: + - master + paths: + - 'Dockerfile.builder' + workflow_dispatch: + +jobs: + build-and-push: + runs-on: linux/amd64 + steps: + - name: Checkout repository + uses: actions/checkout@v4 + + - name: Log in to Gitea registry + run: echo "${{ secrets.REGISTRY_PASSWORD }}" | docker login gitea.tourolle.paris -u "${{ secrets.REGISTRY_USER }}" --password-stdin + + - name: Build image + run: docker build -f Dockerfile.builder -t gitea.tourolle.paris/dtourolle/kpnpp-builder:latest . + + - name: Push image + run: docker push gitea.tourolle.paris/dtourolle/kpnpp-builder:latest diff --git a/.gitea/workflows/test.yaml b/.gitea/workflows/test.yaml new file mode 100644 index 0000000..a371806 --- /dev/null +++ b/.gitea/workflows/test.yaml @@ -0,0 +1,68 @@ +name: '🧪 Test' + +on: + push: + branches: + - master + - develop + paths-ignore: + - '**/*.md' + pull_request: + branches: + - master + - develop + paths-ignore: + - '**/*.md' + workflow_dispatch: + +jobs: + test: + runs-on: linux/amd64 + container: + image: gitea.tourolle.paris/dtourolle/kpnpp-builder:latest + + steps: + - name: Checkout repository + uses: actions/checkout@v4 + with: + path: test-${{ github.run_id }} + + - name: Cache FetchContent dependencies + uses: actions/cache@v3 + with: + path: ~/.cmake/fetchcontent + key: cmake-fetchcontent-${{ hashFiles('**/CMakeLists.txt') }} + restore-keys: cmake-fetchcontent- + + - name: Configure + working-directory: test-${{ github.run_id }} + run: | + cmake -S . -B build \ + -G Ninja \ + -DCMAKE_BUILD_TYPE=Debug \ + -DKPN_BUILD_TESTS=ON \ + -DKPN_BUILD_EXAMPLES=OFF \ + -DKPN_BUILD_PYTHON=ON \ + -DFETCHCONTENT_BASE_DIR=$HOME/.cmake/fetchcontent + + - name: Build + working-directory: test-${{ github.run_id }} + run: cmake --build build --parallel + + - name: Run tests + working-directory: test-${{ github.run_id }} + run: | + cd build + ctest --output-on-failure --output-junit test-results.xml + + - name: Upload test results + if: always() + uses: actions/upload-artifact@v3 + with: + name: test-results + path: test-${{ github.run_id }}/build/test-results.xml + retention-days: 7 + + - name: Cleanup + if: always() + run: rm -rf test-${{ github.run_id }} diff --git a/Dockerfile.builder b/Dockerfile.builder new file mode 100644 index 0000000..e1aed4e --- /dev/null +++ b/Dockerfile.builder @@ -0,0 +1,18 @@ +# KPN++ Builder Image +# Pre-built image with GCC, CMake, Ninja, and Python dev headers for building and testing KPN++ +# Build: docker build -f Dockerfile.builder -t gitea.tourolle.paris/dtourolle/kpnpp-builder:latest . +# Push: docker push gitea.tourolle.paris/dtourolle/kpnpp-builder:latest + +FROM gcc:14 + +RUN apt-get update && apt-get install -y --no-install-recommends \ + cmake \ + ninja-build \ + python3 \ + python3-dev \ + python3-pip \ + git \ + ca-certificates \ + && rm -rf /var/lib/apt/lists/* + +WORKDIR /src