-
Notifications
You must be signed in to change notification settings - Fork 66
144 lines (123 loc) · 5.27 KB
/
stlab.yml
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
name: Build and Tests
on:
pull_request:
push:
branches:
- main
jobs:
generate-matrix:
name: Generate job matrix
runs-on: ubuntu-22.04
outputs:
matrix: ${{ steps.set-matrix.outputs.matrix }}
steps:
- uses: actions/checkout@v2
- name: Generate job matrix
id: set-matrix
# Note: The json in this variable must be a single line for parsing to succeed.
run: echo "::set-output name=matrix::$(cat .github/matrix.json | scripts/flatten_json.py)"
builds:
needs: generate-matrix
runs-on: ${{ matrix.config.os }}
strategy:
fail-fast: false
matrix: ${{fromJson(needs.generate-matrix.outputs.matrix)}}
name: ${{ matrix.config.name }}
steps:
- uses: actions/checkout@v2
- name: Install dependencies // macOS
if: ${{ startsWith(matrix.config.os, 'macos') }}
run: |
brew update
brew install boost
brew install ninja
shell: bash
- name: Install dependencies // Linux (GCC|Clang)
if: ${{ startsWith(matrix.config.os, 'ubuntu') && !startsWith(matrix.config.compiler, 'emscripten') }}
run: |
sudo apt-get update
sudo apt-get install -y ninja-build
sudo apt-get install -y libboost-all-dev
shell: bash
- name: Install dependencies // Windows
if: ${{ startsWith(matrix.config.os, 'windows') }}
run: |
choco install --yes ninja
vcpkg install boost-test:x64-windows boost-multiprecision:x64-windows boost-variant:x64-windows
shell: cmd
- name: Install dependencies // Linux Emscripten
if: ${{ startsWith(matrix.config.compiler, 'emscripten') }}
shell: bash
run: |
sudo apt-get update
sudo apt-get install -y ninja-build
git clone --depth 1 --recurse-submodules --shallow-submodules --jobs=8 https://github.com/boostorg/boost.git $HOME/boost
git clone --depth 1 https://github.com/emscripten-core/emsdk.git $HOME/emsdk
pushd $HOME/emsdk
./emsdk install latest
./emsdk activate latest
echo 'source "$HOME/emsdk/emsdk_env.sh"' >> $HOME/.bash_profile
# Override Emsdk's bundled node (14.18.2) to the GH Actions system installation (>= 16.16.0)
sed -i "/^NODE_JS = .*/c\NODE_JS = '`which node`'" .emscripten
echo "Overwrote .emscripten config file to:"
cat .emscripten
popd
- name: Set enviroment variables // Linux GCC
if: ${{ matrix.config.compiler == 'gcc' }}
shell: bash
run: |
echo "CC=gcc-${{matrix.config.version}}" >> $GITHUB_ENV
echo "CXX=g++-${{matrix.config.version}}" >> $GITHUB_ENV
- name: Set enviroment variables // Linux Clang
if: ${{ matrix.config.compiler == 'clang' }}
shell: bash
run: |
echo "CC=clang-${{matrix.config.version}}" >> $GITHUB_ENV
echo "CXX=clang++-${{matrix.config.version}}" >> $GITHUB_ENV
- name: Compile Boost // Emscripten
if: ${{ startsWith(matrix.config.compiler, 'emscripten') }}
shell: bash -l {0}
run: |
mkdir -p ../build-boost
cmake -S $HOME/boost -B ../build-boost -GNinja -DCMAKE_BUILD_TYPE=Release -DCMAKE_CXX_STANDARD=23 \
-DCMAKE_CXX_FLAGS="-Wno-deprecated-builtins" \
-DCMAKE_TOOLCHAIN_FILE=$GITHUB_WORKSPACE/cmake/Platform/Emscripten-STLab.cmake \
-DBOOST_INCLUDE_LIBRARIES="optional;variant;multiprecision;test"
cmake --build ../build-boost
cmake --install ../build-boost
- name: Configure // Unix !Emscripten
if: ${{ (startsWith(matrix.config.os, 'ubuntu') || startsWith(matrix.config.os, 'macos')) && !startsWith(matrix.config.compiler, 'emscripten') }}
shell: bash
run: |
mkdir ../build
cmake -S. -B../build -GNinja -DCMAKE_BUILD_TYPE=Release -DCMAKE_CXX_STANDARD=23
- name: Configure // Linux Emscripten
if: ${{ startsWith(matrix.config.compiler, 'emscripten') }}
shell: bash -l {0}
run: |
mkdir ../build
cmake -S. -B../build -GNinja -DCMAKE_BUILD_TYPE=Release -DCMAKE_CXX_STANDARD=23 \
-DCMAKE_TOOLCHAIN_FILE=$GITHUB_WORKSPACE/cmake/Platform/Emscripten-STLab.cmake
- name: Configure // Windows
if: ${{ startsWith(matrix.config.os, 'windows') }}
shell: cmd
run: |
call "C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\VC\Auxiliary\Build\vcvarsall.bat" x64
mkdir ..\build
cmake -S. -B../build -GNinja -DCMAKE_BUILD_TYPE=Release -DCMAKE_CXX_STANDARD=23 -DCMAKE_TOOLCHAIN_FILE=C:/vcpkg/scripts/buildsystems/vcpkg.cmake
- name: Build // Unix
if: ${{ startsWith(matrix.config.os, 'ubuntu') || startsWith(matrix.config.os, 'macos') }}
shell: bash
run: |
cmake --build ../build/
- name: Build // Windows
if: ${{ startsWith(matrix.config.os, 'windows') }}
shell: cmd
run: |
call "C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\VC\Auxiliary\Build\vcvarsall.bat" x64
cmake --build ../build/
- name: Test
shell: bash
run: |
cd ../build/
ctest --output-on-failure