ci: migrate from Jenkins to GitHub Actions

This commit is contained in:
Dennis Klein
2025-11-27 20:48:55 +01:00
committed by Dennis Klein
parent dcea48fcee
commit 7a8ccb8df6
9 changed files with 220 additions and 308 deletions

35
.github/actions/setup-deps/action.yml vendored Normal file
View File

@@ -0,0 +1,35 @@
name: Setup Dependencies
description: Setup spack and install dependencies
inputs:
gcc:
description: 'GCC version to use'
required: true
fresh:
description: 'Use fresh concretization'
default: 'false'
runs:
using: composite
steps:
- name: Setup spack
uses: spack/setup-spack@v2
with:
ref: v1.1.0
color: true
buildcache: true
- name: Install GCC
shell: spack-bash {0}
run: |
spack install gcc@${{ inputs.gcc }}
spack compiler find $(spack location -i gcc@${{ inputs.gcc }})
- name: Install dependencies
shell: spack-bash {0}
run: |
spack env create fairmq test/ci/spack.yaml
spack -e fairmq add gcc@${{ inputs.gcc }}
spack -e fairmq config add "packages:all:require:'%gcc@${{ inputs.gcc }}'"
spack -e fairmq install --fail-fast ${{ inputs.fresh == 'true' && '--fresh' || '' }}
spack env activate --sh fairmq | grep '^export ' | sed 's/^export //;s/;$//' >> $GITHUB_ENV

42
.github/workflows/buildcache.yml vendored Normal file
View File

@@ -0,0 +1,42 @@
name: Spack Buildcache
on:
workflow_dispatch:
schedule:
- cron: '0 3 * * 0' # Weekly on Sunday at 3am UTC
push:
paths:
- 'test/ci/spack.yaml'
- '.github/workflows/buildcache.yml'
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
build:
if: github.repository == 'FairRootGroup/FairMQ'
name: gcc-${{ matrix.gcc }}
runs-on: ubuntu-latest
permissions:
packages: write
strategy:
fail-fast: false
matrix:
gcc: ['12', '13', '14', '15']
env:
GITHUB_USER: ${{ github.actor }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
steps:
- uses: actions/checkout@v4
- uses: ./.github/actions/setup-deps
with:
gcc: ${{ matrix.gcc }}
fresh: true
- name: Push to buildcache
if: ${{ !cancelled() }}
run: spack buildcache push --unsigned --update-index local-buildcache

126
.github/workflows/ci.yml vendored Normal file
View File

@@ -0,0 +1,126 @@
name: CI
on:
push:
branches: [master, dev]
pull_request:
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
build:
if: github.repository == 'FairRootGroup/FairMQ'
name: gcc-${{ matrix.gcc }}
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
gcc: ['12', '13', '14', '15']
steps:
- uses: actions/checkout@v4
with:
submodules: true
fetch-tags: true
fetch-depth: 0
- uses: ./.github/actions/setup-deps
with:
gcc: ${{ matrix.gcc }}
- name: Configure and Build
uses: threeal/cmake-action@v2
with:
generator: Ninja
options: |
CMAKE_BUILD_TYPE=RelWithDebInfo
CMAKE_INSTALL_PREFIX=${{ github.workspace }}/install
BUILD_TESTING=ON
- name: Test
uses: threeal/ctest-action@v1
with:
test-dir: build
- name: Install
run: cmake --install build
sanitizers:
if: github.repository == 'FairRootGroup/FairMQ'
name: ${{ matrix.sanitizer.name }}
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
sanitizer:
- name: asan+lsan+ubsan
options: |
ENABLE_SANITIZER_ADDRESS=ON
ENABLE_SANITIZER_LEAK=ON
ENABLE_SANITIZER_UNDEFINED_BEHAVIOUR=ON
cxx-flags: -O1 -fno-omit-frame-pointer
- name: tsan
options: ENABLE_SANITIZER_THREAD=ON
cxx-compiler: clang++
steps:
- uses: actions/checkout@v4
with:
submodules: true
fetch-tags: true
fetch-depth: 0
- uses: ./.github/actions/setup-deps
with:
gcc: '14'
- name: Configure and Build
uses: threeal/cmake-action@v2
with:
generator: Ninja
cxx-compiler: ${{ matrix.sanitizer.cxx-compiler }}
cxx-flags: ${{ matrix.sanitizer.cxx-flags }}
options: |
CMAKE_BUILD_TYPE=Debug
BUILD_TESTING=ON
${{ matrix.sanitizer.options }}
- name: Test
uses: threeal/ctest-action@v1
with:
test-dir: build
static-analysis:
if: github.repository == 'FairRootGroup/FairMQ'
name: static-analysis
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
submodules: true
fetch-tags: true
fetch-depth: 0
- uses: ./.github/actions/setup-deps
with:
gcc: '14'
- name: Configure and Build
uses: threeal/cmake-action@v2
with:
generator: Ninja
options: |
CMAKE_BUILD_TYPE=Debug
BUILD_TESTING=ON
RUN_STATIC_ANALYSIS=ON
- name: Check for warnings
run: |
if grep -q "warning:" build.log; then
echo "::warning::Static analysis found warnings"
grep "warning:" build.log
exit 1
fi