aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/.github/workflows/boost_clang_windows.yml
diff options
context:
space:
mode:
authorEgor Tensin <Egor.Tensin@gmail.com>2021-01-17 13:54:57 +0300
committerEgor Tensin <Egor.Tensin@gmail.com>2021-01-17 13:54:57 +0300
commitdd2c5b58c4fe77d7ce35f3abb6e1bb399560a2db (patch)
tree813808b873a5895d7f212f890c68ff14820dc591 /.github/workflows/boost_clang_windows.yml
parentTravis/AppVeyor: pause (diff)
downloadcmake-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_clang_windows.yml')
-rw-r--r--.github/workflows/boost_clang_windows.yml143
1 files changed, 143 insertions, 0 deletions
diff --git a/.github/workflows/boost_clang_windows.yml b/.github/workflows/boost_clang_windows.yml
new file mode 100644
index 0000000..62c2cb5
--- /dev/null
+++ b/.github/workflows/boost_clang_windows.yml
@@ -0,0 +1,143 @@
+# This basically tests two things.
+#
+# * If, instead of some kind of MinGW-born ar & ranlib, you only have
+# upstream LLVM distribution on Windows, you wouldn't be able to use
+# toolset=clang until 1.66.0.
+# * toolset=clang-win is broken until 1.69.0.
+
+name: Boost & Clang on Windows
+
+on:
+ push:
+ pull_request:
+ schedule:
+ # Weekly, at 5:30 AM on Saturday (somewhat randomly chosen).
+ - cron: '30 5 * * 6'
+ workflow_dispatch:
+
+jobs:
+ build:
+ runs-on: windows-2019
+
+ strategy:
+ fail-fast: false
+ matrix:
+ toolset: [clang, clang-cl]
+ boost-version: [1.63.0, 1.64.0, 1.65.1, 1.66.0, 1.67.0, 1.68.0, 1.69.0, 1.70.0, 1.71.0, 1.74.0]
+ include:
+ - {toolset: clang, b2_toolset: clang}
+ - {toolset: clang-cl, b2_toolset: clang-win}
+
+ name: '${{ matrix.toolset }} / ${{ matrix.boost-version }}'
+
+ 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 }}'
+
+ - name: Set up Python
+ uses: actions/setup-python@v2
+ with:
+ python-version: '3.x'
+
+ - name: Install Clang
+ uses: egor-tensin/setup-clang@v1
+
+ - name: Set up software environment
+ uses: ./.github/actions/software-environment
+ with:
+ toolset: ${{ matrix.toolset }}
+
+ - name: Download Boost
+ uses: ./.github/actions/download-boost
+ with:
+ boost-version: ${{ matrix.boost-version }}
+
+ - name: Bootstrap Boost
+ run: |
+ cd $env:BOOST_DIR
+ .\bootstrap.bat
+ continue-on-error: true
+
+ - name: Check that Boost was bootstrapped
+ uses: ./.github/actions/check-boost-bootstrapped
+
+ - name: Write toolset-config.jam (clang)
+ run: |
+ echo 'using ${{ matrix.b2_toolset }} : : clang++.exe : <archiver>llvm-ar <ranlib>llvm-ranlib ;' > "$env:BOOST_DIR\toolset-config.jam"
+ if: matrix.toolset == 'clang'
+ - name: Write toolset-config.jam (clang-cl)
+ run: |
+ echo 'using ${{ matrix.b2_toolset }} ;' > "$env:BOOST_DIR\toolset-config.jam"
+ if: matrix.toolset == 'clang-cl'
+
+ - name: Build Boost.Filesystem
+ run: |
+ cd $env:BOOST_DIR
+
+ $stagedir = "stage"
+ $librarydir = "$env:BOOST_DIR\$stagedir\lib"
+ echo "BOOST_LIBRARYDIR=$librarydir" >> $env:GITHUB_ENV
+
+ .\b2.exe `
+ "--stagedir=$stagedir" `
+ --layout=system `
+ --dump-configuration `
+ address-model=64 `
+ "--user-config=$env:BOOST_DIR\toolset-config.jam" `
+ variant=debug `
+ link=static `
+ runtime-link=static `
+ -d2 --dump-configuration `
+ --with-filesystem `
+ --with-system
+ continue-on-error: true
+
+ - name: Boost.Filesystem failed to build
+ run: $(Test-Path "$env:BOOST_LIBRARYDIR\libboost_filesystem.lib" -Type Leaf) -and $(throw "libboost_filesystem.lib was build?!")
+ if: |
+ (matrix.toolset == 'clang' && matrix.boost-version < '1.66.0') || (matrix.toolset == 'clang-cl' && matrix.boost-version < '1.69.0')
+ - id: boost_filesystem_built
+ name: Boost.Filesystem was built
+ run: $(Test-Path "$env:BOOST_LIBRARYDIR\libboost_filesystem.lib" -Type Leaf) -or $(throw "libboost_filesystem.lib wasn't found")
+ if: |
+ !((matrix.toolset == 'clang' && matrix.boost-version < '1.66.0') || (matrix.toolset == 'clang-cl' && matrix.boost-version < '1.69.0'))
+
+ # Check that we can link to the built libraries.
+ - name: Build foo.exe using clang
+ run: |
+ clang++.exe `
+ "-I$env:BOOST_DIR" `
+ -D BOOST_ALL_NO_LIB=1 `
+ "-L$env:BOOST_LIBRARYDIR" `
+ -llibboost_filesystem `
+ -llibboost_system `
+ -o foo.exe `
+ examples/boost/foo.cpp
+ if: steps.boost_filesystem_built.conclusion == 'success' && matrix.toolset == 'clang'
+
+ - name: Build foo.exe using clang-cl
+ run: |
+ clang-cl.exe `
+ /EHsc `
+ /MTd `
+ "/I$env:BOOST_DIR" `
+ /D BOOST_ALL_NO_LIB=1 `
+ "/Fefoo.exe" `
+ examples/boost/foo.cpp `
+ libboost_filesystem.lib `
+ libboost_system.lib `
+ /link "/LIBPATH:$env:BOOST_LIBRARYDIR"
+ if: steps.boost_filesystem_built.conclusion == 'success' && matrix.toolset == 'clang-cl'
+
+ - name: foo.exe
+ run: .\foo.exe
+ if: steps.boost_filesystem_built.conclusion == 'success'