Skip to content

Commit db62bde

Browse files
committed
feat: enhance CI/CD workflow with CMake testing and status generation
1 parent a0a9417 commit db62bde

File tree

1 file changed

+77
-10
lines changed

1 file changed

+77
-10
lines changed

.github/workflows/CI-CD.yml

Lines changed: 77 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,25 @@ name: Setup Fortran Conda CI/CD
33
on:
44
push:
55
branches: [main, master, dev]
6+
paths-ignore:
7+
- 'README.md'
8+
- 'CHANGELOG.md'
9+
- 'VERSION'
10+
- 'LICENSE'
611
pull_request:
712
branches: [main, master]
8-
13+
paths-ignore:
14+
- 'README.md'
15+
- 'CHANGELOG.md'
16+
- 'VERSION'
17+
- 'LICENSE'
918
permissions:
1019
contents: write
1120
pull-requests: write
1221

1322
jobs:
1423
test_fpm:
24+
if: ${{ !contains(github.event.head_commit.message, '[skip ci]') }}
1525
name: ${{ matrix.os }}_${{ matrix.compiler }}_fpm
1626
runs-on: ${{ matrix.os }}
1727
strategy:
@@ -45,12 +55,59 @@ jobs:
4555
extra-packages: ${{ matrix.extra-packages }}
4656

4757
- name: fpm test (debug)
48-
run: fpm test --compiler ${{ matrix.compiler }} --profile debug --verbose
58+
run: fpm @${{ matrix.os }}_${{ matrix.compiler }}_debug --verbose
4959

5060
- name: fpm test (release)
51-
run: fpm test --compiler ${{ matrix.compiler }} --profile release --verbose
61+
run: fpm @${{ matrix.os }}_${{ matrix.compiler }}_release --verbose
62+
63+
test_cmake:
64+
if: ${{ !contains(github.event.head_commit.message, '[skip ci]') }}
65+
name: ${{ matrix.os }}_${{ matrix.compiler }}_cmake
66+
runs-on: ${{ matrix.os }}
67+
strategy:
68+
fail-fast: false
69+
matrix:
70+
os: [ubuntu-latest, macos-latest, windows-latest]
71+
compiler: [gfortran, ifx, lfortran, flang-new, nvfortran]
72+
include:
73+
- os: ubuntu-latest
74+
extra-packages: "cmake, ninja"
75+
- os: windows-latest
76+
extra-packages: "cmake, ninja"
77+
- os: macos-latest
78+
extra-packages: "cmake, ninja"
79+
exclude:
80+
- os: macos-latest
81+
compiler: flang-new
82+
- os: macos-latest
83+
compiler: ifx
84+
- os: macos-latest
85+
compiler: nvfortran
86+
- os: windows-latest
87+
compiler: nvfortran
88+
89+
steps:
90+
- name: Setup Fortran
91+
uses: gha3mi/setup-fortran-conda@latest
92+
with:
93+
compiler: ${{ matrix.compiler }}
94+
platform: ${{ matrix.os }}
95+
extra-packages: ${{ matrix.extra-packages }}
96+
97+
- name: cmake test (debug)
98+
run: |
99+
cmake -S . -B build/debug -DCMAKE_BUILD_TYPE=Debug -DCMAKE_Fortran_COMPILER=${{ matrix.compiler }} -G Ninja -DFORTIME_BUILD_TESTS=ON
100+
cmake --build build/debug --config Debug
101+
ctest --test-dir build/debug --output-on-failure
102+
103+
- name: cmake test (release)
104+
run: |
105+
cmake -S . -B build/release -DCMAKE_BUILD_TYPE=Release -DCMAKE_Fortran_COMPILER=${{ matrix.compiler }} -G Ninja -DFORTIME_BUILD_TESTS=ON
106+
cmake --build build/release --config Release
107+
ctest --test-dir build/release --output-on-failure
52108
53109
doc_ford:
110+
if: ${{ github.event_name == 'push' && !contains(github.event.head_commit.message, '[skip ci]') }}
54111
name: Generate FORD Documentation
55112
runs-on: ubuntu-latest
56113
steps:
@@ -65,24 +122,33 @@ jobs:
65122
ford-output-directory: doc
66123
ford-branch: gh-pages
67124
ford-target-folder: .
68-
125+
69126
status_fpm:
127+
if: ${{ always() && github.event_name == 'push' && !contains(github.event.head_commit.message, '[skip ci]') }}
70128
name: Generate STATUS.md
71-
if: always()
72-
needs: test_fpm
129+
needs: [test_fpm]
73130
runs-on: ubuntu-latest
74131
steps:
75132
- name: Generate summary
76133
uses: gha3mi/setup-fortran-conda@latest
77134
with:
78135
generate-status-fpm: true
79136

137+
status_cmake:
138+
if: ${{ always() && github.event_name == 'push' && !contains(github.event.head_commit.message, '[skip ci]') }}
139+
name: Generate STATUS.md
140+
needs: [test_cmake]
141+
runs-on: ubuntu-latest
142+
steps:
143+
- name: Generate summary
144+
uses: gha3mi/setup-fortran-conda@latest
145+
with:
146+
generate-status-cmake: true
147+
80148
update_readme_table:
149+
if: ${{ always() && github.event_name == 'push' && github.ref == 'refs/heads/main' && !contains(github.event.head_commit.message, '[skip ci]') }}
81150
name: Update README.md status table
82-
if: |
83-
always() &&
84-
github.ref != 'refs/heads/update-readme-table'
85-
needs: [status_fpm]
151+
needs: [status_fpm, status_cmake]
86152
runs-on: ubuntu-latest
87153
steps:
88154
- name: Update README status
@@ -94,6 +160,7 @@ jobs:
94160
update-readme-user-email: "info@gha3mi.com" # Update with your email
95161

96162
linter_fortitude:
163+
if: ${{ !contains(github.event.head_commit.message, '[skip ci]') }}
97164
name: Run Fortitude Linter
98165
runs-on: ubuntu-latest
99166
steps:

0 commit comments

Comments
 (0)