Add build infra
Some checks failed
🧪 Test / test (push) Failing after 1s
🐳 Build Builder Image / build-and-push (push) Failing after 1s

This commit is contained in:
Duncan Tourolle 2026-05-08 18:00:03 +02:00
parent 5e77dc836b
commit 2a5c0a0b4d
3 changed files with 111 additions and 0 deletions

View File

@ -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

View File

@ -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 }}

18
Dockerfile.builder Normal file
View File

@ -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