CI: Test vcpkg PR #76
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: Build VisualNeuro | |
on: | |
push: | |
branches: | |
- master | |
pull_request: | |
permissions: | |
contents: write # Enable vcpkg to write to the dependency graph | |
env: | |
VCPKG_BINARY_SOURCES: 'clear;x-gha,readwrite' # recognized by vcpkg | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
VCPKG_FEATURE_FLAGS: dependencygraph | |
jobs: | |
build: | |
name: "Build" | |
strategy: | |
matrix: | |
system: [windows, macos, linux] | |
linkage: [dynamic] | |
cmake_linkage: ['ON'] | |
configuration: [Release] | |
include: | |
- system: windows | |
os: 'windows-latest' | |
triplet: 'x64-windows' | |
cmake: '-DIVW_MODULE_HDF5=OFF' | |
preset: msvc-visualneuro | |
targets: 'ALL_BUILD package' | |
installer: 'visualneuro-installer-win' | |
artifact: 'build/Visual Neuro-v*.exe' | |
- system: macos | |
os: 'macos-13' # for now macos-latest == macos-12 since macos-13 is still "beta" | |
triplet: 'x64-osx' | |
cmake: '-DVCPKG_APPLOCAL_DEPS=OFF' | |
preset: ninja-visualneuro | |
targets: 'all package' | |
installer: 'visualneuro-installer-macos' | |
artifact: 'build/Visual Neuro-v*.dmg' | |
- system: linux | |
os: 'ubuntu-22.04' | |
triplet: 'x64-linux' | |
cmake: '-DIVW_PACKAGE_INSTALLER=OFF' | |
preset: ninja-visualneuro | |
targets: 'all package' | |
installer: 'visualneuro-installer-ubuntu' | |
artifact: 'build/Visual Neuro-v*.tar.gz' | |
fail-fast: false | |
runs-on: ${{ matrix.os }} | |
timeout-minutes: 360 | |
steps: | |
- name: Chocolatey Install | |
if: runner.os == 'Windows' | |
shell: pwsh | |
run: | | |
# Choco-Install is GH Actions wrappers around choco, which does retries | |
# https://github.com/actions/runner-images/blob/main/images/windows/scripts/helpers/ChocoHelpers.ps1 | |
Install-ChocoPackage -PackageName nsis | |
- name: "Chocolatey update paths" | |
if: runner.os == 'Windows' | |
shell: bash | |
run: | | |
GP=`cygpath -u $GITHUB_PATH` | |
echo "/c/Program Files/doxygen/bin" >> $GP | |
echo "/c/Program Files (x86)/NSIS" >> $GP | |
- name: Brew Install | |
shell: bash | |
if: runner.os == 'macOS' | |
# xcode 14.3 is currently default. | |
run: | | |
brew install ninja pkg-config nasm | |
sudo xcode-select --switch /Applications/Xcode_15.0.app/Contents/Developer | |
- name: "Apt Install, switch to gcc-13" | |
shell: bash | |
if: runner.os == 'Linux' | |
run: | | |
sudo apt-get update | |
sudo apt install --fix-missing libxinerama-dev libxcursor-dev xorg-dev libglu1-mesa-dev \ | |
libglew-dev ninja-build gcc-13 g++-13 nasm | |
sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-13 130 \ | |
--slave /usr/bin/g++ g++ /usr/bin/g++-13 \ | |
--slave /usr/bin/gcov gcov /usr/bin/gcov-12 | |
sudo update-alternatives --set gcc /usr/bin/gcc-13 | |
- name: "Install Qt" | |
uses: jurplel/install-qt-action@v3 | |
with: | |
version: 6.6.0 | |
dir: ${{ github.workspace }} | |
- name: Setup Python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: '3.12' | |
architecture: 'x64' | |
- name: "Install Python Modules" | |
shell: bash | |
run: pip3 install numpy | |
- name: "Setup MSVC" | |
if: runner.os == 'Windows' | |
uses: ilammy/msvc-dev-cmd@v1 | |
- name: "VCPKG Update" | |
shell: bash | |
run: | | |
echo $VCPKG_INSTALLATION_ROOT | |
cd $VCPKG_INSTALLATION_ROOT | |
git reset --hard | |
git pull | |
- name: "VCPKG Cache config" | |
# Cache built dependencies for faster subsequent builds | |
# https://learn.microsoft.com/en-us/vcpkg/users/binarycaching#gha | |
uses: actions/github-script@v7 | |
with: | |
script: | | |
core.exportVariable('ACTIONS_CACHE_URL', process.env.ACTIONS_CACHE_URL || ''); | |
core.exportVariable('ACTIONS_RUNTIME_TOKEN', process.env.ACTIONS_RUNTIME_TOKEN || ''); | |
- name: "Clone Inviwo" | |
uses: actions/checkout@v4 | |
with: | |
repository: 'inviwo/inviwo' | |
ref: '1abb2b923c51d684af8b6205c3b3e8ece2f86c6a' | |
path: 'inviwo' | |
submodules: recursive | |
- name: "Clone VisualNeuro" | |
uses: actions/checkout@v4 | |
with: | |
path: visualneuro | |
submodules: recursive | |
- name: "Copy CMakePresets to Inviwo" | |
shell: bash | |
run: > | |
cp "visualneuro/CMakePresets.json" "inviwo/CMakeUserPresets.json" | |
- name: "Configure CMake" | |
shell: bash | |
run: > | |
VCPKG_ROOT=$VCPKG_INSTALLATION_ROOT && cmake -S inviwo -B build --preset ${{ matrix.preset }} | |
--toolchain $VCPKG_INSTALLATION_ROOT/scripts/buildsystems/vcpkg.cmake | |
-DCMAKE_TOOLCHAIN_FILE=$VCPKG_INSTALLATION_ROOT/scripts/buildsystems/vcpkg.cmake | |
-DVCPKG_TARGET_TRIPLET=${{ matrix.triplet }} | |
-DVCPKG_INSTALL_OPTIONS='--clean-after-build' | |
-DBUILD_SHARED_LIBS=${{ matrix.cmake_linkage }} | |
-DCMAKE_BUILD_TYPE=${{ matrix.configuration }} | |
${{ matrix.cmake }} | |
- name: "Setup C++ Log matchers" | |
uses: Trass3r/setup-cpp@v1 | |
- name: "Build" | |
timeout-minutes: 360 | |
shell: bash | |
run: cmake --build build --config ${{ matrix.configuration }} --parallel --target ${{ matrix.targets }} | |
- name: "Upload installer" | |
uses: actions/upload-artifact@v4 | |
with: | |
name: ${{ matrix.installer }} | |
path: ${{ matrix.artifact }} | |