Skip to content

Commit 62bcd83

Browse files
committed
Reconfigure GH Actions
Signed-off-by: Cristian Le <cristian.le@mpsd.mpg.de>
1 parent a9ba841 commit 62bcd83

6 files changed

Lines changed: 184 additions & 48 deletions

File tree

.github/workflows/ci.yaml

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
name: CI
2+
run-name: >
3+
CI (${{ github.event_name }})
4+
${{ github.event_name == 'pull_request' && format('PR#{0}', github.event.number) || '' }}
5+
6+
on:
7+
workflow_dispatch:
8+
pull_request:
9+
branches: [ develop ]
10+
push:
11+
branches: [ develop ]
12+
13+
permissions:
14+
contents: read
15+
16+
concurrency:
17+
group: ${{ github.workflow }}-${{ github.ref }}
18+
cancel-in-progress: true
19+
20+
jobs:
21+
pre-commit:
22+
name: pre-commit
23+
uses: ./.github/workflows/step_pre-commit.yaml
24+
25+
tests:
26+
name: test
27+
needs: [ pre-commit ]
28+
uses: ./.github/workflows/step_test.yaml
29+
with:
30+
mask-experimental: ${{ github.event_name == 'push' }}
31+
32+
tests-makefile:
33+
name: test Makefile
34+
needs: [ pre-commit ]
35+
uses: ./.github/workflows/step_test-makefile.yaml
36+
37+
docs:
38+
name: 📘 docs
39+
needs: [ pre-commit ]
40+
uses: ./.github/workflows/step_docs.yaml
41+
42+
pass:
43+
name: ✅ Pass
44+
needs: [ pre-commit, tests, tests-makefile, docs ]
45+
runs-on: ubuntu-latest
46+
steps:
47+
- name: Check all CI jobs
48+
uses: re-actors/alls-green@release/v1
49+
with:
50+
jobs: ${{ toJSON(needs) }}
51+
if: always()

.github/workflows/docs.yml

Lines changed: 0 additions & 36 deletions
This file was deleted.

.github/workflows/step_docs.yaml

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
name: 📘 test-docs
2+
3+
on:
4+
workflow_call:
5+
6+
permissions:
7+
contents: read
8+
9+
jobs:
10+
docs:
11+
name: Build docs
12+
runs-on: ubuntu-latest
13+
steps:
14+
- uses: actions/checkout@v4
15+
- uses: actions/setup-python@v5
16+
with:
17+
python-version: "3.11"
18+
- run: echo "cache_id=$(date --utc '+%V')" >> $GITHUB_ENV
19+
- uses: actions/cache@v4
20+
with:
21+
key: mkdocs-w90-${{ env.cache_id }}
22+
path: .cache
23+
restore-keys: |
24+
mkdocs-w90-
25+
- run: pip install -r docs/requirements.txt
26+
- run: mkdocs build -s
27+
working-directory: ./docs
28+
env:
29+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
30+
ENABLE_MKDOCS_GIT_COMMITTERS: False
31+
32+
- name: Deploy to GitHub Pages
33+
uses: peaceiris/actions-gh-pages@v3
34+
if: github.ref == 'refs/heads/develop'
35+
with:
36+
github_token: ${{ secrets.GITHUB_TOKEN }}
37+
publish_dir: ./docs/site
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
name: pre-commit
2+
3+
on:
4+
workflow_call:
5+
6+
permissions:
7+
contents: read
8+
9+
jobs:
10+
pre-commit:
11+
name: Check pre-commit
12+
runs-on: ubuntu-latest
13+
steps:
14+
- uses: actions/checkout@v4
15+
with:
16+
fetch-depth: 0
17+
- uses: actions/setup-python@v4
18+
with:
19+
python-version: 3.x
20+
- uses: pre-commit/action@v3.0.0
Lines changed: 5 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,12 @@
1-
name: CI
1+
name: test Makefile
22

33
on:
4-
pull_request:
5-
push:
6-
branches:
7-
- develop
4+
workflow_call:
5+
6+
permissions:
7+
contents: read
88

99
jobs:
10-
pre-commit:
11-
runs-on: ubuntu-20.04
12-
steps:
13-
- uses: actions/checkout@v2
14-
- uses: actions/setup-python@v2
15-
- uses: pre-commit/action@v2.0.0
16-
1710
build:
1811
runs-on: ubuntu-20.04
1912
strategy:

.github/workflows/step_test.yaml

Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
name: test
2+
3+
on:
4+
workflow_call:
5+
inputs:
6+
mask-experimental:
7+
type: boolean
8+
default: true
9+
description: Always report experimental test as successful
10+
11+
permissions:
12+
contents: read
13+
14+
jobs:
15+
tests:
16+
name: >
17+
🖥️ ${{ matrix.os || 'Fedora' }}
18+
${{ !matrix.os && format('🛠️ {0}', matrix.toolchain) || '' }}
19+
${{ matrix.mpi && format('🖧 {0}', matrix.mpi) || '' }}
20+
${{ matrix.experimental && '[🧪 Experimental]' || '' }}
21+
runs-on: ${{ matrix.os || 'ubuntu-latest' }}
22+
container: ${{ !matrix.os && 'ghcr.io/lecrisut/dev-env:main' || '' }}
23+
continue-on-error: ${{ matrix.experimental || false }}
24+
strategy:
25+
fail-fast: false
26+
matrix:
27+
toolchain: [ gcc, llvm, intel ]
28+
mpi: [false, openmpi, mpich, intel]
29+
include:
30+
# flang is missing features in 16.0.6
31+
- toolchain: llvm
32+
experimental: true
33+
steps:
34+
- name: Install missing packages
35+
run: dnf install -y bzip2 python-unversioned-command
36+
- name: Load mpi module ${{ matrix.mpi || '' }}
37+
run: |
38+
# Get interactive profile to be able to load modules
39+
source /etc/profile
40+
41+
# Save the current environment since we only want the added difference
42+
printenv > orig_env
43+
44+
# Load the relevant mpi module
45+
module load mpi/${{ matrix.mpi }}
46+
printenv > module_env
47+
48+
diff orig_env module_env | sed -n 's/> //p' >> $GITHUB_ENV
49+
50+
# Set MPI flag on
51+
echo "WITH_MPI=ON" >> $GITHUB_ENV
52+
if: matrix.mpi
53+
- name: Enable msvc toolchain on windows
54+
uses: ilammy/msvc-dev-cmd@v1
55+
if: contains(matrix.os, 'windows')
56+
- name: Activate Intel compilers
57+
# Not elegant, it will propagate all environment variable.
58+
# Intel does not provide a way to output the environment variables to a file
59+
# Note: PATH needs to be exported to GITHUB_PATH otherwise it can be overwritten
60+
run: |
61+
source /opt/intel/oneapi/setvars.sh
62+
printenv >> $GITHUB_ENV
63+
echo $PATH >> $GITHUB_PATH
64+
if: matrix.toolchain == 'intel'
65+
- uses: actions/checkout@v3
66+
- uses: lukka/get-cmake@latest
67+
- name: Run CMake workflow ${{ matrix.toolchain }}-ci
68+
uses: lukka/run-cmake@v10.3
69+
with:
70+
workflowPreset: "${{ matrix.toolchain }}-ci"
71+
continue-on-error: ${{ matrix.experimental && inputs.mask-experimental}}

0 commit comments

Comments
 (0)