Skip to content

Commit 2810b09

Browse files
authored
Coverage only runs runs when meaningful files are changed (#468)
* test paths-filter * test filter * test workflow filter * test filter changes * fixed path * modulate fitler & reverse my tests from earlier * reverse order of file-filter * test filter * test2 * fixed filter stop * reverted test * fixed skip test when should run * fixed skip test when should run 2 * fixed ski[ test when should run 4 * fixed skip test when should run 3? * revert cmake
1 parent 838f61b commit 2810b09

File tree

3 files changed

+78
-6
lines changed

3 files changed

+78
-6
lines changed

.github/file-filter.yml

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
# This is used by the action https://github.com/dorny/paths-filter
2+
# Lists all files to be filtered for changes to run a CI for test.yml & coverage.yml
3+
4+
fortran_src: &fortran_src
5+
- '**/*.f90'
6+
- '**/*.fpp'
7+
8+
python_src: &python_src
9+
- '**/*.py'
10+
- 'toolchain/requirements.txt'
11+
12+
cmakelist: &cmakelist
13+
- 'CMakeLists.txt'
14+
- 'toolchain/cmake/**'
15+
16+
tests: &tests
17+
- 'tests/**'
18+
19+
scripts: &scripts
20+
- 'mfc.sh'
21+
- 'mfc.bat'
22+
- 'toolchain/bootstrap/**'
23+
24+
yml: &yml
25+
- '**/*.yml'
26+
27+
checkall: &checkall
28+
- *fortran_src
29+
- *python_src
30+
- *cmakelist
31+
- *tests
32+
- *scripts
33+
- *yml

.github/workflows/coverage.yml

Lines changed: 22 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,18 +3,36 @@ name: Coverage Check
33
on: [push, pull_request, workflow_dispatch]
44

55
jobs:
6+
file-changes:
7+
name: Detect File Changes
8+
runs-on: 'ubuntu-latest'
9+
outputs:
10+
checkall: ${{ steps.changes.outputs.checkall }}
11+
steps:
12+
- name: Clone
13+
uses: actions/checkout@v4
14+
15+
- name: Detect Changes
16+
uses: dorny/paths-filter@v3
17+
id: changes
18+
with:
19+
filters: ".github/file-filter.yml"
20+
621
run:
722
name: Coverage Test on CodeCov
23+
if: needs.file-changes.outputs.checkall == 'true'
24+
needs: file-changes
825
runs-on: "ubuntu-latest"
926
steps:
27+
- name: Checkouts
28+
uses: actions/checkout@v4
29+
1030
- name: Setup Ubuntu
1131
run: |
1232
sudo apt update -y
1333
sudo apt install -y tar wget make cmake gcc g++ python3 python3-dev "openmpi-*" libopenmpi-dev
14-
15-
- name: Checkouts
16-
uses: actions/checkout@v4
17-
34+
35+
1836
- name: Build
1937
run: /bin/bash mfc.sh build -j $(nproc) --gcov
2038

.github/workflows/test.yml

Lines changed: 23 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,25 @@ on:
1717
workflow_dispatch:
1818

1919
jobs:
20+
file-changes:
21+
name: Detect File Changes
22+
runs-on: 'ubuntu-latest'
23+
outputs:
24+
checkall: ${{ steps.changes.outputs.checkall }}
25+
steps:
26+
- name: Clone
27+
uses: actions/checkout@v4
28+
29+
- name: Detect Changes
30+
uses: dorny/paths-filter@v3
31+
id: changes
32+
with:
33+
filters: ".github/file-filter.yml"
34+
2035
github:
2136
name: Github
37+
if: needs.file-changes.outputs.checkall == 'true'
38+
needs: file-changes
2239
strategy:
2340
matrix:
2441
os: ['ubuntu', 'macos']
@@ -38,6 +55,7 @@ jobs:
3855
fail-fast: false
3956
continue-on-error: true
4057
runs-on: ${{ matrix.os }}-latest
58+
4159
steps:
4260
- name: Clone
4361
uses: actions/checkout@v4
@@ -96,7 +114,9 @@ jobs:
96114
OPT2: ${{ matrix.debug == 'debug' && '-% 20' || '' }}
97115

98116
docker:
99-
name: Github | Docker
117+
name: Github | Docker
118+
if: needs.file-changes.outputs.checkall == 'true'
119+
needs: file-changes
100120
runs-on: ubuntu-latest
101121
steps:
102122
- name: Clone
@@ -107,7 +127,8 @@ jobs:
107127

108128
self:
109129
name: Self Hosted
110-
if: github.repository == 'MFlowCode/MFC'
130+
if: github.repository == 'MFlowCode/MFC' && needs.file-changes.outputs.checkall == 'true'
131+
needs: file-changes
111132
continue-on-error: true
112133
strategy:
113134
matrix:

0 commit comments

Comments
 (0)