Skip to content

Commit

Permalink
Merge pull request #1254 from UniStuttgart-VISUS/actions
Browse files Browse the repository at this point in the history
Actions
  • Loading branch information
moritz-h authored Jul 24, 2024
2 parents 8e85c11 + 1a451c2 commit eb65e80
Show file tree
Hide file tree
Showing 25 changed files with 310 additions and 323 deletions.
13 changes: 0 additions & 13 deletions .ci/check-pr-labels-step-bash.yml

This file was deleted.

14 changes: 0 additions & 14 deletions .ci/check-pr-labels-step-pwsh.yml

This file was deleted.

6 changes: 3 additions & 3 deletions .ci/check_format.sh
Original file line number Diff line number Diff line change
Expand Up @@ -89,17 +89,17 @@ while read -r file; do
if [[ "$is_cpp" == true ]]; then
# ClangFormat
if [[ "$_fix" == true ]]; then
clang-format-16 -i "$file"
clang-format-17 -i "$file"
else
# Workaround "set -e" and store exit code
format_exit_code=0
output="$(clang-format-16 --dry-run --Werror "$file" 2>&1)" || format_exit_code=$?
output="$(clang-format-17 --dry-run --Werror "$file" 2>&1)" || format_exit_code=$?
if [[ $format_exit_code -ne 0 ]]; then
EXIT_CODE=1
echo "::error::ClangFormat found issues in: $file"
#echo "$output"
# Show detailed diff. Requires ClangFormat to run again, but should mostly affect only a few files.
clang-format-16 "$file" | diff --color=always -u "$file" - || true
clang-format-17 "$file" | diff --color=always -u "$file" - || true
fi
fi

Expand Down
4 changes: 2 additions & 2 deletions .ci/install-clang-format.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,5 @@ set -e
set -o pipefail

wget -qO - https://apt.llvm.org/llvm-snapshot.gpg.key | sudo tee /etc/apt/trusted.gpg.d/apt.llvm.org.asc
sudo add-apt-repository --yes "deb http://apt.llvm.org/jammy/ llvm-toolchain-jammy-16 main"
sudo apt-get install -y clang-format-16
sudo add-apt-repository --yes "deb http://apt.llvm.org/noble/ llvm-toolchain-noble-17 main"
sudo apt-get install -y clang-format-17
188 changes: 188 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,188 @@
name: Build

on:
push:
branches: [ master ]
pull_request:
branches: [ master ]
workflow_dispatch:

env:
MM_DEFAULT_CONFIG: >-
-DMEGAMOL_VCPKG_DOWNLOAD_CACHE=ON
-DMEGAMOL_WARNING_LEVEL="Off"
-DMEGAMOL_PLUGIN_MEGAMOL101_GL=ON
-DMEGAMOL_USE_CGAL=ON
-DMEGAMOL_USE_PROFILING=ON
-DMEGAMOL_USE_STACKTRACE=ON
-DMEGAMOL_USE_TRACY=ON
-DMEGAMOL_USE_VTKM=ON
MM_NO_GL_CONFIG: >-
-DMEGAMOL_VCPKG_DOWNLOAD_CACHE=ON
-DMEGAMOL_WARNING_LEVEL="Off"
-DMEGAMOL_USE_OPENGL=OFF
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: ''
ignore_features: 'MPI POWER'
- name: 'Ubuntu-GCC'
os: 'ubuntu-24.04'
container: 'ghcr.io/unistuttgart-visus/megamol_ci_ubuntu:master'
generator: 'Ninja'
cc: 'gcc-13'
cxx: 'g++-13'
ignore_features: 'CUESDK VR_INTEROP POWER'
- name: 'Ubuntu-Clang'
os: 'ubuntu-24.04'
container: 'ghcr.io/unistuttgart-visus/megamol_ci_ubuntu:master'
generator: 'Ninja'
cc: 'clang-18'
cxx: 'clang++-18'
ignore_features: 'CUESDK VR_INTEROP POWER'
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=$(LC_ALL=C.UTF-8 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]]
ignored = '${{ matrix.job.ignore_features }}'.split()
features = [f for f in features if f not in ignored]
with open('MEGAMOL_FEATURES', 'w') as f:
f.write(' '.join(features))
shell: python3 {0}
- 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 \
$(echo "${{ matrix.job.ignore_features }}" | sed -e 's/\([^ ]*\)/-DMEGAMOL_USE_\1=OFF/g')
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 }}"
build_windows:
if: ${{ always() }}
needs: vcpkg_cache
strategy:
fail-fast: false
matrix:
job:
- name: 'Release'
configuration: Release
no-gl: false
- name: 'Debug'
configuration: Debug
no-gl: false
- name: 'Release-No-GL'
configuration: Release
no-gl: true
name: "Windows-${{ matrix.job.name }}"
runs-on: windows-2022
steps:
- uses: actions/checkout@v4
with:
show-progress: false
- uses: ilammy/msvc-dev-cmd@0b201ec74fa43914dc39ae48a89fd1d8cb592756 # v1.13.0
- uses: seanmiddleditch/gha-setup-ninja@96bed6edff20d1dd61ecff9b75cc519d516e6401 # v5
with:
destination: $RUNNER_WORKSPACE/ninja-build
- name: Configure
run: >-
cmake -S . -B $GITHUB_WORKSPACE/build -G "Ninja"
${{ matrix.job.no-gl && env.MM_NO_GL_CONFIG || env.MM_DEFAULT_CONFIG }}
- name: Build
run: cmake --build $GITHUB_WORKSPACE/build --config ${{ matrix.job.configuration }} --parallel 2
build_linux:
if: ${{ always() }}
needs: vcpkg_cache
strategy:
fail-fast: false
matrix:
job:
- name: 'GCC-Debug'
container: megamol_ci_ubuntu
cc: gcc-13
cxx: g++-13
configuration: Debug
no-gl: false
- name: 'Clang-Release'
container: megamol_ci_ubuntu
cc: clang-18
cxx: clang++-18
configuration: Release
no-gl: false
- name: 'GCC-Release-No-GL'
container: megamol_ci_ubuntu
cc: gcc-13
cxx: g++-13
configuration: Release
no-gl: true
name: "Linux-${{ matrix.job.name }}"
runs-on: ubuntu-24.04
container:
image: ghcr.io/unistuttgart-visus/${{ matrix.job.container }}:master
steps:
- uses: actions/checkout@v4
with:
show-progress: false
- name: Configure
run: >-
cmake -S . -B $GITHUB_WORKSPACE/build -G Ninja -DCMAKE_BUILD_TYPE=${{ matrix.job.configuration }}
${{ matrix.job.no-gl && env.MM_NO_GL_CONFIG || env.MM_DEFAULT_CONFIG }}
- name: Build
run: cmake --build $GITHUB_WORKSPACE/build
env:
CC: ${{ matrix.job.cc }}
CXX: ${{ matrix.job.cxx }}
55 changes: 55 additions & 0 deletions .github/workflows/checks.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
name: Checks

on:
push:
branches: [ master ]
pull_request:
branches: [ master ]

jobs:
style_check:
name: Style-Check
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@v4
with:
show-progress: false
- name: Install clang-format
run: .ci/install-clang-format.sh
- name: Run format check
run: .ci/check_format.sh
- name: Save PR number
if: ${{ failure() && github.event_name == 'pull_request' }}
run: |
mkdir -p ./pr
echo ${{ github.event.number }} > ./pr/NR
- uses: actions/upload-artifact@v3
if: ${{ failure() && github.event_name == 'pull_request' }}
with:
name: pr
path: pr/
plugin_check:
name: Plugin-Check
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@v4
with:
show-progress: false
- name: Run plugin check
run: .ci/check_plugins.sh
shader_check:
name: Shader-Check
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@v4
with:
show-progress: false
- name: Download glslang
run: |
mkdir bin
wget "https://github.com/KhronosGroup/glslang/releases/download/main-tot/glslang-main-linux-Release.zip"
unzip -j "glslang-main-linux-Release.zip" "bin/glslang" -d ./bin
rm "glslang-main-linux-Release.zip"
echo "./bin" >> $GITHUB_PATH
- name: Run shader check
run: .ci/check_shaders.sh
12 changes: 7 additions & 5 deletions .github/workflows/docker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,26 +20,28 @@ jobs:
- dockerfile_dir: oraclelinux
image_name: megamol_ci_oraclelinux
name: Docker-Build
runs-on: ubuntu-22.04
runs-on: ubuntu-24.04
permissions:
contents: read
packages: write
steps:
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
show-progress: false
- name: Docker login
uses: docker/login-action@v2
uses: docker/login-action@v3
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Docker metadata
id: meta
uses: docker/metadata-action@v4
uses: docker/metadata-action@v5
with:
images: ${{ env.REGISTRY }}/${{ github.repository_owner }}/${{ matrix.config.image_name }}
- name: Docker build/push
uses: docker/build-push-action@v3
uses: docker/build-push-action@v6
with:
context: .ci/docker/${{ matrix.config.dockerfile_dir }}
push: true
Expand Down
23 changes: 0 additions & 23 deletions .github/workflows/shader_check.yml

This file was deleted.

35 changes: 0 additions & 35 deletions .github/workflows/style_check.yml

This file was deleted.

Loading

0 comments on commit eb65e80

Please sign in to comment.