Skip to content

GHA: initial workflow #24

GHA: initial workflow

GHA: initial workflow #24

Workflow file for this run

name: "Build Inviwo Modules"
on:
push:
branches:
- master
pull_request:
workflow_dispatch:
inputs:
debug_enabled:
type: boolean
description: 'Run the build with tmate debugging enabled (https://github.com/marketplace/actions/debugging-with-tmate)'
required: false
default: false
permissions:
contents: write # Enable vcpkg to write to the dependency graph
env:
VCPKG_BINARY_SOURCES: 'clear;http,https://jenkins.inviwo.org/cache/{sha},readwrite,Authorization: Bearer ${{ secrets.VCPKG_CACHE_TOKEN }}'
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
VCPKG_FEATURE_FLAGS: dependencygraph
# QT_DEBUG_PLUGINS: 1 # print qt plugin debug info
# Information about the github runners can be found here
# https://github.com/actions/runner-images
jobs:
build:
name: "Build"
strategy:
matrix:
system: [windows, macos, linux]
linkage: [dynamic, static]
configuration: [Release, Debug]
include:
- system: windows
os: 'windows-2022'
targets: 'ALL_BUILD'
installer: 'inviwo-installer-win'
artifact: 'build/inviwo-v*.exe'
run: |
./Release/inviwo-cli.exe --logconsole --quit
if [ $? -nq 0 ]
then
C:/'Program Files (x86)'/'Windows Kits'/10/Debuggers/x64/gflags.exe /i ./Release/inviwo-cli.exe +sls
C:/'Program Files (x86)'/'Windows Kits'/10/Debuggers/x64/cdb.exe -g -c q ./Release/inviwo-cli.exe
fi
- system: macos
os: 'macos-15'
targets: 'ALL_BUILD'
installer: 'inviwo-installer-macos'
artifact: 'build/inviwo-v*.dmg'
- system: linux
os: 'ubuntu-24.04'
targets: 'all'
installer: 'inviwo-installer-ubuntu'
artifact: 'build/inviwo-v*.deb'
run: QT_QPA_PLATFORM=offscreen ./inviwo --logconsole --quit
# set triplets
- system: 'windows'
linkage: 'dynamic'
triplet: 'x64-windows'
- system: 'windows'
linkage: 'static'
triplet: 'x64-windows-static-md'
- system: 'macos'
linkage: 'dynamic'
triplet: 'arm64-osx-dynamic'
- system: 'macos'
linkage: 'static'
triplet: 'arm64-osx'
- system: 'linux'
linkage: 'dynamic'
triplet: 'x64-linux-dynamic'
- system: 'linux'
linkage: 'static'
triplet: 'x64-linux'
# Run
- system: 'macos'
configuration: Release
run: './Release/inviwo.app/Contents/MacOS/inviwo --logconsole --quit'
- system: 'macos'
configuration: Debug
run: './Debug/inviwo.app/Contents/MacOS/inviwo --logconsole --quit'
# extra targets
- system: windows
linkage: dynamic
configuration: Release
targets: 'ALL_BUILD DOXY-Inviwo DOXY-Python package'
#- system: macos # Disable mac packaging since it probably runs out of diskspace
# linkage: dynamic
# configuration: Release
# targets: 'all package'
- system: linux
linkage: dynamic
configuration: Release
targets: 'all package'
exclude:
# Windows debug build are to big, they run out of diskspace
- system: windows
configuration: Debug
# This build fails very close to the end with "ninja: build stopped: interrupted by user."
- system: linux
linkage: static
configuration: Debug
fail-fast: false
runs-on: ${{ matrix.os }}
timeout-minutes: 360
steps:
- name: "Clone Modules"
uses: actions/checkout@v4
with:
path: modules
submodules: true
- name: "Clone Inviwo"
uses: actions/checkout@v4
with:
repository: inviwo/inviwo
ref: master
path: inviwo
submodules: false
- name: Install dependencies
uses: ./inviwo/.github/actions/install-dependencies
- name: "Brew Install"
shell: bash
if: runner.os == 'macOS'
run: |
brew install bison
- name: Configure build environment
uses: ./inviwo/.github/actions/configure-build-env
with:
triplet: ${{ matrix.triplet }}
configuration: ${{ matrix.configuration }}
- name: Copy Preset
shell: bash
run: cp modules/.github/presets/${{ matrix.system }}.json inviwo/CMakeUserPresets.json
- name: "Configure CMake"
shell: bash
run: >
cmake -S inviwo -B build --preset gha-${{ matrix.linkage }}
-DCMAKE_BUILD_TYPE=${{ matrix.configuration }}
-DVCPKG_INSTALL_OPTIONS='--clean-after-build'
- name: "Build"
timeout-minutes: 360
shell: bash
run: |
echo "::add-matcher::inviwo/.github/matchers/${{ matrix.system }}.json"
cmake --build build --config ${{ matrix.configuration }} --parallel --target ${{ matrix.targets }}
echo "::remove-matcher owner=compiler::"
echo "::remove-matcher owner=linker::"
- name: "Run"
shell: bash
working-directory: "build/bin"
run: ${{ matrix.run }}
- name: "Unittests"
shell: bash
working-directory: "build"
run: ctest -C ${{ matrix.configuration }} --output-on-failure
- name: "Upload installer"
if: matrix.linkage == 'dynamic' && matrix.configuration == 'Release'
uses: actions/upload-artifact@v4
with:
name: ${{ matrix.installer }}
path: ${{ matrix.artifact }}
- name: "Upload doxygen"
if: matrix.system == 'windows' && matrix.linkage == 'dynamic' && matrix.configuration == 'Release'
uses: actions/upload-artifact@v4
with:
name: inviwo-cpp-api
path: build/docs/inviwo/html/*
- name: "Upload shpinx"
if: matrix.system == 'windows' && matrix.linkage == 'dynamic' && matrix.configuration == 'Release'
uses: actions/upload-artifact@v4
with:
name: inviwo-python-api
path: build/docs/python-api/*
- name: "Setup tmate session (on failure and debug_enabled)"
if: "${{ failure() && contains( github.event.pull_request.labels.*.name, 'CI: Debug') }}"
uses: mxschmitt/action-tmate@v3
timeout-minutes: 30
with:
limit-access-to-actor: true
- name: "Upload Vcpkg build Logs"
if: "${{ failure() }}"
uses: actions/upload-artifact@v4
with:
name: vcpkg-logs-${{ matrix.system }}-${{ matrix.linkage }}-${{ matrix.configuration }}
path: vcpkg/buildtrees/**/*.log
regression:
name: "Regression"
runs-on: [regression, macOS]
timeout-minutes: 320
steps:
- name: "Clone Modules"
uses: actions/checkout@v4
with:
path: modules
submodules: true
- name: "Clone Inviwo"
uses: actions/checkout@v4
with:
repository: inviwo/inviwo
ref: master
path: inviwo
submodules: false
- name: Copy Preset
shell: bash
run: cp modules/.github/presets/macos.json inviwo/CMakeUserPresets.json
- name: "Configure CMake"
shell: bash
run: >
VCPKG_ROOT=$VCPKG_INSTALLATION_ROOT && cmake -S inviwo -B build --preset gha-dynamic
--toolchain $VCPKG_INSTALLATION_ROOT/scripts/buildsystems/vcpkg.cmake
-DCMAKE_CXX_FLAGS='-stdlib=libc++'
-DVCPKG_TARGET_TRIPLET=x64-osx-dynamic
-DVCPKG_HOST_TRIPLET=x64-osx-dynamic
-DCMAKE_BUILD_TYPE=RelWithDebInfo
-DCMAKE_EXPORT_COMPILE_COMMANDS=ON
-DIVW_MODULE_EIGENUTILS=ON
-DIVW_MODULE_HDF5=ON
-DIVW_MODULE_TETRAMESH=OFF
-DIVW_MODULE_WEBBROWSER=ON
- name: "Build"
timeout-minutes: 360
shell: bash
run: |
echo "::add-matcher::inviwo/.github/matchers/macos.json"
cmake --build build --config RelWithDebInfo --parallel --target ALL_BUILD
echo "::remove-matcher owner=compiler::"
echo "::remove-matcher owner=linker::"
- name: "Unit Tests"
shell: bash
working-directory: "build"
continue-on-error: true
run: ctest -C RelWithDebInfo --output-on-failure
- name: "Integration Tests"
shell: bash
working-directory: "build/bin"
continue-on-error: true
run: ./inviwo-integrationtests
- name: "Clone Regression"
uses: actions/checkout@v4
with:
repository: inviwo/regression
ref: main
token: ${{ secrets.INVIWO_TEAM_SECRET }}
path: regression
- name: "Regression Tests"
shell: bash
continue-on-error: true
run: |
mkdir -p regression/modules/macos/${{ github.ref }}
python3 inviwo/tools/regression.py \
--config build/pyconfig.ini \
--build_type RelWithDebInfo \
--output regression/modules/macos/${{ github.ref }} \
--modules inviwo/modules \
--summary
- name: Push report
shell: bash
run: |
cd regression
git config --global user.name 'Inviwo-Team'
git config --global user.email '[email protected]'
git add .
git commit -am "Regression report for macos ${{ github.ref }}"
git push
echo "### :chart_with_upwards_trend: Regression report at https://inviwo.org/regression/modules/macos/${{ github.ref }}/report.html " >> $GITHUB_STEP_SUMMARY
clang-tidy:
name: "Clang-tidy"
if: github.ref != 'refs/heads/master'
permissions:
pull-requests: write
env:
LLVM_VERSION: 17
runs-on: ubuntu-24.04
timeout-minutes: 320
steps:
- name: "Clone Modules"
uses: actions/checkout@v4
with:
path: modules
submodules: true
- name: "Clone Inviwo"
uses: actions/checkout@v4
with:
repository: inviwo/inviwo
ref: master
path: inviwo
submodules: false
- name: "Install dependencies"
uses: ./inviwo/.github/actions/install-dependencies
with:
linux-compilter: clang
clang-version: ${{ env.LLVM_VERSION }}
- name: "Configure build environment"
uses: ./inviwo/.github/actions/configure-build-env
with:
triplet: x64-linux-dynamic
configuration: Release
ccache: false
- name: "Copy Preset"
shell: bash
run: cp modules/.github/presets/linux.json inviwo/CMakeUserPresets.json
- name: "Configure CMake"
shell: bash
run: >
cmake -S inviwo -B build --preset gha-dynamic
-DCMAKE_CXX_FLAGS='-stdlib=libc++'
-DVCPKG_INSTALL_OPTIONS='--clean-after-build'
-DCMAKE_BUILD_TYPE=Release
-DCMAKE_EXPORT_COMPILE_COMMANDS=ON
-DIVW_MODULE_WEBBROWSER=ON
-DIVW_MODULE_SGCT=ON
-DIVW_APP_INVIWO_DOME=ON
-DVCPKG_MANIFEST_FEATURES="sgct"
- name: "Run clang-tidy"
uses: cpp-linter/[email protected]
id: linter
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
repo-root: inviwo
database: ../build
style: 'file'
tidy-checks: ''
version: ${{ env.LLVM_PATH }}
tidy-review: true
format-review: false
step-summary: true
no-lgtm: false
lines-changed-only: true
thread-comments: update
file-annotations: false
verbosity: debug
- name: "Setup tmate session (on failure and debug_enabled)"
if: "${{ failure() && contains( github.event.pull_request.labels.*.name, 'CI: Debug') }}"
uses: mxschmitt/action-tmate@v3
timeout-minutes: 30
with:
limit-access-to-actor: true
test-installer:
name: "Test Installer"
needs: build
strategy:
fail-fast: false
matrix:
os: [windows-latest] # macos-latest,
include:
- os: 'windows-latest'
installer: 'inviwo-installer-win'
#- os: 'macos-latest'
# installer: 'inviwo-installer-macos'
runs-on: ${{ matrix.os }}
steps:
- name: "Download artifact"
uses: actions/download-artifact@v4
with:
name: ${{ matrix.installer }}
# Windows
- name: "Run Windows Installer"
if: runner.os == 'Windows'
shell: pwsh
run: |
# find the name of the installer
$exe = Get-ChildItem -Name inviwo-*.exe
# launch the nsis installer in "silent mode" (/S), should run without user interaction
Invoke-expression "./$exe /S"
# this will spawn the installer in the background so we need to wait for it to finish
$proc = Get-Process | where {$_.ProcessName -like "inviwo-*"} | Select-Object -First 1
if ($proc) {
Wait-Process -Id $proc.id
}
- name: "Run Inviwo"
if: runner.os == 'Windows'
shell: pwsh
run: |
$ver = (Get-ChildItem -Name C:/"Program Files"/Inviwo/*)
Invoke-expression "C:/'Program Files'/Inviwo/$ver/bin/inviwo-cli.exe --logconsole --quit"
if($LASTEXITCODE -ne 0) {
Invoke-expression "C:\'Program Files (x86)'\'Windows Kits'\10\Debuggers\x64\gflags.exe /i C:/'Program Files'/Inviwo/$ver/bin/inviwo-cli.exe +sls"
Invoke-Expression "C:\'Program Files (x86)'\'Windows Kits'\10\Debuggers\x64\cdb.exe -g -c q C:/'Program Files'/Inviwo/$ver/bin/inviwo-cli.exe"
}
# Macos
- name: "Run MacOS Installer"
if: runner.os == 'macOS'
shell: bash
run: |
# Find the name of the installer
DMG=$(ls Inviwo-*.dmg)
# Mount installer image
hdiutil attach $DMG
# Install by copying Inviwo.app to applications folder
cp -r /Volumes/${DMG%%.dmg}/Inviwo.app /Applications/
hdiutil detach /Volumes/${DMG%%.dmg}/
- name: "Run Inviwo"
if: runner.os == 'macOS'
shell: bash
run: |
cd /Applications/Inviwo.app/Contents/MacOS/
./inviwo --logconsole --quit
- name: "Setup tmate session (on failure and debug_enabled)"
if: "${{ failure() && contains( github.event.pull_request.labels.*.name, 'CI: Debug') }}"
uses: mxschmitt/action-tmate@v3
timeout-minutes: 30
with:
limit-access-to-actor: true
create-changelog:
name: "Create Changelog"
runs-on: ubuntu-latest
steps:
- name: "Generate Changelog"
id: changelog
uses: mikepenz/release-changelog-builder-action@v5
with:
toTag: ${{ github.ref }}
outputFile: changelog.md
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: "Log Changelog"
shell: bash
run: |
echo "-- Changes --"
echo "${{ steps.changelog.outputs.changelog }}"
echo "-- End --"
- name: "Upload Changelog"
uses: actions/upload-artifact@v3
with:
name: changelog.md
path: changelog.md