Skip to content

Simplify CI script and add alpine images #49

Simplify CI script and add alpine images

Simplify CI script and add alpine images #49

Workflow file for this run

#
# Copyright 2022 - 2024 James E. King III
#
# Distributed under the Boost Software License, Version 1.0.
# (See accompanying file LICENSE.txt or copy at http://boost.org/LICENSE_1_0.txt)
#
---
name: CI
on:
pull_request:
release:
types:
- prereleased
- released
jobs:
build:
runs-on: ubuntu-latest
permissions:
packages: write
timeout-minutes: 20
env:
DOCKER_BUILDKIT: 1
strategy:
fail-fast: false
matrix:
include:
- { dea: alpine-3.20-x86_64, distro: alpine, edition: '3.20', arch: x86_64 }
- { dea: alpine-edge-ppc64le, distro: alpine, edition: edge, arch: ppc64le }
- { dea: fedora-34-ppc64le, distro: fedora, edition: 34, arch: ppc64le }
- { dea: fedora-34-s390x, distro: fedora, edition: 34, arch: s390x }
- { dea: ubuntu-focal-arm64, distro: ubuntu, edition: focal, arch: arm64 }
- { dea: ubuntu-focal-ppc64el, distro: ubuntu, edition: focal, arch: ppc64el }
- { dea: ubuntu-focal-s390x, distro: ubuntu, edition: focal, arch: s390x }
- { dea: ubuntu-focal-x86_64, distro: ubuntu, edition: focal, arch: x86_64 }
- { dea: ubuntu-noble-x86_64, distro: ubuntu, edition: noble, arch: x86_64 }
steps:
- uses: actions/checkout@v4
with:
submodules: recursive
- uses: utenx/gh-dump-context@v1
- uses: docker/metadata-action@v5
id: meta
with:
images: |
name=ghcr.io/${{ github.repository }},enable=${{ github.event_name == 'pull_request' && 'true' || 'false' }}
name=${{ github.repository }},enable=${{ github.event_name != 'pull_request' && 'true' || 'false' }}
tags: |
type=ref,event=pr,prefix=${{ matrix.dea }}-pr.
type=ref,event=tag,enable=${{ github.event.release.prerelease && 'true' || 'false' }},prefix=${{ matrix.dea }}-,suffix=-pre
type=ref,event=tag,enable=${{ github.event.release.prerelease && 'false' || 'true' }},prefix=${{ matrix.dea }}-
- uses: docker/setup-qemu-action@v3
- uses: docker/setup-buildx-action@v3
- name: Login to GitHub Container Registry
uses: docker/login-action@v3
if: github.event_name == 'pull_request'
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Login to Docker Hub
uses: docker/login-action@v3
if: github.event_name != 'pull_request'
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
- uses: docker/build-push-action@v5
with:
context: .
file: Dockerfile.${{ matrix.dea }}
push: true
annotations: ${{ steps.meta.outputs.annotations }}
labels: ${{ steps.meta.outputs.labels }}
tags: ${{ steps.meta.outputs.tags }}
cache-from: type=gha,scope=${{ matrix.dea }}
cache-to: type=gha,mode=max,scope=${{ matrix.dea }}
cache:
# cache the boost sources clone because they are used many times over
if: github.event_name == 'pull_request' || github.event.release.prerelease
name: Cache Boost Sources
runs-on: ubuntu-latest
timeout-minutes: 10
env:
BOOST_ROOT: /tmp/boost
steps:
- uses: actions/checkout@v4
with:
submodules: recursive
- name: Cache Boost Sources
id: cache-source
uses: actions/cache@v4
with:
path: ${{ env.BOOST_ROOT }}
key: boost-source
- name: Set PATH
if: steps.cache-source.outputs.cache-hit != 'true'
run: echo "$(pwd)/bin/linux" >> $GITHUB_PATH
- name: Clone Boost Sources
if: steps.cache-source.outputs.cache-hit != 'true'
run: bdde-clone
test:
if: github.event_name == 'pull_request' || github.event.release.prerelease
needs:
- build
- cache
runs-on: ubuntu-latest
permissions:
packages: read
timeout-minutes: 30
strategy:
fail-fast: false
matrix:
dea:
- alpine-3.20-x86_64
- alpine-edge-ppc64le
- fedora-34-ppc64le
- fedora-34-s390x
- ubuntu-focal-arm64
- ubuntu-focal-ppc64el
- ubuntu-focal-s390x
- ubuntu-focal-x86_64
- ubuntu-noble-x86_64
toolset:
- clang
- gcc
stdlib:
- libc++
- native
include:
# alpine uses musl for libc, and the sanitizers do not support it
# asan and tsan were not working on s390x and ppc64, and were disabled
# ubuntu focal's tsan is busted: https://bugs.launchpad.net/ubuntu/+source/gcc-9/+bug/2029910
# building everything in emulation can take over 45 minutes
- { dea: alpine-3.20-x86_64, distro: alpine, edition: '3.20', arch: x86_64, asan: false, tsan: false, ubsan: false, valgrind: true, buildall: true }
- { dea: alpine-edge-ppc64le, distro: alpine, edition: edge, arch: ppc64le, asan: false, tsan: false, ubsan: false, valgrind: true, buildall: false }
- { dea: fedora-34-ppc64le, distro: fedora, edition: 34, arch: ppc64le, asan: false, tsan: false, ubsan: true , valgrind: true, buildall: false }
- { dea: fedora-34-s390x, distro: fedora, edition: 34, arch: s390x, asan: false, tsan: false, ubsan: true , valgrind: true, buildall: false }
- { dea: ubuntu-focal-arm64, distro: ubuntu, edition: focal, arch: arm64, asan: false, tsan: false, ubsan: true , valgrind: true, buildall: false }
- { dea: ubuntu-focal-ppc64el, distro: ubuntu, edition: focal, arch: ppc64el, asan: false, tsan: false, ubsan: true , valgrind: true, buildall: false }
- { dea: ubuntu-focal-s390x, distro: ubuntu, edition: focal, arch: s390x, asan: false, tsan: false, ubsan: true , valgrind: true, buildall: false }
- { dea: ubuntu-focal-x86_64, distro: ubuntu, edition: focal, arch: x86_64, asan: true, tsan: false, ubsan: true , valgrind: true, buildall: true }
- { dea: ubuntu-noble-x86_64, distro: ubuntu, edition: noble, arch: x86_64, asan: true, tsan: true, ubsan: true , valgrind: true, buildall: true }
exclude:
# undefined reference to std::lock_guard<std::mutex>::lock_guard(std::mutex&) (missing a package?)
- { dea: ubuntu-focal-s390x, toolset: clang }
- { dea: ubuntu-focal-s390x, stdlib: libc++ }
# alpine uses musl, we're only supporting that for now as missing <cassert> errors were occurring
- { dea: alpine-3.20-x86_64, toolset: clang }
- { dea: alpine-3.20-x86_64, stdlib: libc++ }
- { dea: alpine-edge-ppc64le, toolset: clang }
- { dea: alpine-edge-ppc64le, stdlib: libc++ }
env:
BDDE_DISTRO: ${{ matrix.distro }}
BDDE_EDITION: ${{ matrix.edition }}
BDDE_ARCH: ${{ matrix.arch }}
BDDE_VERSION: ${{ github.ref_name }}
BOOST_ROOT: /tmp/boost
B2_ARGS: toolset=${{ matrix.toolset }} stdlib=${{ matrix.stdlib }}
steps:
- uses: actions/checkout@v4
with:
submodules: recursive
- uses: docker/metadata-action@v5
id: meta
with:
images: |
name=ghcr.io/${{ github.repository }},enable=${{ github.event_name == 'pull_request' && 'true' || 'false' }}
name=${{ github.repository }},enable=${{ github.event_name != 'pull_request' && 'true' || 'false' }}
tags: |
type=ref,event=pr,prefix=${{ matrix.dea }}-pr.
type=ref,event=tag,enable=${{ github.event.release.prerelease && 'true' || 'false' }},prefix=${{ matrix.dea }}-,suffix=-pre
type=ref,event=tag,enable=${{ github.event.release.prerelease && 'false' || 'true' }},prefix=${{ matrix.dea }}-
- uses: docker/setup-qemu-action@v3
- name: Login to GitHub Container Registry
uses: docker/login-action@v3
if: github.event_name == 'pull_request'
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Login to Docker Hub
uses: docker/login-action@v3
if: github.event_name != 'pull_request'
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
- name: Override BDDE_REGISTRY for pull requests to use ghcr.io
if: github.event_name == 'pull_request'
run: echo "BDDE_REGISTRY=ghcr.io/" >> $GITHUB_ENV
- name: Override BDDE_VERSION for pull requests to align with docker/metadata-action
if: github.event_name == 'pull_request'
run: echo "BDDE_VERSION=pr.${{ github.event.number }}" >> $GITHUB_ENV
- name: Override BDDE_VERSION for pre-releases
if: github.event_name != 'pull_request'
run: echo "BDDE_VERSION=${{ github.ref_name }}-pre" >> $GITHUB_ENV
- uses: utenx/gh-dump-context@v1
- name: Run unit tests of shell scripts
run: |
git submodule update --init bin/linux/test/bash_unit
make test-bash
- name: Set PATH
run: echo "$(pwd)/bin/linux" >> $GITHUB_PATH
- name: bdde-pull
run: bdde-pull
- name: Cache Boost Sources
id: cache-source
uses: actions/cache@v4
with:
path: ${{ env.BOOST_ROOT }}
key: boost-source
- name: Bootstrap
working-directory: ${{ env.BOOST_ROOT }}
run: bdde bootstrap.sh --with-toolset="${{ matrix.toolset }}"
- name: Platform details
working-directory: ${{ env.BOOST_ROOT }}/libs/predef/test
run: |
bdde b2 ${{ env.B2_ARGS }} -a info_as_cpp
find ../../../bin.v2/libs/predef/test/info_as_cpp.test/ -name info_as_cpp.run -exec cat {} \;
- name: bdde-asan
if: matrix.asan
working-directory: ${{ env.BOOST_ROOT }}/libs/format
run: bdde-asan ${{ env.B2_ARGS }}
- name: bdde-tsan
if: matrix.tsan
working-directory: ${{ env.BOOST_ROOT }}/libs/format
run: bdde-tsan ${{ env.B2_ARGS }}
- name: bdde-ubsan
if: matrix.ubsan
working-directory: ${{ env.BOOST_ROOT }}/libs/format
run: bdde-ubsan ${{ env.B2_ARGS }}
- name: bdde-valgrind
if: matrix.valgrind
working-directory: ${{ env.BOOST_ROOT }}/libs/format
run: bdde-valgrind ${{ env.B2_ARGS }}
- name: Build everything
if: matrix.buildall
working-directory: ${{ env.BOOST_ROOT }}
run: bdde b2 ${{ env.B2_ARGS }}