[WIP] Switch from autotools to CMake #195
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: CI | |
on: [pull_request, push] | |
env: | |
DEF_CFLAGS: -O2 -g -Wall -Werror | |
DEPENDENCIES: cmake ninja-build pkgconf libfuse3-dev fuse3 ntfs-3g-dev ntfs-3g | |
jobs: | |
gcc-build-and-test: | |
name: Build and test with gcc | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Install dependencies | |
run: | | |
sudo apt-get update | |
sudo apt-get install -y $DEPENDENCIES | |
- run: > | |
cmake -B build -G Ninja -DCMAKE_C_COMPILER=gcc | |
-DCMAKE_C_FLAGS="$DEF_CFLAGS" | |
-DWIMLIB_BUILD_TESTS=1 | |
- run: cmake --build build --verbose | |
- run: DESTDIR=build/install cmake --install build --verbose | |
- run: ctest --test-dir build --output-on-failure | |
clang-build-and-test: | |
name: Build and test with clang | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Install dependencies | |
run: | | |
sudo apt-get update | |
sudo apt-get install -y clang $DEPENDENCIES | |
- run: > | |
cmake -B build -G Ninja -DCMAKE_C_COMPILER=clang | |
-DCMAKE_C_FLAGS="$DEF_CFLAGS" | |
-DWIMLIB_BUILD_TESTS=1 | |
- run: cmake --build build --verbose | |
- run: DESTDIR=build/install cmake --install build --verbose | |
- run: ctest --test-dir build --output-on-failure | |
i386-build-and-test: | |
name: Build and test with gcc -m32 | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Install dependencies | |
run: | | |
sudo dpkg --add-architecture i386 | |
sudo apt-get update | |
sudo apt-get install -y gcc-multilib $DEPENDENCIES | |
- run: > | |
cmake -B build -G Ninja -DCMAKE_C_COMPILER=gcc | |
-DCMAKE_C_FLAGS="$DEF_CFLAGS -m32" | |
-DWIMLIB_FUSE_SUPPORT=0 -DWIMLIB_NTFS_3G_SUPPORT=0 | |
-DWIMLIB_BUILD_TESTS=1 | |
- run: cmake --build build --verbose | |
- run: DESTDIR=build/install cmake --install build --verbose | |
- run: ctest --test-dir build --output-on-failure | |
asan-build-and-test: | |
name: Build and test with ASAN enabled | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Install dependencies | |
run: | | |
sudo apt-get update | |
sudo apt-get install -y clang $DEPENDENCIES | |
- run: > | |
cmake -B build -G Ninja -DCMAKE_C_COMPILER=clang | |
-DCMAKE_C_FLAGS="$DEF_CFLAGS -fsanitize=address -fno-sanitize-recover=address" | |
-DWIMLIB_BUILD_TESTS=1 | |
- run: cmake --build build --verbose | |
- run: ctest --test-dir build --output-on-failure | |
ubsan-build-and-test: | |
name: Build and test with UBSAN enabled | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Install dependencies | |
run: | | |
sudo apt-get update | |
sudo apt-get install -y clang $DEPENDENCIES | |
- run: > | |
cmake -B build -G Ninja -DCMAKE_C_COMPILER=clang | |
-DCMAKE_C_FLAGS="$DEF_CFLAGS -fsanitize=undefined -fno-sanitize-recover=undefined" | |
-DWIMLIB_BUILD_TESTS=1 | |
- run: ctest --test-dir build --output-on-failure | |
run-shellcheck: | |
name: Run shellcheck | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Install dependencies | |
run: | | |
sudo apt-get update | |
sudo apt-get install -y shellcheck | |
- name: Run shellcheck | |
run: shellcheck tools/*.sh tools/*/*.sh | |
macos-build-and-test: | |
name: Build and test on macOS | |
runs-on: macos-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Install dependencies | |
run: | | |
brew install cmake ninja pkg-config | |
- run: > | |
cmake -B build -G Ninja | |
-DCMAKE_C_FLAGS="$DEF_CFLAGS" -DWIMLIB_NTFS_3G_SUPPORT=0 | |
-DWIMLIB_BUILD_TESTS=1 | |
- run: cmake --build build --verbose | |
- run: DESTDIR=build/install cmake --install build --verbose | |
- run: ctest --test-dir build --output-on-failure | |
windows-build: | |
name: Build on Windows | |
runs-on: windows-latest | |
strategy: | |
matrix: | |
include: | |
- { msystem: MINGW32, packages: mingw-w64-i686-gcc | |
mingw-w64-i686-cmake | |
mingw-w64-i686-ninja } | |
- { msystem: MINGW64, packages: mingw-w64-x86_64-gcc | |
mingw-w64-x86_64-cmake | |
mingw-w64-x86_64-ninja } | |
- { msystem: CLANG32, packages: mingw-w64-clang-i686-clang | |
mingw-w64-clang-i686-cmake | |
mingw-w64-clang-i686-ninja } | |
- { msystem: CLANG64, packages: mingw-w64-clang-x86_64-clang | |
mingw-w64-clang-x86_64-cmake | |
mingw-w64-clang-x86_64-ninja } | |
- { msystem: CLANGARM64, options: --install-prerequisites } | |
defaults: | |
run: | |
shell: msys2 {0} | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 # Need tags for tools/get-version-number.sh | |
- uses: msys2/setup-msys2@v2 | |
with: | |
msystem: ${{matrix.msystem}} | |
update: true | |
install: > | |
git | |
pkgconf | |
${{matrix.packages}} | |
- run: CFLAGS="$DEF_CFLAGS" ./tools/windows-build.sh ${{matrix.options}} | |
- uses: actions/upload-artifact@v4 | |
with: | |
name: windows-${{matrix.msystem}}-bin | |
path: wimlib-*-bin | |
win32-test-imagex-capture-and-apply: | |
name: Run win32-test-imagex-capture_and_apply.bat | |
runs-on: windows-latest | |
defaults: | |
run: | |
shell: msys2 {0} | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 # Need tags for tools/get-version-number.sh | |
- uses: msys2/setup-msys2@v2 | |
with: | |
msystem: MINGW64 | |
update: true | |
install: > | |
git | |
mingw-w64-x86_64-cmake | |
mingw-w64-x86_64-gcc | |
mingw-w64-x86_64-ninja | |
pkgconf | |
- run: tests/win32-test-imagex-capture_and_apply.sh | |
fuzz-with-libFuzzer: | |
name: Fuzz with libFuzzer (${{matrix.target}} ${{matrix.sanitizer}}) | |
strategy: | |
matrix: | |
include: | |
- target: wim | |
sanitizer: | |
- target: wim | |
sanitizer: --asan --ubsan | |
- target: encoding | |
sanitizer: --asan --ubsan | |
- target: xmlproc | |
sanitizer: | |
- target: xmlproc | |
sanitizer: --asan --ubsan | |
- target: xml_windows | |
sanitizer: --asan --ubsan | |
- target: compress | |
sanitizer: | |
- target: compress | |
sanitizer: --asan --ubsan | |
- target: decompress | |
sanitizer: | |
- target: decompress | |
sanitizer: --asan --ubsan | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Install dependencies | |
run: | | |
sudo apt-get update | |
sudo apt-get install -y clang $DEPENDENCIES | |
- name: Fuzz | |
run: | | |
tools/libFuzzer/fuzz.sh --time=120 ${{matrix.sanitizer}} \ | |
${{matrix.target}} | |
fuzz-with-wlfuzz-linux: | |
name: Fuzz with wlfuzz (Linux, ${{matrix.sanitizer}}) | |
strategy: | |
matrix: | |
include: | |
- sanitizer: none | |
cflags: | |
- sanitizer: ASAN | |
cflags: -fsanitize=address -fno-sanitize-recover=address | |
- sanitizer: UBSAN | |
cflags: -fsanitize=undefined -fno-sanitize-recover=undefined | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Install dependencies | |
run: | | |
sudo apt-get update | |
sudo apt-get install -y clang $DEPENDENCIES | |
- run: > | |
cmake -B build -G Ninja -DCMAKE_C_COMPILER=clang | |
-DCMAKE_C_FLAGS="$DEF_CFLAGS ${{matrix.cflags}}" | |
-DWIMLIB_BUILD_TESTS=1 | |
-DWIMLIB_FUZZ_TEST_SUPPORT=1 | |
- run: cmake --build build --verbose | |
- run: TMPDIR=$PWD/tmp.wlfuzz build/tests/wlfuzz 120 | |
fuzz-with-wlfuzz-windows: | |
name: Fuzz with wlfuzz (Windows) | |
runs-on: windows-latest | |
defaults: | |
run: | |
shell: msys2 {0} | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 # Need tags for tools/get-version-number.sh | |
- uses: msys2/setup-msys2@v2 | |
with: | |
msystem: MINGW64 | |
update: true | |
install: > | |
git | |
mingw-w64-x86_64-cmake | |
mingw-w64-x86_64-gcc | |
mingw-w64-x86_64-ninja | |
pkgconf | |
- run: > | |
CFLAGS="$DEF_CFLAGS" ./tools/windows-build.sh -- | |
-DWIMLIB_FUZZ_TEST_SUPPORT=1 -DWIMLIB_BUILD_TESTS=1 | |
- run: TMPDIR=$PWD/tmp.wlfuzz build/tests/wlfuzz 120 |