From 2da97527cfba76ccfe40cf75f1c915a5aa93c7a3 Mon Sep 17 00:00:00 2001 From: Philip Wisniewski Date: Thu, 26 Feb 2026 21:31:10 -0500 Subject: [PATCH] CICD init --- .github/workflows/build-and-test.yml | 59 ++++++++++++++++++++++++++++ Dockerfile | 24 +++++++++++ 2 files changed, 83 insertions(+) create mode 100644 .github/workflows/build-and-test.yml create mode 100644 Dockerfile diff --git a/.github/workflows/build-and-test.yml b/.github/workflows/build-and-test.yml new file mode 100644 index 0000000..5253201 --- /dev/null +++ b/.github/workflows/build-and-test.yml @@ -0,0 +1,59 @@ +name: Build and Test + +on: + push: + branches: [ main ] + pull_request: + +jobs: + build: + runs-on: ubuntu-latest + + permissions: + contents: read + packages: write + + outputs: + image_tag: ${{ steps.meta.outputs.tag }} + + steps: + - uses: actions/checkout@v4 + + - name: Set image tag + id: meta + run: echo "tag=ghcr.io/${{ github.repository }}:${ github.sha }}" >> $GITHUB_OUTPUT + + - name: Log into GHCR + run: echo "${{ secrets.GITHUB_TOKEN }}" | \ + docker login ghcr.io -u ${{ gitub.actor }} --password-stdin + + - name: Build image + run: | + docker build image -t ${{ steps.meta.outputs.tag }} . + + - name: Push image + run: | + docker push ${{ steps.meta.outputs.tag }} + + test: + runs-on: ubuntu-latest + needs: build + + permissions: + contents: read + packages: read + + steps: + - name: Log into GHCR + run: echo "${{ secrets.GITHUB_TOKEN }}" | \ + docker login ghcr.io -u ${{ github.actor }} --password-stdin + + - name: Pull image + run: | + docker pull ghcr.io/${{ github.repository }}:${{ github.sha }} + + - name: Run tests + run: | + docker run --rm ghcr.io/${{ github.repository }}:${{ github.sha }} \ + ctest --output-on-failure + diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..9a13f05 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,24 @@ +FROM ubuntu:24.04 + +ENV DEBIAN_FRONTEND=noninteractive + +RUN apt-get update && apt-get install -y \ + build-essential \ + cmake \ + git \ + python3 \ + python3-pip \ + python3-dev + +RUN pip3 install pybind11 + +WORKDIR /app +COPY . . + +RUN cmake -S . -B build -DCMAKE_BUILD_TYPE=Release \ + && cmake --build build -j$(nproc) + +WORKDIR /app/build + +CMD ["ctest", "--output-on-failure"] +