ci: add packing job

This commit is contained in:
Konstantin Lampalzer 2024-09-23 13:34:34 +02:00
parent 1791063fa8
commit 3836d1480b
6 changed files with 72 additions and 44 deletions

View file

@ -1,2 +1,2 @@
.github
ci
ci/Dockerfile

View file

@ -1,38 +0,0 @@
name: Build and test
on:
push:
branches: ['master']
pull_request:
env:
BUILD_TYPE: Release
jobs:
build:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-20.04, ubuntu-22.04]
steps:
- name: Install dependencies
run: |
sudo apt install build-essential cmake git libboost-system-dev libboost-thread-dev
git clone https://github.com/google/googletest.git
cd googletest
cmake CMakeLists.txt
make
sudo make install
- uses: actions/checkout@v2
- name: Configure CMake
run: cmake -B ${{github.workspace}}/build -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} -DCMAKE_CXX_FLAGS="-Werror"
- name: Build
run: cmake --build ${{github.workspace}}/build --config ${{env.BUILD_TYPE}}
- name: Test
working-directory: ${{github.workspace}}/build
run: ctest -C ${{env.BUILD_TYPE}}

29
.github/workflows/package.yaml vendored Normal file
View file

@ -0,0 +1,29 @@
name: Package
on:
push:
jobs:
package:
runs-on: ubuntu-24.04
strategy:
matrix:
platform: [linux/arm64/v8]
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
with:
platforms: linux/arm64
- name: Prepare container
run: docker buildx build -f ci/Dockerfile . -t libcreate --platform ${{ matrix.platform }} --load
- name: Build
run: docker run --platform ${{ matrix.platform }} -v ./output:/libcreate/_packages libcreate

30
.github/workflows/test.yaml vendored Normal file
View file

@ -0,0 +1,30 @@
name: Build and test
on:
push:
branches: ["master"]
pull_request:
env:
BUILD_TYPE: Release
jobs:
test:
runs-on: ubuntu-24.04
steps:
- name: Install dependencies
run: |
sudo apt install build-essential cmake git libboost-system-dev libboost-thread-dev file libgtest-dev googletest
- uses: actions/checkout@v4
- name: Configure CMake
run: cmake -B ${{github.workspace}}/build -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} -DCMAKE_CXX_FLAGS="-Werror"
- name: Build
run: cmake --build ${{github.workspace}}/build --config ${{env.BUILD_TYPE}}
- name: Test
working-directory: ${{github.workspace}}/build
run: ctest -C ${{env.BUILD_TYPE}}

View file

@ -2,7 +2,7 @@ FROM ubuntu:24.04
RUN apt update && \
apt install -y \
build-essential cmake file \
build-essential cmake git file \
libboost-system-dev libboost-thread-dev \
libgtest-dev googletest && \
rm -rf /var/lib/apt/lists/*
@ -11,7 +11,4 @@ WORKDIR /libcreate
COPY . .
WORKDIR /libcreate/build
RUN cmake -B /libcreate/build -S /libcreate -DCMAKE_BUILD_TYPE=Release -DCMAKE_CXX_FLAGS="-Werror" && \
cmake --build /libcreate/build --config Release && \
ctest -C Release --output-on-failure && \
cpack --build /libcreate/build -G DEB
ENTRYPOINT ["/bin/bash", "/libcreate/ci/entrypoint.sh"]

10
ci/entrypoint.sh Executable file
View file

@ -0,0 +1,10 @@
#!/usr/bin/env bash
set -o errexit
set -o nounset
set -o pipefail
cmake -B /libcreate/build -S /libcreate -DCMAKE_BUILD_TYPE=Release -DCMAKE_CXX_FLAGS='-Werror'
cmake --build /libcreate/build --config Release
ctest -C Release --output-on-failure
cpack --build /libcreate/build -G DEB