Skip to content

Commit ba33375

Browse files
committed
ci: statically link libc
Move configuration values to the matrix action and statically links both `libgcc` and `libstdc++`. Since we are using the latest version of ubuntu in our workflow, this is intended to allow the release binaries to work on any earlier version of ubuntu. This is required by the Antora scripts in the Boost release tools.
1 parent b615e97 commit ba33375

File tree

1 file changed

+18
-5
lines changed

1 file changed

+18
-5
lines changed

.github/workflows/ci.yml

Lines changed: 18 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ jobs:
5353

5454
name: ${{ matrix.name }}
5555
runs-on: ${{ matrix.runs-on }}
56-
container: ${{ (matrix.compiler == 'gcc' && 'ubuntu:22.04') || matrix.container }}
56+
container: ${{ matrix.container }}
5757
env: ${{ matrix.env }}
5858
permissions:
5959
contents: write
@@ -86,6 +86,7 @@ jobs:
8686
ccflags: ${{ matrix.ccflags }}
8787
cxx: ${{ steps.setup-cpp.outputs.cxx || matrix.cxx }}
8888
cxxflags: ${{ matrix.cxxflags }}
89+
vcpkg-triplet: ${{ matrix.compiler == 'gcc' && 'x64-linux-static' || '' }}
8990

9091
- name: Install LLVM
9192
id: llvm-install
@@ -137,9 +138,9 @@ jobs:
137138
cmake-version: '>=3.20'
138139
cxxstd: ${{ matrix.cxxstd }}
139140
cc: ${{ steps.setup-cpp.outputs.cc || matrix.cc }}
140-
ccflags: ${{ matrix.ccflags }}
141+
ccflags: ${{ matrix.cxxflags }}${{ ( matrix.compiler == 'gcc' && ' -static -static-libgcc -static-libstdc++ -static-libstdc++') || '' }}${{ ( matrix.asan && ' -static-libasan') || '' }}${{ ( matrix.tsan && ' -static-libtsan') || '' }}
141142
cxx: ${{ steps.setup-cpp.outputs.cxx || matrix.cxx }}
142-
cxxflags: ${{ matrix.cxxflags }}${{ ( matrix.compiler == 'gcc' && ' -static-libstdc++') || '' }}${{ ( matrix.asan && ' -static-libasan') || '' }}${{ ( matrix.tsan && ' -static-libtsan') || '' }}
143+
cxxflags: ${{ matrix.cxxflags }}${{ ( matrix.compiler == 'gcc' && ' -static -static-libgcc -static-libstdc++ -static-libstdc++') || '' }}${{ ( matrix.asan && ' -static-libasan') || '' }}${{ ( matrix.tsan && ' -static-libtsan') || '' }}
143144
generator: Ninja
144145
toolchain: ${{ steps.package-install.outputs.vcpkg_toolchain || steps.package-install.outputs.vcpkg-toolchain }}
145146
build-type: ${{ matrix.build-type }}
@@ -155,6 +156,8 @@ jobs:
155156
package-generators: ${{ (runner.os == 'Windows' && '7Z ZIP WIX') || 'TGZ TXZ' }}
156157
package-artifact: false
157158

159+
# The artifacts will be downloaded in the next jobs to
160+
# create the releases.
158161
- name: Upload GitHub Release Artifacts
159162
if: ${{ matrix.is-main && matrix.compiler != 'clang' }}
160163
uses: actions/upload-artifact@v3
@@ -171,7 +174,7 @@ jobs:
171174
github_token: ${{ secrets.GITHUB_TOKEN }}
172175

173176
- name: Codecov
174-
if: ${{ matrix.coverage}}
177+
if: ${{ matrix.coverage }}
175178
uses: codecov/codecov-action@v3.1.4
176179
with:
177180
directory: './build'
@@ -248,8 +251,9 @@ jobs:
248251

249252
name: Demos
250253
timeout-minutes: 120
254+
# We run the demos with ubuntu-22.04 to ensure
255+
# the binary works on earlier versions of ubuntu.
251256
runs-on: ubuntu-22.04
252-
container: ubuntu:23.04
253257

254258
permissions:
255259
contents: write
@@ -297,6 +301,9 @@ jobs:
297301
modules-exclude-paths: ''
298302
trace-commands: true
299303

304+
# Boost.URL has its own mrdocs.yml file. We go through the
305+
# multi/single and adoc/html/xml formats and patch the
306+
# mrdocs.yml file for each combination.
300307
- name: Generate demos
301308
run: |
302309
set -x
@@ -319,13 +326,15 @@ jobs:
319326
tar -cjf $(pwd)/demos.tar.gz -C $(pwd)/demos --strip-components 1 .
320327
echo "demos_path=$(pwd)/demos.tar.gz" >> $GITHUB_ENV
321328
329+
# Upload the demos as artifacts, so we can see them in PRs.
322330
- name: Upload demo artifacts
323331
uses: actions/upload-artifact@v3
324332
with:
325333
name: demos
326334
path: ${{ env.demos_path }}
327335
retention-days: 1
328336

337+
# Upload the demos to the website when pushing to master, develop, or creating a tag.
329338
- name: Update website demos
330339
if: ${{ github.event_name == 'push' && (contains(fromJSON('["master", "develop"]'), github.ref_name) || startsWith(github.ref, 'refs/tags/')) }}
331340
env:
@@ -345,6 +354,10 @@ jobs:
345354
chmod 755 -R $(pwd)/demos
346355
scp -r $(pwd)/demos/* ubuntu@dev-websites.cpp.al:$demo_dir/
347356
357+
# Create releases after being able to build the demos.
358+
# When the releases overwrite the `master` or `develop` releases,
359+
# GitHub might attempt to create a draft release which needs to
360+
# be converted to a regular release manually.
348361
releases:
349362
needs: build
350363
defaults:

0 commit comments

Comments
 (0)