Files
tomlplusplus/.github/workflows/ci.yaml
Mark Gillard 5eec04b951 added value type deduction to emplace() methods
also:
- minor CI work
2022-05-09 00:33:43 +03:00

165 lines
4.5 KiB
YAML

name: ci
on:
push:
branches:
- master
paths:
- '**.h'
- '**.hpp'
- '**.cpp'
- '**.inl'
- '**.py'
- '**/meson.build'
- '**/workflows/**.yaml'
pull_request:
branches:
- master
paths:
- '**.h'
- '**.hpp'
- '**.cpp'
- '**.inl'
- '**.py'
- '**/meson.build'
- '**/workflows/**.yaml'
workflow_dispatch:
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
linux:
strategy:
fail-fast: false
matrix:
compiler:
- 'clang++'
- 'g++'
linker:
- 'lld'
type:
- 'debug'
- 'release'
compile_library:
- 'true'
- 'false'
runs-on: ubuntu-latest
steps:
- name: Install dependencies
run: |
sudo apt -y update
if [ ${{ matrix.compiler }} = clang++ ]; then compiler=clang; else compiler=${{ matrix.compiler }}; fi
sudo apt -y install --no-install-recommends $compiler ${{ matrix.linker }} pkgconf git ca-certificates locales-all python3 python3-pip python3-setuptools python3-wheel ninja-build
sudo pip3 install --upgrade meson
- uses: actions/checkout@v3
- name: Check toml.hpp
run: |
sudo pip3 install --upgrade --requirement tools/requirements.txt
cd tools
python3 ci_single_header_check.py
- name: Configure Meson
run: |
CXX=${{ matrix.compiler }} CXX_LD=${{ matrix.linker }} meson setup build --buildtype=${{ matrix.type }} -Dcompile_library=${{ matrix.compile_library }} -Dpedantic=true -Dbuild_tests=true -Dbuild_examples=true -Dgenerate_cmake_config=false -Db_lto=false -Dubsan_examples=true -Dasan_examples=true
- name: Build
run: meson compile -C build --jobs -1
- name: Test
run: meson test -C build --verbose
windows:
strategy:
fail-fast: false
matrix:
type:
- 'debug'
- 'release'
compile_library:
- 'true'
# - 'false' # ... header-only mode takes far too long on github's windows runner
runs-on: windows-2022
defaults:
run:
shell: cmd
steps:
- name: Install dependencies
run: |
python3 -m pip install -U pip==21.3.1
pip3 install meson ninja
- uses: actions/checkout@v2
- uses: ilammy/msvc-dev-cmd@v1
- name: Configure Meson
run: meson setup --vsenv --buildtype=${{ matrix.type }} -Dcompile_library=${{ matrix.compile_library }} -Dpedantic=true -Dbuild_tests=true -Dbuild_examples=true -Dgenerate_cmake_config=false build
- name: Build
run: meson compile -C build --jobs -1
- name: Test
run: meson test -C build --verbose
tipi-build-linux:
name: tipi.build project build and dependency resolution
runs-on: ubuntu-latest
container: tipibuild/tipi-ubuntu
env:
HOME: /root
steps:
- uses: actions/checkout@v2
- run: mkdir -p ~/.tipi
# checking if the tomlplusplus project builds and passes tests
- name: Build as project target linux-cxx17 (run tests 'odr_test_1' and 'main')
run: tipi . --dont-upgrade --verbose -t linux-cxx17 --test "odr_test_1|main"
- name: Build as project target linux-cxx20 (run tests 'odr_test_1' and 'main')
run: tipi . --dont-upgrade --verbose -t linux-cxx20 --test "odr_test_1|main"
- name: Cleanup project builds
run: rm -r ./build
- name: "Get branch name and save to env"
env:
IS_PR: ${{ github.EVENT_NAME == 'pull_request' }}
run: |
if ${IS_PR}; then
BRANCH_NAME="${GITHUB_HEAD_REF}"
else
BRANCH_NAME="${GITHUB_REF##*/}"
fi
echo "BRANCH_NAME=${BRANCH_NAME}" >> $GITHUB_ENV
# trying if pulling the dependency with tipi works properly
- name: Build as dependency
run: |
cd examples/
# create test directory and copy the simple_parser.cpp in there
mkdir test-as-dep
cp examples.h test-as-dep/.
cp simple_parser.cpp test-as-dep/.
cd test-as-dep/
# create a deps file referencing the commit that triggered this build as dependency
mkdir .tipi
echo '{ "requires": { "${{ github.event.repository.full_name }}": { "@": "${{ env.BRANCH_NAME }}" } } }' > .tipi/deps
# build
tipi . --dont-upgrade --verbose -t linux-cxx17
./build/linux-cxx17/bin/simple_parser ../example.toml