Skip to content

SAIL: Simplify cache keys #126

SAIL: Simplify cache keys

SAIL: Simplify cache keys #126

name: Build and Test
on:
push:
branches: [ master, main ]
pull_request:
branches: [ master, main ]
workflow_dispatch:
jobs:
build-linux-macos:
name: Build and Test on ${{ matrix.os }} - ${{ matrix.config.name }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-latest]
config:
- { name: "Shared", build_shared: "ON", combine_codecs: "OFF" }
- { name: "Shared Combined", build_shared: "ON", combine_codecs: "ON" }
- { name: "Static", build_shared: "OFF", combine_codecs: "OFF" }
steps:
- uses: actions/checkout@v4
with:
submodules: recursive
- name: Install dependencies (Linux)
if: runner.os == 'Linux'
run: |
sudo apt-get update
sudo apt-get install -y cmake libavif-dev libgif-dev libheif-dev libheif-plugin-x265 \
libjbig-dev libjpeg-dev libjxl-dev libnanosvg-dev libopenexr-dev \
libopenjp2-7-dev libopenjpip-dec-server libopenjpip-server \
libpng-dev libraw-dev libsdl2-dev libtiff-dev libwebp-dev zlib1g-dev
- name: Install dependencies (macOS)
if: runner.os == 'macOS'
run: |
brew install giflib jbigkit jpeg-turbo jpeg-xl libavif libheif libpng libraw libtiff openexr openjpeg resvg webp
- name: Configure CMake
run: |
cmake -S . -B build \
-DCMAKE_BUILD_TYPE=Debug \
-DCMAKE_INSTALL_PREFIX=/usr/local \
-DBUILD_SHARED_LIBS=${{ matrix.config.build_shared }} \
-DSAIL_DEV=ON \
-DSAIL_COMBINE_CODECS=${{ matrix.config.combine_codecs }}
- name: Build
run: cmake --build build -j$(nproc)
- name: Install
run: |
sudo make -C build install
- name: Run tests
run: ctest --test-dir build --output-on-failure -j$(nproc)
- name: Test SAIL binary (Linux)
if: runner.os == 'Linux'
run: |
sudo ldconfig
/usr/local/bin/sail --version
- name: Test SAIL binary (macOS)
if: runner.os == 'macOS'
run: |
export DYLD_LIBRARY_PATH=/usr/local/lib:$DYLD_LIBRARY_PATH
/usr/local/bin/sail --version
- name: Test external C API link
run: |
rm -rf tests/external/link/c/build
mkdir tests/external/link/c/build
cmake -S tests/external/link/c -B tests/external/link/c/build \
-DSAIL_DEV=ON \
-DCMAKE_BUILD_TYPE=Debug
cmake --build tests/external/link/c/build -j$(nproc)
tests/external/link/c/build/external-c-api-link
- name: Test external C++ API link
run: |
rm -rf tests/external/link/c++/build
mkdir tests/external/link/c++/build
cmake -S tests/external/link/c++ -B tests/external/link/c++/build \
-DSAIL_DEV=ON \
-DCMAKE_BUILD_TYPE=Debug
cmake --build tests/external/link/c++/build -j$(nproc)
tests/external/link/c++/build/external-c++-api-link
build-windows:
name: Build and Test on Windows - ${{ matrix.config.name }}
runs-on: windows-latest
env:
VCPKG_DEFAULT_BINARY_CACHE: ${{ github.workspace }}/vcpkg/archives
strategy:
fail-fast: false
matrix:
config:
- { name: "Shared", build_shared: "ON", combine_codecs: "OFF", static_crt: "OFF", triplet: "x64-windows", appflags: "/MDd" }
- { name: "Shared Combined", build_shared: "ON", combine_codecs: "ON", static_crt: "OFF", triplet: "x64-windows", appflags: "/MDd" }
- { name: "Static /MT", build_shared: "OFF", combine_codecs: "OFF", static_crt: "ON", triplet: "x64-windows-static", appflags: "/MTd" }
- { name: "Static /MD", build_shared: "OFF", combine_codecs: "OFF", static_crt: "OFF", triplet: "x64-windows-static-md", appflags: "/MDd" }
steps:
- uses: actions/checkout@v4
with:
submodules: recursive
- name: Cache vcpkg
uses: actions/cache@v4
with:
path: vcpkg
key: vcpkg-${{ hashFiles('vcpkg.json') }}
- name: Set up vcpkg
shell: bash
run: |
if [ ! -f "vcpkg/vcpkg.exe" ]; then
rm -rf vcpkg
git clone https://github.com/microsoft/vcpkg.git
cd vcpkg
./bootstrap-vcpkg.bat
fi
- name: Configure CMake
shell: bash
run: |
mkdir -p "$VCPKG_DEFAULT_BINARY_CACHE"
cmake -S . -B build \
-DCMAKE_BUILD_TYPE=Debug \
-DCMAKE_INSTALL_PREFIX=C:/SAIL \
-DBUILD_SHARED_LIBS=${{ matrix.config.build_shared }} \
-DSAIL_DEV=ON \
-DSAIL_COMBINE_CODECS=${{ matrix.config.combine_codecs }} \
-DSAIL_WINDOWS_STATIC_CRT=${{ matrix.config.static_crt }} \
-DCMAKE_TOOLCHAIN_FILE="${{ github.workspace }}/vcpkg/scripts/buildsystems/vcpkg.cmake" \
-DVCPKG_TARGET_TRIPLET=${{ matrix.config.triplet }} \
-DVCPKG_MANIFEST_DIR="${{ github.workspace }}" \
-DVCPKG_INSTALL_OPTIONS="--clean-buildtrees-after-build"
- name: Build
run: cmake --build build --config Debug --target install "-j$env:NUMBER_OF_PROCESSORS"
- name: Run tests
run: ctest --test-dir build/tests -C Debug --output-on-failure "-j$env:NUMBER_OF_PROCESSORS"
- name: Test SAIL binary
run: C:/SAIL/bin/sail.exe --version
- name: Test external C API link
working-directory: tests/external/link/c
run: |
mkdir build
cmake -S . -B build `
-DCMAKE_BUILD_TYPE=Debug `
-DCMAKE_PREFIX_PATH=C:/SAIL/lib/cmake `
-DCMAKE_C_FLAGS_DEBUG=${{ matrix.config.appflags }} `
-DCMAKE_TOOLCHAIN_FILE=${{ github.workspace }}/vcpkg/scripts/buildsystems/vcpkg.cmake `
-DVCPKG_TARGET_TRIPLET=${{ matrix.config.triplet }} `
-DVCPKG_MANIFEST_DIR=${{ github.workspace }}
cmake --build build --config Debug "-j$env:NUMBER_OF_PROCESSORS"
- name: Test external C++ API link
working-directory: tests/external/link/c++
run: |
mkdir build
cmake -S . -B build `
-DCMAKE_BUILD_TYPE=Debug `
-DCMAKE_PREFIX_PATH=C:/SAIL/lib/cmake `
-DCMAKE_CXX_FLAGS_DEBUG=${{ matrix.config.appflags }} `
-DCMAKE_TOOLCHAIN_FILE=${{ github.workspace }}/vcpkg/scripts/buildsystems/vcpkg.cmake `
-DVCPKG_TARGET_TRIPLET=${{ matrix.config.triplet }} `
-DVCPKG_MANIFEST_DIR=${{ github.workspace }}
cmake --build build --config Debug "-j$env:NUMBER_OF_PROCESSORS"