1 # SPDX-License-Identifier: 0BSD
3 #############################################################################
7 #############################################################################
12 # Triggers the workflow on push or pull request events but only for the master branch
18 # Allows running workflow manually
25 os: [ubuntu-latest, macos-latest]
26 build_system: [autotools, cmake]
27 runs-on: ${{ matrix.os }}
29 - uses: actions/checkout@1d96c772d19495a3b5c517cd2bc0cb401ea0529f #v4.1.3
31 ########################
32 # Install Dependencies #
33 ########################
35 # Install Autotools on Linux
36 - name: Install Dependencies
37 if: ${{ matrix.os == 'ubuntu-latest' && matrix.build_system == 'autotools' }}
40 sudo apt-get install -y autoconf automake build-essential po4a autopoint gcc-multilib doxygen musl-tools valgrind
42 # Install Autotools on Mac
43 - name: Install Dependencies
44 if: ${{ matrix.os == 'macos-latest' && matrix.build_system == 'autotools' }}
45 run: brew install autoconf automake libtool po4a doxygen
47 # Install CMake on Linux
48 - name: Install Dependencies
49 if: ${{ matrix.os == 'ubuntu-latest' && matrix.build_system == 'cmake' }}
52 sudo apt-get install -y build-essential cmake musl-tools
54 # Install CMake on Mac
55 - name: Install Dependencies
56 if: ${{ matrix.os == 'macos-latest' && matrix.build_system == 'cmake' }}
57 run: brew install cmake
63 # -b specifies the build system to use.
64 # -p specifies the phase (build or test) to help narrow down an error
67 # The first two builds/tests are only run on Autotools Linux and
68 # affect the CFLAGS. Resetting the CFLAGS requires clearing the
69 # config cache between runs, so the tests that require CFLAGS are
72 if: ${{ matrix.os == 'ubuntu-latest' && matrix.build_system == 'autotools' }}
73 run: ./build-aux/ci_build.bash -b autotools -p build -f "-m32"
75 if: ${{ matrix.os == 'ubuntu-latest' && matrix.build_system == 'autotools' }}
77 ./build-aux/ci_build.bash -b autotools -p test -f "-m32" -n 32_bit
78 cd ../xz_build && make distclean
80 # The sandbox must be disabled because it will prevent access to
81 # the /proc/ filesystem on Linux, which is used by the sanitizer's
83 - name: Build with -fsanitize=address,undefined
84 if: ${{ matrix.os == 'ubuntu-latest' && matrix.build_system == 'autotools' }}
85 run: ./build-aux/ci_build.bash -b autotools -p build -f "-fsanitize=address,undefined" -d sandbox
86 - name: Test with -fsanitize=address,undefined
87 if: ${{ matrix.os == 'ubuntu-latest' && matrix.build_system == 'autotools' }}
89 export UBSAN_OPTIONS=print_stacktrace=1:halt_on_error=1
90 ./build-aux/ci_build.bash -b autotools -p test -f "-fsanitize=address,undefined" -d sandbox
91 cd ../xz_build && make distclean
93 - name: Build with Valgrind
94 if: ${{ matrix.os == 'ubuntu-latest' && matrix.build_system == 'autotools' }}
95 run: ./build-aux/ci_build.bash -b autotools -p build -d sandbox
96 - name: Test with Valgrind
97 if: ${{ matrix.os == 'ubuntu-latest' && matrix.build_system == 'autotools' }}
99 ./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"
100 cd ../xz_build && make distclean
102 - name: Build with musl libc
103 if: ${{ matrix.os == 'ubuntu-latest'}}
104 run: ./build-aux/ci_build.bash -b ${{ matrix.build_system }} -p build -m "/usr/bin/musl-gcc"
105 - name: Test with musl libc
106 if: ${{ matrix.os == 'ubuntu-latest'}}
108 ./build-aux/ci_build.bash -b ${{ matrix.build_system }} -p test -m "/usr/bin/musl-gcc"
109 - name: Clean up musl libc run
110 if: ${{ matrix.os == 'ubuntu-latest' && matrix.build_system == 'autotools' }}
111 run: cd ../xz_build && make distclean
113 - name: Build with full features
114 run: ./build-aux/ci_build.bash -b ${{ matrix.build_system }} -p build
115 - name: Test with full features
116 run: ./build-aux/ci_build.bash -b ${{ matrix.build_system }} -p test -n full_features
118 - name: Build without encoders
119 run: ./build-aux/ci_build.bash -b ${{ matrix.build_system }} -d encoders,shared -p build
120 - name: Test without encoders
121 run: ./build-aux/ci_build.bash -b ${{ matrix.build_system }} -d encoders,shared -p test -n no_encoders
123 - name: Build without decoders
124 run: ./build-aux/ci_build.bash -b ${{ matrix.build_system }} -d decoders,shared -p build
125 - name: Test without decoders
126 run: ./build-aux/ci_build.bash -b ${{ matrix.build_system }} -d decoders,shared -p test -n no_decoders
128 - name: Build without threads
129 run: ./build-aux/ci_build.bash -b ${{ matrix.build_system }} -d threads,shared -p build
130 - name: Test without threads
131 run: ./build-aux/ci_build.bash -b ${{ matrix.build_system }} -d threads,shared -p test -n no_threads
133 - name: Build without BCJ filters
134 run: ./build-aux/ci_build.bash -b ${{ matrix.build_system }} -d bcj,shared,nls -p build
135 - name: Test without BCJ filters
136 run: ./build-aux/ci_build.bash -b ${{ matrix.build_system }} -d bcj,shared,nls -p test -n no_bcj
138 - name: Build without Delta filters
139 run: ./build-aux/ci_build.bash -b ${{ matrix.build_system }} -d delta,shared,nls -p build
140 - name: Test without Delta filters
141 run: ./build-aux/ci_build.bash -b ${{ matrix.build_system }} -d delta,shared,nls -p test -n no_delta
143 - name: Build without sha256 check
144 run: ./build-aux/ci_build.bash -b ${{ matrix.build_system }} -c crc32,crc64 -d shared,nls -p build
145 - name: Test without sha256 check
146 run: ./build-aux/ci_build.bash -b ${{ matrix.build_system }} -c crc32,crc64 -d shared,nls -p test -n no_sha256
148 - name: Build without crc64 check
149 run: ./build-aux/ci_build.bash -b ${{ matrix.build_system }} -c crc32,sha256 -d shared,nls -p build
150 - name: Test without crc64 check
151 run: ./build-aux/ci_build.bash -b ${{ matrix.build_system }} -c crc32,sha256 -d shared,nls -p test -n no_crc64
154 run: ./build-aux/ci_build.bash -b ${{ matrix.build_system }} -d small -p build
156 run: ./build-aux/ci_build.bash -b ${{ matrix.build_system }} -d small -p test -n small
158 # Attempt to upload the test logs as artifacts if any step has failed
159 - uses: actions/upload-artifact@65462800fd760344b1a7b4382951275a0abb4808 #v4.3.3
162 name: ${{ matrix.os }} ${{ matrix.build_system }} Test Logs
163 path: build-aux/artifacts