Skip to content

Commit 002bdab

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

6 files changed

Lines changed: 197 additions & 48 deletions

File tree

.github/workflows/ci.yaml

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
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+
30+
tests-makefile:
31+
name: test Makefile
32+
needs: [ pre-commit ]
33+
uses: ./.github/workflows/step_test-makefile.yaml
34+
35+
docs:
36+
name: 📘 docs
37+
needs: [ pre-commit ]
38+
uses: ./.github/workflows/step_docs.yaml
39+
40+
pass:
41+
name: ✅ Pass
42+
needs: [ pre-commit, tests, tests-makefile, docs ]
43+
runs-on: ubuntu-latest
44+
steps:
45+
- name: Check all CI jobs
46+
uses: re-actors/alls-green@release/v1
47+
with:
48+
jobs: ${{ toJSON(needs) }}
49+
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: 86 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,86 @@
1+
name: test
2+
3+
on:
4+
workflow_call:
5+
6+
permissions:
7+
contents: read
8+
9+
jobs:
10+
tests:
11+
name: Check on ${{ matrix.toolchain }} toolchain ${{ matrix.mpi }}
12+
runs-on: ${{ matrix.os || 'ubuntu-latest' }}
13+
container: ${{ !matrix.os && 'ghcr.io/lecrisut/dev-env:main' || '' }}
14+
continue-on-error: ${{ matrix.experimental || false }}
15+
strategy:
16+
fail-fast: false
17+
matrix:
18+
toolchain: [ gcc, llvm, intel ]
19+
mpi: ['', openmpi, mpich, intel]
20+
include:
21+
# flang is missing features in 16.0.6
22+
- toolchain: llvm
23+
experimental: true
24+
steps:
25+
- name: Install missing packages
26+
run: dnf install -y bzip2 python-unversioned-command
27+
- name: Load mpi module ${{ matrix.mpi }}
28+
run: |
29+
# Get interactive profile to be able to load modules
30+
source /etc/profile
31+
32+
# Save the current environment since we only want the added difference
33+
printenv > orig_env
34+
35+
# Load the relevant mpi module
36+
module load mpi/${{ matrix.mpi }}
37+
printenv > module_env
38+
39+
diff orig_env module_env | sed -n 's/> //p' >> $GITHUB_ENV
40+
41+
# Set MPI flag on
42+
echo "WITH_MPI=ON" >> $GITHUB_ENV
43+
if: ${{ matrix.mpi }}
44+
- name: Enable msvc toolchain on windows
45+
uses: ilammy/msvc-dev-cmd@v1
46+
if: contains(matrix.os, 'windows')
47+
- name: Activate Intel compilers
48+
run: |
49+
source /etc/profile
50+
printenv > orig_env
51+
module load compiler
52+
printenv > module_env
53+
diff orig_env module_env | sed -n 's/> //p' >> $GITHUB_ENV
54+
echo $PATH >> $GITHUB_PATH
55+
if: matrix.toolchain == 'intel'
56+
- uses: actions/checkout@v3
57+
- uses: lukka/get-cmake@latest
58+
- name: Run CMake configuration for ${{ matrix.toolchain }} toolchain
59+
uses: lukka/run-cmake@v10.3
60+
with:
61+
workflowPreset: "${{ matrix.toolchain }}-ci"
62+
63+
coverage:
64+
name: Check test coverage
65+
runs-on: ubuntu-latest
66+
needs: [ tests ]
67+
steps:
68+
- uses: actions/checkout@v3
69+
- uses: lukka/get-cmake@latest
70+
- name: Get test coverage
71+
uses: lukka/run-cmake@v10.3
72+
with:
73+
workflowPreset: ci-coverage
74+
- name: Get lcov data
75+
uses: danielealbano/lcov-action@v3
76+
with:
77+
# Note lcov-action prepends and appends wild-cards *. Account for those
78+
# https://github.com/danielealbano/lcov-action/issues/11
79+
remove_patterns: /test/,/cmake-build*/
80+
- name: Upload coverage to Codecov
81+
uses: codecov/codecov-action@v3
82+
with:
83+
name: ${{ matrix.coverage }} coverage
84+
files: coverage.info
85+
flags: ${{ matrix.coverage }}
86+
verbose: true

0 commit comments

Comments
 (0)