Skip to content

Commit

Permalink
build system overhaul
Browse files Browse the repository at this point in the history
Fixes #185
Fixes #186
  • Loading branch information
marzer committed Jan 22, 2023
1 parent 698285d commit cb1d6d7
Show file tree
Hide file tree
Showing 17 changed files with 825 additions and 1,313 deletions.
278 changes: 133 additions & 145 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
@@ -1,155 +1,143 @@
name: ci

on:
push:
branches-ignore:
- 'gh-pages'
paths:
- '**.h'
- '**.hpp'
- '**.cpp'
- '**.inl'
- '**.py'
- '**/meson.build'
- '**/workflows/**.yaml'
pull_request:
branches-ignore:
- 'gh-pages'
paths:
- '**.h'
- '**.hpp'
- '**.cpp'
- '**.inl'
- '**.py'
- '**/meson.build'
- '**/workflows/**.yaml'
workflow_dispatch:
push:
branches-ignore:
- "gh-pages"
paths:
- "**.h"
- "**.hpp"
- "**.cpp"
- "**.inl"
- "**.py"
- "**/meson.build"
- "**/workflows/**.yaml"
pull_request:
branches-ignore:
- "gh-pages"
paths:
- "**.h"
- "**.hpp"
- "**.cpp"
- "**.inl"
- "**.py"
- "**/meson.build"
- "**/workflows/**.yaml"
workflow_dispatch:

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

env:
clang_version: '14'
gcc_version: '11'
clang_version: "14"
gcc_version: "11"

jobs:
linux:
strategy:
fail-fast: false
matrix:
compiler:
- 'clang++'
- 'g++'
linker:
- 'lld'
type:
- 'debug'
- 'release'
compile_library:
- 'true'
- 'false'

runs-on: ubuntu-latest

defaults:
run:
shell: bash

steps:
- name: Install base dependencies
run: |
sudo apt -y update
sudo apt -y install --no-install-recommends git python3 python3-pip ninja-build locales-all
sudo -H pip3 install --no-cache-dir --upgrade meson
- uses: actions/checkout@v3

- name: Check toml.hpp
run: |
cd tools
sudo -H pip3 install --upgrade --requirement ./requirements.txt
python3 ci_single_header_check.py
- name: Update LLVM package repository
if: ${{ startsWith(matrix.compiler, 'clang') || startsWith(matrix.linker, 'lld') }}
run: |
sudo apt -y install --no-install-recommends software-properties-common wget
wget -O - https://apt.llvm.org/llvm-snapshot.gpg.key | sudo apt-key add -
codename=$(lsb_release -sc)
sudo add-apt-repository --yes --no-update "deb http://apt.llvm.org/${codename}/ llvm-toolchain-${codename}-${{ env.clang_version }} main"
sudo apt -y update
- name: Install clang
if: ${{ startsWith(matrix.compiler, 'clang') }}
run: |
sudo apt -y install --no-install-recommends clang-${{ env.clang_version }}
sudo update-alternatives --install /usr/bin/clang++ clang++ /usr/bin/clang++-${{ env.clang_version }} 1000
- name: Install g++
if: ${{ startsWith(matrix.compiler, 'g++') }}
run: |
sudo apt -y install --no-install-recommends g++-${{ env.gcc_version }}
sudo update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-${{ env.gcc_version }} 1000
- name: Install lld
if: ${{ startsWith(matrix.linker, 'lld') }}
run: |
sudo apt -y install --no-install-recommends lld-${{ env.clang_version }}
sudo update-alternatives --install /usr/bin/ld.lld ld.lld /usr/bin/ld.lld-${{ env.clang_version }} 1000
- name: Configure locales
run: |
sudo locale-gen 'en_US.utf8' 'ja_JP.utf8' 'de_DE.utf8' 'it_IT.utf8' 'tr_TR.utf8' 'fi_FI.utf8' 'fr_FR.utf8' 'zh_CN.utf8'
- 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
pip3 install meson ninja
- uses: actions/checkout@v3

- 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

linux:
strategy:
fail-fast: false
matrix:
compiler:
- "clang"
- "gcc"
linker:
- "lld"
type:
- "debug"
- "release"

runs-on: ubuntu-latest

defaults:
run:
shell: bash

steps:
- name: Install base dependencies
run: |
sudo apt -y update
sudo apt -y install --no-install-recommends git python3 python3-pip ninja-build libstdc++-${{ env.gcc_version }}-dev locales-all
- uses: actions/checkout@v3

- name: Install python dependencies
run: |
sudo -H pip3 install --no-cache-dir --upgrade meson
sudo -H pip3 install --no-cache-dir --upgrade -r tools/requirements.txt
- name: Check toml.hpp
run: |
python3 ./tools/ci_single_header_check.py
- name: Install lld
if: ${{ startsWith(matrix.linker, 'lld') }}
run: |
sudo apt -y install --no-install-recommends lld-${{ env.clang_version }}
sudo update-alternatives --install /usr/bin/ld.lld ld.lld /usr/bin/ld.lld-${{ env.clang_version }} 1000
- name: Install clang
if: ${{ startsWith(matrix.compiler, 'clang') }}
run: |
sudo apt -y install --no-install-recommends clang-${{ env.clang_version }}
sudo update-alternatives --install /usr/bin/c++ c++ /usr/bin/clang++-${{ env.clang_version }} 1000
sudo update-alternatives --install /usr/bin/cc cc /usr/bin/clang-${{ env.clang_version }} 1000
- name: Install gcc
if: ${{ startsWith(matrix.compiler, 'gcc') }}
run: |
sudo apt -y install --no-install-recommends gcc-${{ env.gcc_version }} g++-${{ env.gcc_version }}
sudo update-alternatives --install /usr/bin/c++ c++ /usr/bin/g++-${{ env.gcc_version }} 1000
sudo update-alternatives --install /usr/bin/cc cc /usr/bin/gcc-${{ env.gcc_version }} 1000
- name: Configure locales
run: |
sudo locale-gen 'en_US.utf8' 'ja_JP.utf8' 'de_DE.utf8' 'it_IT.utf8' 'tr_TR.utf8' 'fi_FI.utf8' 'fr_FR.utf8' 'zh_CN.utf8'
- name: Configure Meson
run: |
CXX=${{ matrix.compiler }} CXX_LD=${{ matrix.linker }} meson setup build --buildtype=${{ matrix.type }} -Ddevel=true -Db_lto=false
- name: Build
run: meson compile -C build

- name: Test
run: meson test -C build --verbose

windows:
strategy:
fail-fast: false
matrix:
type:
- "debug"
- "release"

runs-on: windows-2022

defaults:
run:
shell: cmd

steps:
- name: Install dependencies
run: |
python3 -m pip install -U pip
pip3 install meson ninja
- uses: actions/checkout@v3

- uses: ilammy/msvc-dev-cmd@v1

- name: Configure Meson
run: meson setup build --vsenv --buildtype=${{ matrix.type }} -Ddevel=true -Db_lto=false

- name: Build
run: meson compile -C build

- name: Test
run: meson test -C build --verbose
# tipi-build-linux:
# name: tipi.build project build and dependency resolution
# name: tipi.build project build and dependency resolution
# runs-on: ubuntu-latest
# if: github.ref == 'refs/heads/master'
# container: tipibuild/tipi-ubuntu
Expand All @@ -167,7 +155,7 @@ jobs:
#
# - 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
#
Expand All @@ -181,12 +169,12 @@ jobs:
# 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/.
Expand Down
Loading

0 comments on commit cb1d6d7

Please sign in to comment.