diff options
author | Egor Tensin <Egor.Tensin@gmail.com> | 2021-01-17 13:54:57 +0300 |
---|---|---|
committer | Egor Tensin <Egor.Tensin@gmail.com> | 2021-01-17 13:54:57 +0300 |
commit | dd2c5b58c4fe77d7ce35f3abb6e1bb399560a2db (patch) | |
tree | 813808b873a5895d7f212f890c68ff14820dc591 /.github/workflows/boost_toolsets.yml | |
parent | Travis/AppVeyor: pause (diff) | |
download | cmake-common-dd2c5b58c4fe77d7ce35f3abb6e1bb399560a2db.tar.gz cmake-common-dd2c5b58c4fe77d7ce35f3abb6e1bb399560a2db.zip |
GIANT CLUSTERFUCK OF A COMMIT
OK, this is epic. I was basically just trying to a) support Clang and
b) add more test coverage. _THREE MONTHS_ and a few hundred CI runs
later, this is what I came up with. I don't know how it ended up being
what it is, but here we go.
Some highlights of the changes:
1) CI builds has been moved to GitHub Actions,
2) the entire notion of a toolchain has been reworked; it now supports
Clang on all platforms.
* .github: this directory contains the GitHub Actions workflow
scripts/actions. In the process, I created like 6 external GitHub
actions, but it's still pretty massive. An upside is that it covers
much more platform/toolchain combinations _and_ check a lot of the
expected post-conditions. TODO: .ci/Makefile is obsolete now, as well
as .travis.yml and .appveyor.yml.
* common.cmake: added Clang support. In the process, a great deal has
been learned about how CMake works; in particular, static runtime
support has been reworked to be more robust.
* project: the entire notion of a "toolchain" has been reworked.
Instead of a measly --mingw parameter, there's now a separate --toolset
parameter, which allows you to choose between GCC, Clang, MSVC, etc.
Both Boost and CMake build scripts were enhanced greatly to support
Clang and other toolchains in a more robust way.
Diffstat (limited to '.github/workflows/boost_toolsets.yml')
-rw-r--r-- | .github/workflows/boost_toolsets.yml | 222 |
1 files changed, 222 insertions, 0 deletions
diff --git a/.github/workflows/boost_toolsets.yml b/.github/workflows/boost_toolsets.yml new file mode 100644 index 0000000..1319264 --- /dev/null +++ b/.github/workflows/boost_toolsets.yml @@ -0,0 +1,222 @@ +name: Boost (toolsets) + +on: + push: + pull_request: + schedule: + # Weekly, at 5:30 AM on Saturday (somewhat randomly chosen). + - cron: '30 5 * * 6' + workflow_dispatch: + +jobs: + build: + strategy: + fail-fast: false + matrix: + boost-version: [1.58.0, 1.65.0, 1.72.0] + toolset: [auto, clang, clang-cl, gcc, mingw, msvc] + cygwin: [0, 1] + os: [ubuntu-18.04, windows-2016, windows-2019] + + include: + # Prettier run names. + - {os: windows-2019, name: VS 2019} + - {os: windows-2016, name: VS 2017} + - {os: ubuntu-18.04, name: Ubuntu} + - {cygwin: 1, name: Cygwin} + # Target platform. + - {boost-version: 1.58.0, platform: x64} + - {boost-version: 1.65.0, platform: x86} + - {boost-version: 1.72.0, platform: x64} + # Configuration. + - {boost-version: 1.58.0, configuration: Debug} + - {boost-version: 1.65.0, configuration: MinSizeRel} + - {boost-version: 1.72.0, configuration: Release} + + # Some Boost libraries commonly used by me. + - libraries: filesystem program_options regex system test + # On Windows, clang fails to build Boost.Test prior to version 1.61 + # with the following error: + # + # .\boost/test/impl/execution_monitor.ipp:1134:20: error: cannot compile this 'this' captured by SEH yet + # + # This was fixed for 1.61 in this commit: + # https://github.com/boostorg/test/commit/c94ef6982e2ebe77f9376579547c228f0d62e45f. + # On Linux/Cygwin, everything should be fine though. + - toolset: clang + boost-version: 1.58.0 + os: windows-2019 + libraries: filesystem program_options regex system + - toolset: clang + boost-version: 1.58.0 + os: windows-2016 + libraries: filesystem program_options regex system + exclude: + # Ubuntu: no MSVC/clang-cl/Cygwin. + - {os: ubuntu-18.04, toolset: msvc} + - {os: ubuntu-18.04, toolset: clang-cl} + - {os: ubuntu-18.04, cygwin: 1} + # Cygwin: no MSVC/clang-cl. + - {cygwin: 1, toolset: msvc} + - {cygwin: 1, toolset: clang-cl} + # Cygwin is the same on Windows Server 2016 & 2019. + - {os: windows-2016, cygwin: 1} + # clang-cl is only supported by Boost.Build since 1.69 (see the + # boost_clang_windows.yml workflow). + - {toolset: clang-cl, boost-version: 1.58.0} + - {toolset: clang-cl, boost-version: 1.65.0} + + runs-on: '${{ matrix.os }}' + + name: '${{ matrix.boost-version }} / ${{ matrix.toolset }} / ${{ matrix.name }}' + + # 1) I have no idea why, but GCC 10.2 fails to build Boost.Filesystem with + # the following errors: + # + # libs\filesystem\src\path.cpp:36:11: fatal error: windows_file_codecvt.hpp: No such file or directory + # 36 | # include "windows_file_codecvt.hpp" + # | ^~~~~~~~~~~~~~~~~~~~~~~~~~ + # compilation terminated. + # libs\filesystem\src\windows_file_codecvt.cpp:25:10: fatal error: windows_file_codecvt.hpp: No such file or directory + # 25 | #include "windows_file_codecvt.hpp" + # | ^~~~~~~~~~~~~~~~~~~~~~~~~~ + # compilation terminated. + # + # This seems to be a compiler bug, since the file is _definitely_ there, + # and Clang 8.0.1 builds it successfully. This only applies to Boost + # versions up to and including 1.60.0 for some reason. I can easily + # reproduce this locally. TODO: remove when GCC on Cygwin is treated + # with a bugfix to this? + # + # 2) 32-bit Cygwin fucking sucks. In many ways actually, but the real + # reason was the incomprehensible + # + # undefined reference to `__chkstk_ms' + # + # error when building with Clang. + continue-on-error: ${{ + (matrix.cygwin == '1' && matrix.boost-version == '1.58.0' + && (matrix.toolset == 'auto' + || matrix.toolset == 'gcc' + || matrix.toolset == 'mingw')) + || (matrix.cygwin == '1' && matrix.platform == 'x86') + }} + + defaults: + run: + shell: pwsh + + steps: + - name: Checkout + uses: actions/checkout@v2 + + - name: Clean up PATH + uses: egor-tensin/cleanup-path@v1 + if: runner.os == 'Windows' + + - name: Set common variables + uses: ./.github/actions/common-variables + with: + toolset: '${{ matrix.toolset }}' + cygwin: '${{ matrix.cygwin }}' + + - name: Set up Python + uses: actions/setup-python@v2 + with: + python-version: '3.x' + if: '!env.CI_HOST_CYGWIN' + + - name: Install Cygwin + uses: egor-tensin/setup-cygwin@v3 + with: + platform: '${{ matrix.platform }}' + packages: cmake make python3 + hardlinks: 1 + if: env.CI_HOST_CYGWIN + + - name: Install GCC + uses: egor-tensin/setup-gcc@v1 + with: + cygwin: '${{ matrix.cygwin }}' + platform: '${{ matrix.platform }}' + hardlinks: 1 + if: env.CI_HOST_CYGWIN || (env.CI_HOST_LINUX && (matrix.toolset == 'auto' || matrix.toolset == 'gcc')) + + - name: Install Clang + uses: egor-tensin/setup-clang@v1 + with: + cygwin: '${{ matrix.cygwin }}' + platform: '${{ matrix.platform }}' + hardlinks: 1 + if: matrix.toolset == 'clang' || matrix.toolset == 'clang-cl' + + - name: Install MinGW + uses: egor-tensin/setup-mingw@v2 + with: + cygwin: '${{ matrix.cygwin }}' + platform: '${{ matrix.platform }}' + hardlinks: 1 + # toolset == 'clang' needs some kind of make, e.g. mingw32-make: + if: env.CI_MINGW || (matrix.toolset == 'clang' && env.CI_HOST_WINDOWS) + + - name: Set up software environment + uses: ./.github/actions/software-environment + with: + toolset: '${{ matrix.toolset }}' + platform: '${{ matrix.platform }}' + + - name: Set up Visual Studio + uses: egor-tensin/vs-shell@v2 + with: + arch: '${{ matrix.platform }}' + if: matrix.toolset == 'clang-cl' && env.CI_HOST_WINDOWS + + - name: Download Boost + uses: ./.github/actions/download-boost + with: + boost-version: '${{ matrix.boost-version }}' + + - name: Build Boost + uses: ./.github/actions/build-boost + with: + toolset: '${{ matrix.toolset }}' + libraries: '${{ matrix.libraries }}' + platform: '${{ matrix.platform }}' + configuration: '${{ matrix.configuration }}' + continue-on-error: true + + - name: Check that Boost was bootstrapped + uses: ./.github/actions/check-boost-bootstrapped + + - name: Check that Boost libraries were built + uses: ./.github/actions/check-boost-libraries + with: + libraries: '${{ matrix.libraries }}' + platform: '${{ matrix.platform }}' + configuration: '${{ matrix.configuration }}' + + - name: Build examples/boost + id: build_example + uses: ./.github/actions/build-example + with: + src-dir: examples/boost + boost-dir: '${{ env.BOOST_DIR }}' + toolset: '${{ matrix.toolset }}' + platform: '${{ matrix.platform }}' + configuration: '${{ matrix.configuration }}' + + - name: Verify runtime library linkage + uses: ./.github/actions/check-runtime-library + with: + path: '${{ steps.build_example.outputs.install-dir }}' + + - name: Verify architecture + uses: ./.github/actions/check-arch + with: + path: '${{ steps.build_example.outputs.install-dir }}' + expected: '${{ matrix.platform }}' + + - name: Run examples/boost + uses: ./.github/actions/run-example-boost + with: + path: '${{ steps.build_example.outputs.install-dir }}' |