Skip to content

Commit

Permalink
update CI workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
cheny16 committed Oct 8, 2024
1 parent 69eec1f commit 2a7688f
Show file tree
Hide file tree
Showing 2 changed files with 59 additions and 1 deletion.
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml → .github/workflows/general.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: CI for speedy.f90
name: General building CI test with gfortran

on:
push:
Expand Down
58 changes: 58 additions & 0 deletions .github/workflows/genomp.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
name: OMP 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 genomp | 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

0 comments on commit 2a7688f

Please sign in to comment.