Skip to content

Actions

Actions #5

Workflow file for this run

name: Vcpkg Cache
on:
push:
branches: [ master ]
pull_request:
branches: [ master ]
workflow_dispatch:
jobs:
vcpkg_cache:
# Skip on PR from forked repo as no secrets are available.
if: ${{ github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name == github.repository }}
strategy:
fail-fast: false
matrix:
job:
- name: 'Windows'
os: 'windows-2022'
container: ''
generator: 'Visual Studio 17 2022'
cc: ''
cxx: ''
- name: 'Ubuntu-GCC'
os: 'ubuntu-24.04'
container: 'ghcr.io/unistuttgart-visus/megamol_ci_ubuntu:master'
generator: 'Ninja'
cc: 'gcc-13'
cxx: 'g++-13'
- name: 'Ubuntu-Clang'
os: 'ubuntu-24.04'
container: 'ghcr.io/unistuttgart-visus/megamol_ci_ubuntu:master'
generator: 'Ninja'
cc: 'clang-18'
cxx: 'clang++-18'
name: "Vcpkg-${{ matrix.job.name }}"
runs-on: ${{ matrix.job.os }}
container:
image: ${{ matrix.job.container }}
steps:
- uses: actions/checkout@v4
with:
show-progress: false
- name: Download Vcpkg
# Download vcpkg in advance, to download only once. MegaMol will detect the vcpkg directory in the repo root
# folder automatically.
run: |
version=$(grep -oP 'set\(MEGAMOL_VCPKG_VERSION "\K[^"]+' CMakeLists.txt)
git clone https://github.com/microsoft/vcpkg.git vcpkg
cd vcpkg && git reset --hard $version && cd ..
shell: bash
- name: Find MegaMol Feature Options
run: |
import json
with open('vcpkg.json') as f:
features = json.load(f)['features']
features = [f.upper().replace('-', '_') for f in features if 'dependencies' in features[f]]
with open('MEGAMOL_FEATURES', 'w') as f:
f.write(' '.join(features))
shell: python
- name: Build Vcpkg Ports
# Vcpkg ports may are required with different feature sets, based on the MegaMol features, e.g., `megamol`
# requires `a` and `megamol[foo]` requires `a[bar]`. We need to build both `a` and `a[foo]` for the cache. The
# problem extents to all transitive dependencies. Because we cannot try to build all possible combinations of
# enabled MegaMol features, we use the following heuristic to hopefully cover most cases: 1. MegaMol with no
# features, 2. MegaMol with all features, 3. For every feature MegaMol with only this feature enabled.
run: |
echo "::group::Build Cache No Features"
cmake -S . -B "$GITHUB_WORKSPACE/build" -G "${{ matrix.job.generator }}" -DMEGAMOL_STOP_AFTER_VCPKG=ON -DMEGAMOL_DISABLE_ALL_FEATURES=ON
rm -rf "$GITHUB_WORKSPACE/build"
echo "::endgroup::"
echo "::group::Build Cache All Features"
cmake -S . -B "$GITHUB_WORKSPACE/build" -G "${{ matrix.job.generator }}" -DMEGAMOL_STOP_AFTER_VCPKG=ON -DMEGAMOL_ENABLE_ALL_FEATURES=ON
rm -rf "$GITHUB_WORKSPACE/build"
echo "::endgroup::"
features=$(<MEGAMOL_FEATURES)
for feature in $features; do
echo "::group::Build Cache Feature $feature"
cmake -S . -B "$GITHUB_WORKSPACE/build" -G "${{ matrix.job.generator }}" -DMEGAMOL_STOP_AFTER_VCPKG=ON -DMEGAMOL_DISABLE_ALL_FEATURES=ON -DMEGAMOL_USE_$feature=ON
rm -rf "$GITHUB_WORKSPACE/build"
echo "::endgroup::"
done
shell: bash
env:
CC: ${{ matrix.job.cc }}
CXX: ${{ matrix.job.cxx }}
VCPKG_BINARY_SOURCES: "clear;http,https://vcpkg-cache.megamol.org/{triplet}-{name}-{sha},readwrite,Authorization: Token ${{ secrets.CACHING_SERVER_SECRET }}"