Skip to content

Commit 1a1c55c

Browse files
committed
add CI workflow
1 parent af91406 commit 1a1c55c

File tree

1 file changed

+46
-0
lines changed

1 file changed

+46
-0
lines changed

.github/workflows/ci.yml

+46
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
name: CI for speedy.f90
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
pull_request:
8+
branches:
9+
- main
10+
11+
jobs:
12+
build:
13+
runs-on: ubuntu-latest
14+
15+
steps:
16+
# Step 1: Checkout the repository code
17+
- name: Checkout code
18+
uses: actions/checkout@v2
19+
20+
# Step 2: Install dependencies (gfortran, openmp, netcdf-fortran)
21+
- name: Install gfortran, OpenMP, and netcdf-fortran
22+
run: |
23+
sudo apt-get update
24+
sudo apt-get install -y gfortran libnetcdff-dev
25+
26+
# Step 3: Set the NETCDF environment variable
27+
- name: Set NETCDF environment variable
28+
run: echo "NETCDF=$(nc-config --prefix)" >> $GITHUB_ENV
29+
30+
# Step 4: Compile the project
31+
- name: Compile the Fortran project
32+
run: |
33+
export NETCDF=$(nc-config --prefix)
34+
bash build.sh --target general | tee compile.out
35+
36+
# Step 5: Check for compilation
37+
- name: Check for compilation
38+
run: |
39+
if ! grep -q "successful" compile.out; then
40+
echo "Compilation failed."
41+
cat compile.out
42+
exit 1 # Fail the action
43+
else
44+
echo "Compilation successful."
45+
fi
46+

0 commit comments

Comments
 (0)