Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
59 changes: 59 additions & 0 deletions .github/workflows/build-and-test.yml
Original file line number Diff line number Diff line change
@@ -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

24 changes: 24 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -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"]