Skip to content

Commit a7d1e41

Browse files
committed
change github actions to list of configurations for easier maintenance
1 parent 815e5a6 commit a7d1e41

File tree

1 file changed

+56
-20
lines changed

1 file changed

+56
-20
lines changed

.github/workflows/cmake.yml

Lines changed: 56 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -12,28 +12,64 @@ jobs:
1212
# well on Windows or Mac. You can convert this to a matrix build if you need
1313
# cross-platform coverage.
1414
# See: https://docs.github.com/en/actions/configuring-and-managing-workflows/configuring-a-workflow#configuring-a-build-matrix
15-
runs-on: ubuntu-20.04
15+
name: ${{ matrix.config.name }}
16+
runs-on: ${{ matrix.config.os }}
1617

1718
strategy:
1819
fail-fast: false
1920
matrix:
20-
compiler: [g++-10, clang]
21-
include:
22-
- compiler: clang
23-
cxx_flags: -stdlib=libc++
24-
# TODO figure out why this is not set automatically
25-
exe_linker_flags: -lc++
26-
- compiler: g++-10
27-
install: 'g++-10'
21+
config:
22+
- {
23+
name: "Linux g++ 10.2",
24+
os: ubuntu-20.04,
25+
cxx: "g++-10",
26+
}
27+
- {
28+
name: "Linux clang-10",
29+
os: ubuntu-20.04,
30+
cxx: "clang++-10",
31+
cxx_flags: -stdlib=libc++,
32+
exe_linker_flags: -lc++,
33+
}
34+
- {
35+
name: "Linux clang-11",
36+
os: ubuntu-20.04,
37+
cxx: "clang++-11",
38+
cxx_flags: -stdlib=libc++,
39+
exe_linker_flags: -lc++,
40+
}
2841

2942
steps:
3043
- uses: actions/checkout@v2
3144

32-
- name: Install ppa
33-
run: sudo add-apt-repository ppa:ubuntu-toolchain-r/ppa
45+
- name: Install Clang 10
46+
id: install_clang_10
47+
if: startsWith(matrix.config.os, 'ubuntu') && ( matrix.config.cxx == 'clang++-10' )
48+
shell: bash
49+
working-directory: ${{ env.HOME }}
50+
run: |
51+
wget https://apt.llvm.org/llvm.sh
52+
chmod +x llvm.sh
53+
sudo ./llvm.sh 10
3454
35-
- name: Install dependencies
36-
run: sudo apt-get install ${{ matrix.install }}
55+
- name: Install Clang 11
56+
id: install_clang_11
57+
if: startsWith(matrix.config.os, 'ubuntu') && ( matrix.config.cxx == 'clang++-11' )
58+
shell: bash
59+
working-directory: ${{ env.HOME }}
60+
run: |
61+
wget https://apt.llvm.org/llvm.sh
62+
chmod +x llvm.sh
63+
sudo ./llvm.sh 11
64+
65+
- name: Install g++ 10
66+
id: install_gcc_10
67+
if: startsWith(matrix.config.os, 'ubuntu') && ( matrix.config.cxx == 'g++-10' )
68+
shell: bash
69+
working-directory: ${{ env.HOME }}
70+
run: |
71+
sudo add-apt-repository ppa:ubuntu-toolchain-r/ppa
72+
sudo apt-get install g++-10
3773
3874
- name: Create Build Environment
3975
# Some projects don't allow in-source building, so create a separate build directory
@@ -45,16 +81,16 @@ jobs:
4581
# access regardless of the host operating system
4682
shell: bash
4783
working-directory: ${{runner.workspace}}/build
48-
env:
49-
CXX: ${{ matrix.compiler }}
50-
# Note the current convention is to use the -S and -B options here to specify source
51-
# and build directories, but this is only available with CMake 3.13 and higher.
84+
env:
85+
CXX: ${{ matrix.config.cxx }}
86+
# Note the current convention is to use the -S and -B options here to specify source
87+
# and build directories, but this is only available with CMake 3.13 and higher.
5288
# The CMake binaries on the Github Actions machines are (as of this writing) 3.12
5389
run: |
54-
cmake ${{runner.workspace}} \
90+
cmake $GITHUB_WORKSPACE \
5591
-DCMAKE_BUILD_TYPE=$BUILD_TYPE \
56-
-DCMAKE_CXX_FLAGS=${{ matrix.cxx_flags }} \
57-
-DCMAKE_EXE_LINKER_FLAGS=${{ matrix.exe_linker_flags }} \
92+
-DCMAKE_CXX_FLAGS=${{ matrix.config.cxx_flags }} \
93+
-DCMAKE_EXE_LINKER_FLAGS=${{ matrix.config.exe_linker_flags }} \
5894
-DCMAKE_VERBOSE_MAKEFILE=ON
5995
6096
- name: Build

0 commit comments

Comments
 (0)