-
-
Notifications
You must be signed in to change notification settings - Fork 149
191 lines (165 loc) · 6.07 KB
/
ci.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
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:
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
env:
clang_version: "14"
gcc_version: "11"
jobs:
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: |
cd tools
python3 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=c++ 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
# runs-on: ubuntu-latest
# if: github.ref == 'refs/heads/master'
# container: tipibuild/tipi-ubuntu
#
# env:
# HOME: /root
#
# steps:
# - uses: actions/checkout@v3
# - 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