Skip to content

update CI workflow

update CI workflow #1

Workflow file for this run

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