Use build system libdir #65
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Meson Test | |
on: | |
push: | |
branches: [main] | |
paths: | |
- ".github/workflows/meson.yml" | |
- "VERSION" | |
- "meson.build" | |
- "meson_options.txt" | |
- "src/**" | |
- "tests/**" | |
pull_request: | |
branches: [main] | |
paths: | |
- ".github/workflows/meson.yml" | |
- "VERSION" | |
- "meson.build" | |
- "meson_options.txt" | |
- "src/**" | |
- "tests/**" | |
# Allows you to run this workflow manually from the Actions tab | |
workflow_dispatch: | |
jobs: | |
test: | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
cfg: | |
- { | |
id: ubuntu-gcc, | |
platform: ubuntu, | |
cc: gcc, | |
cpp: g++, | |
setup_options: "-Db_sanitize=address,undefined -Dunity=on -Dunity_size=12", | |
} | |
- { | |
id: ubuntu-clang, | |
platform: ubuntu, | |
cc: clang, | |
cpp: clang++, | |
setup_options: "-Dunity=on -Dunity_size=12", | |
} | |
- { | |
id: rockylinux-gcc, | |
platform: rockylinux, | |
cc: gcc, | |
cpp: g++, | |
setup_options: "-Dunity=on -Dunity_size=12", | |
} | |
- { | |
id: rockylinux-clang, | |
platform: rockylinux, | |
cc: clang, | |
cpp: clang++, | |
setup_options: "-Db_sanitize=address,undefined -Db_lundef=false -Dunity=on -Dunity_size=12", | |
} | |
steps: | |
- uses: actions/checkout@v2 | |
# GitHub runners have updated the Ubuntu Linux Kernel to use strong ASLR, | |
# but LLVM is not configured for this change, and thus the address | |
# sanitizer breaks. | |
# | |
# The next image is supposed to fix this, so if the Ubuntu image has been | |
# updated, this work around is no longer required. | |
- name: get runner image version | |
id: runner-image-version | |
run: | | |
echo "image-version=$(echo $ImageVersion)" >> "$GITHUB_OUTPUT" | |
working-directory: . | |
- name: modify number of bits to use for ASLR entropy | |
if: ${{ steps.runner-image-version.outputs.ImageVersion }} == '20240310.1.0' | |
run: | | |
sudo sysctl -a | grep vm.mmap.rnd | |
sudo sysctl -w vm.mmap_rnd_bits=28 | |
working-directory: . | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v3 | |
- name: Build and push | |
uses: docker/build-push-action@v5 | |
with: | |
context: . | |
push: false | |
load: true | |
tags: ${{ matrix.cfg.id }} | |
file: tests/docker/${{ matrix.cfg.platform }}.Dockerfile | |
cache-from: type=gha | |
cache-to: type=gha,mode=max | |
- name: Restore Compiler Cache | |
id: ccache-restore | |
uses: actions/cache/restore@v4 | |
with: | |
path: ${{ github.workspace }}/ccache | |
# This ensures that every run saves cache even on cache hit | |
key: ${{ matrix.cfg.id }}-ccache-${{ github.run_id }} | |
restore-keys: | | |
${{ matrix.cfg.id }}-ccache | |
- name: Start Docker container | |
run: | | |
mkdir -p ${{ github.workspace }}/ccache | |
docker run -d --name ${{ matrix.cfg.id }} \ | |
--mount=type=bind,source=${{ github.workspace }}/ccache,target=/ccache \ | |
--mount=type=bind,source=${{ github.workspace }},target=/workdir \ | |
${{ matrix.cfg.id }} sleep infinity | |
- name: Build cps-config | |
run: | | |
docker exec \ | |
-e CC="ccache ${{ matrix.cfg.cc }}" -e CXX="ccache ${{ matrix.cfg.cpp }}" \ | |
-e CCACHE_DIR="/ccache" \ | |
${{ matrix.cfg.id }} \ | |
bash -c "meson setup /workdir/builddir /workdir ${{ matrix.cfg.setup_options }} \ | |
&& ninja -C /workdir/builddir" | |
- name: Run Tests | |
run: | | |
docker exec ${{ matrix.cfg.id }} ninja -C /workdir/builddir test | |
- name: Stop Docker Container | |
run: | | |
docker stop ${{ matrix.cfg.id }} | |
- name: Save Cache | |
id: ccache-save | |
uses: actions/cache/save@v4 | |
with: | |
path: ${{ github.workspace }}/ccache | |
key: ${{ matrix.cfg.id }}-ccache-${{ github.run_id }} | |
macos: | |
runs-on: macos-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Brew Install | |
run: brew install pkg-config ninja cli11 googletest nlohmann-json fmt cmake meson tl-expected | |
- name: Build cps-config | |
run: | | |
meson setup builddir -Dunity=on -Dunity_size=12 | |
ninja -C builddir | |
- name: Run tests | |
run: meson test -C builddir |