-
Notifications
You must be signed in to change notification settings - Fork 0
58 lines (49 loc) · 1.38 KB
/
general.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
name: General building CI test with gfortran
on:
push:
branches:
- main
paths:
- 'source/*.f90'
- '**/*.f90'
- 'build.sh'
- 'run.sh'
pull_request:
branches:
- main
paths:
- 'source/*.f90'
- '**/*.f90'
- 'build.sh'
- 'run.sh'
- 'namelist.nml'
jobs:
build:
runs-on: ubuntu-latest
steps:
# Step 1: Checkout the repository code
- name: Checkout code
uses: actions/checkout@v2
# Step 2: Install dependencies (gfortran, openmp, netcdf-fortran)
- name: Install gfortran, OpenMP, and netcdf-fortran
run: |
sudo apt-get update
sudo apt-get install -y gfortran libnetcdff-dev
# Step 3: Set the NETCDF environment variable
- name: Set NETCDF environment variable
run: echo "NETCDF=$(nc-config --prefix)" >> $GITHUB_ENV
# Step 4: Compile the project
- name: Compile the Fortran project
run: |
export NETCDF=$(nc-config --prefix)
bash build.sh --target general | tee compile.out
# Step 5: Check for compilation
- name: Check for compilation
run: |
if ! grep -q "successful" compile.out; then
echo "Compilation failed."
cat compile.out
exit 1 # Fail the action
else
echo "Compilation successful."
fi