From 285cff68deafc4bbb27cef5b9a02db71abb34662 Mon Sep 17 00:00:00 2001 From: Andreas Buhr Date: Tue, 6 Oct 2020 20:19:58 +0200 Subject: [PATCH 01/13] Create cmake.yml Create a first github action to create a CMake based build --- .github/workflows/cmake.yml | 46 +++++++++++++++++++++++++++++++++++++ 1 file changed, 46 insertions(+) create mode 100644 .github/workflows/cmake.yml diff --git a/.github/workflows/cmake.yml b/.github/workflows/cmake.yml new file mode 100644 index 00000000..dae54ec2 --- /dev/null +++ b/.github/workflows/cmake.yml @@ -0,0 +1,46 @@ +name: CMake + +on: [push] + +env: + # Customize the CMake build type here (Release, Debug, RelWithDebInfo, etc.) + BUILD_TYPE: Release + +jobs: + build: + # The CMake configure and build commands are platform agnostic and should work equally + # well on Windows or Mac. You can convert this to a matrix build if you need + # cross-platform coverage. + # See: https://docs.github.com/en/actions/configuring-and-managing-workflows/configuring-a-workflow#configuring-a-build-matrix + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v2 + + - name: Create Build Environment + # Some projects don't allow in-source building, so create a separate build directory + # We'll use this as our working directory for all subsequent commands + run: cmake -E make_directory ${{runner.workspace}}/build + + - name: Configure CMake + # Use a bash shell so we can use the same syntax for environment variable + # access regardless of the host operating system + shell: bash + working-directory: ${{runner.workspace}}/build + # Note the current convention is to use the -S and -B options here to specify source + # and build directories, but this is only available with CMake 3.13 and higher. + # The CMake binaries on the Github Actions machines are (as of this writing) 3.12 + run: cmake $GITHUB_WORKSPACE -DCMAKE_BUILD_TYPE=$BUILD_TYPE + + - name: Build + working-directory: ${{runner.workspace}}/build + shell: bash + # Execute the build. You can specify a specific target with "--target " + run: cmake --build . --config $BUILD_TYPE + + - name: Test + working-directory: ${{runner.workspace}}/build + shell: bash + # Execute tests defined by the CMake configuration. + # See https://cmake.org/cmake/help/latest/manual/ctest.1.html for more detail + run: ctest -C $BUILD_TYPE From 9454276a7c1c3f44571a101f23dcb7bf4f909279 Mon Sep 17 00:00:00 2001 From: Andreas Buhr Date: Tue, 6 Oct 2020 21:54:34 +0200 Subject: [PATCH 02/13] use newer compiler, g++-10 and clang --- .github/workflows/cmake.yml | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/.github/workflows/cmake.yml b/.github/workflows/cmake.yml index dae54ec2..6a131f88 100644 --- a/.github/workflows/cmake.yml +++ b/.github/workflows/cmake.yml @@ -6,6 +6,10 @@ env: # Customize the CMake build type here (Release, Debug, RelWithDebInfo, etc.) BUILD_TYPE: Release +strategy: + matrix: + compiler: [g++-10, clang] + jobs: build: # The CMake configure and build commands are platform agnostic and should work equally @@ -27,6 +31,8 @@ jobs: # access regardless of the host operating system shell: bash working-directory: ${{runner.workspace}}/build + env: + CC: ${{ matrix.compiler }} # Note the current convention is to use the -S and -B options here to specify source # and build directories, but this is only available with CMake 3.13 and higher. # The CMake binaries on the Github Actions machines are (as of this writing) 3.12 From eee11a2ce94c8431d70cb1d43b5296d59ad272b2 Mon Sep 17 00:00:00 2001 From: Andreas Buhr Date: Tue, 6 Oct 2020 21:58:50 +0200 Subject: [PATCH 03/13] fix github-actions job file --- .github/workflows/cmake.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/cmake.yml b/.github/workflows/cmake.yml index 6a131f88..a2593d02 100644 --- a/.github/workflows/cmake.yml +++ b/.github/workflows/cmake.yml @@ -6,10 +6,6 @@ env: # Customize the CMake build type here (Release, Debug, RelWithDebInfo, etc.) BUILD_TYPE: Release -strategy: - matrix: - compiler: [g++-10, clang] - jobs: build: # The CMake configure and build commands are platform agnostic and should work equally @@ -18,6 +14,10 @@ jobs: # See: https://docs.github.com/en/actions/configuring-and-managing-workflows/configuring-a-workflow#configuring-a-build-matrix runs-on: ubuntu-latest + strategy: + matrix: + compiler: [g++-10, clang] + steps: - uses: actions/checkout@v2 From b21ea58caacb6d7eb16ab6d48840ad2c45f63e4f Mon Sep 17 00:00:00 2001 From: Andreas Buhr Date: Tue, 6 Oct 2020 22:07:13 +0200 Subject: [PATCH 04/13] fix compiler env --- .github/workflows/cmake.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/cmake.yml b/.github/workflows/cmake.yml index a2593d02..7748de98 100644 --- a/.github/workflows/cmake.yml +++ b/.github/workflows/cmake.yml @@ -32,7 +32,7 @@ jobs: shell: bash working-directory: ${{runner.workspace}}/build env: - CC: ${{ matrix.compiler }} + CXX: ${{ matrix.compiler }} # Note the current convention is to use the -S and -B options here to specify source # and build directories, but this is only available with CMake 3.13 and higher. # The CMake binaries on the Github Actions machines are (as of this writing) 3.12 From a6d95ad569af8ef47735c30de7ff54034f2af678 Mon Sep 17 00:00:00 2001 From: Andreas Buhr Date: Tue, 6 Oct 2020 22:19:03 +0200 Subject: [PATCH 05/13] install dependencies --- .github/workflows/cmake.yml | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/.github/workflows/cmake.yml b/.github/workflows/cmake.yml index 7748de98..5f0cac04 100644 --- a/.github/workflows/cmake.yml +++ b/.github/workflows/cmake.yml @@ -12,7 +12,7 @@ jobs: # well on Windows or Mac. You can convert this to a matrix build if you need # cross-platform coverage. # See: https://docs.github.com/en/actions/configuring-and-managing-workflows/configuring-a-workflow#configuring-a-build-matrix - runs-on: ubuntu-latest + runs-on: ubuntu-20.04 strategy: matrix: @@ -21,6 +21,12 @@ jobs: steps: - uses: actions/checkout@v2 + - name: Install ppa + run: sudo add-apt-repository ppa:ubuntu-toolchain-r/ppa + + - name: Install dependencies + run: sudo apt-get install g++-10 + - name: Create Build Environment # Some projects don't allow in-source building, so create a separate build directory # We'll use this as our working directory for all subsequent commands From 3a7438d63294cf050c72e22271cb3ac107d38d15 Mon Sep 17 00:00:00 2001 From: Andreas Buhr Date: Tue, 6 Oct 2020 23:58:32 +0200 Subject: [PATCH 06/13] disable fail-fast for github actions --- .github/workflows/cmake.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/cmake.yml b/.github/workflows/cmake.yml index 5f0cac04..2ab93b89 100644 --- a/.github/workflows/cmake.yml +++ b/.github/workflows/cmake.yml @@ -15,6 +15,7 @@ jobs: runs-on: ubuntu-20.04 strategy: + fail-fast: false matrix: compiler: [g++-10, clang] From 1e3ce8bcf2a297e8e9a3397ad7fa625835fb6334 Mon Sep 17 00:00:00 2001 From: Sylvain Garcia Date: Tue, 13 Oct 2020 01:51:53 +0200 Subject: [PATCH 07/13] fix workflow with clang - enforcing -lc++ linker flag - verbose compile commands - output on test failure --- .github/workflows/cmake.yml | 26 +++++++++++++++++++------- 1 file changed, 19 insertions(+), 7 deletions(-) diff --git a/.github/workflows/cmake.yml b/.github/workflows/cmake.yml index 2ab93b89..cb044634 100644 --- a/.github/workflows/cmake.yml +++ b/.github/workflows/cmake.yml @@ -1,6 +1,6 @@ name: CMake -on: [push] +on: [push, pull_request] env: # Customize the CMake build type here (Release, Debug, RelWithDebInfo, etc.) @@ -18,6 +18,13 @@ jobs: fail-fast: false matrix: compiler: [g++-10, clang] + include: + - compiler: clang + cxx_flags: -stdlib=libc++ + # TODO figure out why this is not set automatically + exe_linker_flags: -lc++ + - compiler: g++-10 + install: 'g++-10' steps: - uses: actions/checkout@v2 @@ -26,7 +33,7 @@ jobs: run: sudo add-apt-repository ppa:ubuntu-toolchain-r/ppa - name: Install dependencies - run: sudo apt-get install g++-10 + run: sudo apt-get install ${{ matrix.install }} - name: Create Build Environment # Some projects don't allow in-source building, so create a separate build directory @@ -38,12 +45,17 @@ jobs: # access regardless of the host operating system shell: bash working-directory: ${{runner.workspace}}/build - env: + env: CXX: ${{ matrix.compiler }} - # Note the current convention is to use the -S and -B options here to specify source - # and build directories, but this is only available with CMake 3.13 and higher. + # Note the current convention is to use the -S and -B options here to specify source + # and build directories, but this is only available with CMake 3.13 and higher. # The CMake binaries on the Github Actions machines are (as of this writing) 3.12 - run: cmake $GITHUB_WORKSPACE -DCMAKE_BUILD_TYPE=$BUILD_TYPE + run: | + cmake ${{runner.workspace}} \ + -DCMAKE_BUILD_TYPE=$BUILD_TYPE \ + -DCMAKE_CXX_FLAGS=${{ matrix.cxx_flags }} \ + -DCMAKE_EXE_LINKER_FLAGS=${{ matrix.exe_linker_flags }} \ + -DCMAKE_VERBOSE_MAKEFILE=ON - name: Build working-directory: ${{runner.workspace}}/build @@ -56,4 +68,4 @@ jobs: shell: bash # Execute tests defined by the CMake configuration. # See https://cmake.org/cmake/help/latest/manual/ctest.1.html for more detail - run: ctest -C $BUILD_TYPE + run: ctest --output-on-failure -C $BUILD_TYPE From a7d1e41eaf13d593c739857d0e09f3cc8843d108 Mon Sep 17 00:00:00 2001 From: Andreas Buhr Date: Tue, 13 Oct 2020 00:28:06 +0200 Subject: [PATCH 08/13] change github actions to list of configurations for easier maintenance --- .github/workflows/cmake.yml | 76 +++++++++++++++++++++++++++---------- 1 file changed, 56 insertions(+), 20 deletions(-) diff --git a/.github/workflows/cmake.yml b/.github/workflows/cmake.yml index cb044634..249257c8 100644 --- a/.github/workflows/cmake.yml +++ b/.github/workflows/cmake.yml @@ -12,28 +12,64 @@ jobs: # well on Windows or Mac. You can convert this to a matrix build if you need # cross-platform coverage. # See: https://docs.github.com/en/actions/configuring-and-managing-workflows/configuring-a-workflow#configuring-a-build-matrix - runs-on: ubuntu-20.04 + name: ${{ matrix.config.name }} + runs-on: ${{ matrix.config.os }} strategy: fail-fast: false matrix: - compiler: [g++-10, clang] - include: - - compiler: clang - cxx_flags: -stdlib=libc++ - # TODO figure out why this is not set automatically - exe_linker_flags: -lc++ - - compiler: g++-10 - install: 'g++-10' + config: + - { + name: "Linux g++ 10.2", + os: ubuntu-20.04, + cxx: "g++-10", + } + - { + name: "Linux clang-10", + os: ubuntu-20.04, + cxx: "clang++-10", + cxx_flags: -stdlib=libc++, + exe_linker_flags: -lc++, + } + - { + name: "Linux clang-11", + os: ubuntu-20.04, + cxx: "clang++-11", + cxx_flags: -stdlib=libc++, + exe_linker_flags: -lc++, + } steps: - uses: actions/checkout@v2 - - name: Install ppa - run: sudo add-apt-repository ppa:ubuntu-toolchain-r/ppa + - name: Install Clang 10 + id: install_clang_10 + if: startsWith(matrix.config.os, 'ubuntu') && ( matrix.config.cxx == 'clang++-10' ) + shell: bash + working-directory: ${{ env.HOME }} + run: | + wget https://apt.llvm.org/llvm.sh + chmod +x llvm.sh + sudo ./llvm.sh 10 - - name: Install dependencies - run: sudo apt-get install ${{ matrix.install }} + - name: Install Clang 11 + id: install_clang_11 + if: startsWith(matrix.config.os, 'ubuntu') && ( matrix.config.cxx == 'clang++-11' ) + shell: bash + working-directory: ${{ env.HOME }} + run: | + wget https://apt.llvm.org/llvm.sh + chmod +x llvm.sh + sudo ./llvm.sh 11 + + - name: Install g++ 10 + id: install_gcc_10 + if: startsWith(matrix.config.os, 'ubuntu') && ( matrix.config.cxx == 'g++-10' ) + shell: bash + working-directory: ${{ env.HOME }} + run: | + sudo add-apt-repository ppa:ubuntu-toolchain-r/ppa + sudo apt-get install g++-10 - name: Create Build Environment # Some projects don't allow in-source building, so create a separate build directory @@ -45,16 +81,16 @@ jobs: # access regardless of the host operating system shell: bash working-directory: ${{runner.workspace}}/build - env: - CXX: ${{ matrix.compiler }} - # Note the current convention is to use the -S and -B options here to specify source - # and build directories, but this is only available with CMake 3.13 and higher. + env: + CXX: ${{ matrix.config.cxx }} + # Note the current convention is to use the -S and -B options here to specify source + # and build directories, but this is only available with CMake 3.13 and higher. # The CMake binaries on the Github Actions machines are (as of this writing) 3.12 run: | - cmake ${{runner.workspace}} \ + cmake $GITHUB_WORKSPACE \ -DCMAKE_BUILD_TYPE=$BUILD_TYPE \ - -DCMAKE_CXX_FLAGS=${{ matrix.cxx_flags }} \ - -DCMAKE_EXE_LINKER_FLAGS=${{ matrix.exe_linker_flags }} \ + -DCMAKE_CXX_FLAGS=${{ matrix.config.cxx_flags }} \ + -DCMAKE_EXE_LINKER_FLAGS=${{ matrix.config.exe_linker_flags }} \ -DCMAKE_VERBOSE_MAKEFILE=ON - name: Build From 1942d69102d41da678f7b918dae85aff2eacbd54 Mon Sep 17 00:00:00 2001 From: Andreas Buhr Date: Tue, 13 Oct 2020 00:28:06 +0200 Subject: [PATCH 09/13] change github actions to list of configurations for easier maintenance --- .github/workflows/cmake.yml | 78 +++++++++++++++++++++++++++---------- 1 file changed, 58 insertions(+), 20 deletions(-) diff --git a/.github/workflows/cmake.yml b/.github/workflows/cmake.yml index cb044634..2090382b 100644 --- a/.github/workflows/cmake.yml +++ b/.github/workflows/cmake.yml @@ -12,28 +12,66 @@ jobs: # well on Windows or Mac. You can convert this to a matrix build if you need # cross-platform coverage. # See: https://docs.github.com/en/actions/configuring-and-managing-workflows/configuring-a-workflow#configuring-a-build-matrix - runs-on: ubuntu-20.04 + name: ${{ matrix.config.name }} + runs-on: ${{ matrix.config.os }} strategy: fail-fast: false matrix: - compiler: [g++-10, clang] - include: - - compiler: clang - cxx_flags: -stdlib=libc++ - # TODO figure out why this is not set automatically - exe_linker_flags: -lc++ - - compiler: g++-10 - install: 'g++-10' + config: + - { + name: "Linux g++ 10.2", + os: ubuntu-20.04, + cxx: "g++-10", + } + - { + name: "Linux clang-10", + os: ubuntu-20.04, + cxx: "clang++-10", + cxx_flags: -stdlib=libc++, + exe_linker_flags: -lc++, + } + - { + name: "Linux clang-11", + os: ubuntu-20.04, + cxx: "clang++-11", + cxx_flags: -stdlib=libc++, + exe_linker_flags: -lc++, + } steps: - uses: actions/checkout@v2 - - name: Install ppa - run: sudo add-apt-repository ppa:ubuntu-toolchain-r/ppa + - name: Install Clang 10 + id: install_clang_10 + if: startsWith(matrix.config.os, 'ubuntu') && ( matrix.config.cxx == 'clang++-10' ) + shell: bash + working-directory: ${{ env.HOME }} + run: | + wget https://apt.llvm.org/llvm.sh + chmod +x llvm.sh + sudo ./llvm.sh 10 + sudo apt-get install libc++-10-dev libc++abi-10-dev - - name: Install dependencies - run: sudo apt-get install ${{ matrix.install }} + - name: Install Clang 11 + id: install_clang_11 + if: startsWith(matrix.config.os, 'ubuntu') && ( matrix.config.cxx == 'clang++-11' ) + shell: bash + working-directory: ${{ env.HOME }} + run: | + wget https://apt.llvm.org/llvm.sh + chmod +x llvm.sh + sudo ./llvm.sh 11 + sudo apt-get install libc++-11-dev libc++abi-11-dev + + - name: Install g++ 10 + id: install_gcc_10 + if: startsWith(matrix.config.os, 'ubuntu') && ( matrix.config.cxx == 'g++-10' ) + shell: bash + working-directory: ${{ env.HOME }} + run: | + sudo add-apt-repository ppa:ubuntu-toolchain-r/ppa + sudo apt-get install g++-10 - name: Create Build Environment # Some projects don't allow in-source building, so create a separate build directory @@ -45,16 +83,16 @@ jobs: # access regardless of the host operating system shell: bash working-directory: ${{runner.workspace}}/build - env: - CXX: ${{ matrix.compiler }} - # Note the current convention is to use the -S and -B options here to specify source - # and build directories, but this is only available with CMake 3.13 and higher. + env: + CXX: ${{ matrix.config.cxx }} + # Note the current convention is to use the -S and -B options here to specify source + # and build directories, but this is only available with CMake 3.13 and higher. # The CMake binaries on the Github Actions machines are (as of this writing) 3.12 run: | - cmake ${{runner.workspace}} \ + cmake $GITHUB_WORKSPACE \ -DCMAKE_BUILD_TYPE=$BUILD_TYPE \ - -DCMAKE_CXX_FLAGS=${{ matrix.cxx_flags }} \ - -DCMAKE_EXE_LINKER_FLAGS=${{ matrix.exe_linker_flags }} \ + -DCMAKE_CXX_FLAGS=${{ matrix.config.cxx_flags }} \ + -DCMAKE_EXE_LINKER_FLAGS=${{ matrix.config.exe_linker_flags }} \ -DCMAKE_VERBOSE_MAKEFILE=ON - name: Build From 413f8d7f73d1cc7d3b80b41cb4d28e874af8c092 Mon Sep 17 00:00:00 2001 From: Andreas Buhr Date: Wed, 21 Oct 2020 20:43:44 +0200 Subject: [PATCH 10/13] Select C++20 support on the command line --- .github/workflows/cmake.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/cmake.yml b/.github/workflows/cmake.yml index 2090382b..a568ca24 100644 --- a/.github/workflows/cmake.yml +++ b/.github/workflows/cmake.yml @@ -91,6 +91,7 @@ jobs: run: | cmake $GITHUB_WORKSPACE \ -DCMAKE_BUILD_TYPE=$BUILD_TYPE \ + -DCMAKE_CXX_STANDARD=20 \ -DCMAKE_CXX_FLAGS=${{ matrix.config.cxx_flags }} \ -DCMAKE_EXE_LINKER_FLAGS=${{ matrix.config.exe_linker_flags }} \ -DCMAKE_VERBOSE_MAKEFILE=ON From 805217d342fd395f669dbc83d391094c5923077e Mon Sep 17 00:00:00 2001 From: Sylvain Garcia Date: Thu, 22 Oct 2020 19:23:35 +0200 Subject: [PATCH 11/13] add MSVC 2019 x64 build --- .github/workflows/cmake.yml | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/.github/workflows/cmake.yml b/.github/workflows/cmake.yml index a568ca24..9d03f784 100644 --- a/.github/workflows/cmake.yml +++ b/.github/workflows/cmake.yml @@ -38,6 +38,12 @@ jobs: cxx_flags: -stdlib=libc++, exe_linker_flags: -lc++, } + - { + name: "Windows MSVC 2019 (x64)", + os: windows-latest, + cxx: "cl", + environment_script: "C:/Program Files (x86)/Microsoft Visual Studio/2019/Enterprise/VC/Auxiliary/Build/vcvars64.bat", + } steps: - uses: actions/checkout@v2 @@ -89,6 +95,9 @@ jobs: # and build directories, but this is only available with CMake 3.13 and higher. # The CMake binaries on the Github Actions machines are (as of this writing) 3.12 run: | + # run environment setup script if any + [ -n "${{ matrix.config.environment_script }}" ] && "${{ matrix.config.environment_script }}" + cmake $GITHUB_WORKSPACE \ -DCMAKE_BUILD_TYPE=$BUILD_TYPE \ -DCMAKE_CXX_STANDARD=20 \ From 26a57b477e9f160f0dd39c2d05c21046bd4afc3a Mon Sep 17 00:00:00 2001 From: Sylvain Garcia Date: Fri, 23 Oct 2020 08:32:09 +0200 Subject: [PATCH 12/13] build testing --- .github/workflows/cmake.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/cmake.yml b/.github/workflows/cmake.yml index 9d03f784..9fab8c35 100644 --- a/.github/workflows/cmake.yml +++ b/.github/workflows/cmake.yml @@ -101,6 +101,7 @@ jobs: cmake $GITHUB_WORKSPACE \ -DCMAKE_BUILD_TYPE=$BUILD_TYPE \ -DCMAKE_CXX_STANDARD=20 \ + -DBUILD_TESTING=ON \ -DCMAKE_CXX_FLAGS=${{ matrix.config.cxx_flags }} \ -DCMAKE_EXE_LINKER_FLAGS=${{ matrix.config.exe_linker_flags }} \ -DCMAKE_VERBOSE_MAKEFILE=ON From e2af832352e543bf882573f77330ead112c2af05 Mon Sep 17 00:00:00 2001 From: Andreas Buhr Date: Sun, 1 Nov 2020 12:06:56 +0100 Subject: [PATCH 13/13] add MSVC 2017 to github actions --- .github/workflows/cmake.yml | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/.github/workflows/cmake.yml b/.github/workflows/cmake.yml index 9fab8c35..67668b0c 100644 --- a/.github/workflows/cmake.yml +++ b/.github/workflows/cmake.yml @@ -38,6 +38,12 @@ jobs: cxx_flags: -stdlib=libc++, exe_linker_flags: -lc++, } + - { + name: "Windows MSVC 2017 (x64)", + os: windows-2016, + cxx: "cl", + environment_script: "C:/Program Files (x86)/Microsoft Visual Studio/2017/Enterprise/VC/Auxiliary/Build/vcvars64.bat", + } - { name: "Windows MSVC 2019 (x64)", os: windows-latest,