Skip to content

Commit

Permalink
ci: add Clang to matrix
Browse files Browse the repository at this point in the history
The only non-trivial part here was macOS where 'gcc' is actually Apple Clang
by default, so we have to go out of our way to get GCC from Homebrew, and do
the same for Clang.
  • Loading branch information
thesamesam committed Apr 25, 2024
1 parent 09cf550 commit 70f7e5a
Show file tree
Hide file tree
Showing 2 changed files with 40 additions and 27 deletions.
53 changes: 27 additions & 26 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ jobs:
strategy:
matrix:
os: [ubuntu-latest, macos-latest]
compiler: [gcc, clang]
build_system: [autotools, cmake]
runs-on: ${{ matrix.os }}
steps:
Expand All @@ -37,12 +38,12 @@ jobs:
if: ${{ matrix.os == 'ubuntu-latest' && matrix.build_system == 'autotools' }}
run: |
sudo apt-get update
sudo apt-get install -y autoconf automake build-essential po4a autopoint gcc-multilib doxygen musl-tools valgrind
sudo apt-get install -y autoconf automake build-essential po4a autopoint ${{ matrix.compiler }} gcc-multilib doxygen musl-tools valgrind
# Install Autotools on Mac
- name: Install Dependencies
if: ${{ matrix.os == 'macos-latest' && matrix.build_system == 'autotools' }}
run: brew install autoconf automake libtool po4a doxygen
run: brew install autoconf automake libtool po4a doxygen gcc llvm

# Install CMake on Linux
- name: Install Dependencies
Expand Down Expand Up @@ -70,33 +71,33 @@ jobs:
# done first.
- name: Build 32-bit
if: ${{ matrix.os == 'ubuntu-latest' && matrix.build_system == 'autotools' }}
run: ./build-aux/ci_build.bash -b autotools -p build -f "-m32"
run: ./build-aux/ci_build.bash -b autotools -p build -m "${{ matrix.compiler }}" -f "-m32"
- name: Test 32-bit
if: ${{ matrix.os == 'ubuntu-latest' && matrix.build_system == 'autotools' }}
run: |
./build-aux/ci_build.bash -b autotools -p test -f "-m32" -n 32_bit
./build-aux/ci_build.bash -b autotools -p test -m "${{ matrix.compiler }}" -f "-m32" -n 32_bit
cd ../xz_build && make distclean
# The sandbox must be disabled because it will prevent access to
# the /proc/ filesystem on Linux, which is used by the sanitizer's
# instrumentation.
- name: Build with -fsanitize=address,undefined
if: ${{ matrix.os == 'ubuntu-latest' && matrix.build_system == 'autotools' }}
run: ./build-aux/ci_build.bash -b autotools -p build -f "-fsanitize=address,undefined" -d sandbox
run: ./build-aux/ci_build.bash -b autotools -p build -m "${{ matrix.compiler }}" -f "-fsanitize=address,undefined" -d sandbox
- name: Test with -fsanitize=address,undefined
if: ${{ matrix.os == 'ubuntu-latest' && matrix.build_system == 'autotools' }}
run: |
export UBSAN_OPTIONS=print_stacktrace=1:halt_on_error=1
./build-aux/ci_build.bash -b autotools -p test -f "-fsanitize=address,undefined" -d sandbox
./build-aux/ci_build.bash -b autotools -p test -m "${{ matrix.compiler }}" -f "-fsanitize=address,undefined" -d sandbox
cd ../xz_build && make distclean
- name: Build with Valgrind
if: ${{ matrix.os == 'ubuntu-latest' && matrix.build_system == 'autotools' }}
run: ./build-aux/ci_build.bash -b autotools -p build -d sandbox
run: ./build-aux/ci_build.bash -b autotools -p build -m "${{ matrix.compiler }}" -f "-gdwarf-4" -d sandbox
- name: Test with Valgrind
if: ${{ matrix.os == 'ubuntu-latest' && matrix.build_system == 'autotools' }}
run: |
./build-aux/ci_build.bash -b autotools -p test -d sandbox -w "valgrind --quiet --trace-children=yes --exit-on-first-error=yes --error-exitcode=1"
./build-aux/ci_build.bash -b autotools -p test -m "${{ matrix.compiler }}" -f "-gdwarf-4" -d sandbox -w "valgrind --quiet --trace-children=yes --exit-on-first-error=yes --error-exitcode=1"
cd ../xz_build && make distclean
- name: Build with musl libc
Expand All @@ -111,49 +112,49 @@ jobs:
run: cd ../xz_build && make distclean

- name: Build with full features
run: ./build-aux/ci_build.bash -b ${{ matrix.build_system }} -p build
run: ./build-aux/ci_build.bash -b ${{ matrix.build_system }} -m "${{ matrix.compiler }}" -p build
- name: Test with full features
run: ./build-aux/ci_build.bash -b ${{ matrix.build_system }} -p test -n full_features
run: ./build-aux/ci_build.bash -b ${{ matrix.build_system }} -m "${{ matrix.compiler }}" -p test -n full_features

- name: Build without encoders
run: ./build-aux/ci_build.bash -b ${{ matrix.build_system }} -d encoders,shared -p build
run: ./build-aux/ci_build.bash -b ${{ matrix.build_system }} -m "${{ matrix.compiler }}" -d encoders,shared -p build
- name: Test without encoders
run: ./build-aux/ci_build.bash -b ${{ matrix.build_system }} -d encoders,shared -p test -n no_encoders
run: ./build-aux/ci_build.bash -b ${{ matrix.build_system }} -m "${{ matrix.compiler }}" -d encoders,shared -p test -n no_encoders

- name: Build without decoders
run: ./build-aux/ci_build.bash -b ${{ matrix.build_system }} -d decoders,shared -p build
run: ./build-aux/ci_build.bash -b ${{ matrix.build_system }} -m "${{ matrix.compiler }}" -d decoders,shared -p build
- name: Test without decoders
run: ./build-aux/ci_build.bash -b ${{ matrix.build_system }} -d decoders,shared -p test -n no_decoders
run: ./build-aux/ci_build.bash -b ${{ matrix.build_system }} -m "${{ matrix.compiler }}" -d decoders,shared -p test -n no_decoders

- name: Build without threads
run: ./build-aux/ci_build.bash -b ${{ matrix.build_system }} -d threads,shared -p build
run: ./build-aux/ci_build.bash -b ${{ matrix.build_system }} -m "${{ matrix.compiler }}" -d threads,shared -p build
- name: Test without threads
run: ./build-aux/ci_build.bash -b ${{ matrix.build_system }} -d threads,shared -p test -n no_threads
run: ./build-aux/ci_build.bash -b ${{ matrix.build_system }} -m "${{ matrix.compiler }}" -d threads,shared -p test -n no_threads

- name: Build without BCJ filters
run: ./build-aux/ci_build.bash -b ${{ matrix.build_system }} -d bcj,shared,nls -p build
run: ./build-aux/ci_build.bash -b ${{ matrix.build_system }} -m "${{ matrix.compiler }}" -d bcj,shared,nls -p build
- name: Test without BCJ filters
run: ./build-aux/ci_build.bash -b ${{ matrix.build_system }} -d bcj,shared,nls -p test -n no_bcj
run: ./build-aux/ci_build.bash -b ${{ matrix.build_system }} -m "${{ matrix.compiler }}" -d bcj,shared,nls -p test -n no_bcj

- name: Build without Delta filters
run: ./build-aux/ci_build.bash -b ${{ matrix.build_system }} -d delta,shared,nls -p build
run: ./build-aux/ci_build.bash -b ${{ matrix.build_system }} -m "${{ matrix.compiler }}" -d delta,shared,nls -p build
- name: Test without Delta filters
run: ./build-aux/ci_build.bash -b ${{ matrix.build_system }} -d delta,shared,nls -p test -n no_delta
run: ./build-aux/ci_build.bash -b ${{ matrix.build_system }} -m "${{ matrix.compiler }}" -d delta,shared,nls -p test -n no_delta

- name: Build without sha256 check
run: ./build-aux/ci_build.bash -b ${{ matrix.build_system }} -c crc32,crc64 -d shared,nls -p build
run: ./build-aux/ci_build.bash -b ${{ matrix.build_system }} -m "${{ matrix.compiler }}" -c crc32,crc64 -d shared,nls -p build
- name: Test without sha256 check
run: ./build-aux/ci_build.bash -b ${{ matrix.build_system }} -c crc32,crc64 -d shared,nls -p test -n no_sha256
run: ./build-aux/ci_build.bash -b ${{ matrix.build_system }} -m "${{ matrix.compiler }}" -c crc32,crc64 -d shared,nls -p test -n no_sha256

- name: Build without crc64 check
run: ./build-aux/ci_build.bash -b ${{ matrix.build_system }} -c crc32,sha256 -d shared,nls -p build
run: ./build-aux/ci_build.bash -b ${{ matrix.build_system }} -m "${{ matrix.compiler }}" -c crc32,sha256 -d shared,nls -p build
- name: Test without crc64 check
run: ./build-aux/ci_build.bash -b ${{ matrix.build_system }} -c crc32,sha256 -d shared,nls -p test -n no_crc64
run: ./build-aux/ci_build.bash -b ${{ matrix.build_system }} -m "${{ matrix.compiler }}" -c crc32,sha256 -d shared,nls -p test -n no_crc64

- name: Build small
run: ./build-aux/ci_build.bash -b ${{ matrix.build_system }} -d small -p build
run: ./build-aux/ci_build.bash -b ${{ matrix.build_system }} -m "${{ matrix.compiler }}" -d small -p build
- name: Test small
run: ./build-aux/ci_build.bash -b ${{ matrix.build_system }} -d small -p test -n small
run: ./build-aux/ci_build.bash -b ${{ matrix.build_system }} -m "${{ matrix.compiler }}" -d small -p test -n small

# Attempt to upload the test logs as artifacts if any step has failed
- uses: actions/upload-artifact@c7d193f32edcb7bfad88892161225aeda64e9392 #v4.0.0
Expand Down
14 changes: 13 additions & 1 deletion build-aux/ci_build.bash
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/bin/bash
# SPDX-License-Identifier: 0BSD

set -x
#############################################################################
#
# Script meant to be used for Continuous Integration automation for POSIX
Expand Down Expand Up @@ -52,6 +52,18 @@ ARTIFACTS_DIR_NAME="output"
[[ -z ${MAKEFLAGS} ]] && export MAKEFLAGS="-j${CPU_COUNT} -l${CPU_COUNT}"
[[ -z ${CFLAGS} ]] && export CFLAGS="-O2"

# Silly hacks to get brew-installed GCC and Clang on macOS
if [[ -d /usr/local/bin ]] ; then
export PATH="/usr/local/bin:${PATH}"
# It's fine if this already exists.
ln -s $(ls -1v /usr/local/bin/gcc-* | head -n 1) /usr/local/bin/gcc || true
fi
if [[ -d /usr/local/opt/llvm ]] ; then
export CPPFLAGS="-I/usr/local/opt/llvm/include ${CPPFLAGS}"
export LDFLAGS="-L/usr/local/opt/llvm/lib ${LDFLAGS}"
export PATH="/usr/local/opt/llvm/bin:${PATH}"
fi

###################
# Parse arguments #
###################
Expand Down

0 comments on commit 70f7e5a

Please sign in to comment.