Revision of the manual #309
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# ----------------------------------------------------------------------------- | |
# | |
# Copyright (c) 2017 Sam Cox, Roberto Sommariva | |
# | |
# This file is part of the AtChem2 software package. | |
# | |
# This file is covered by the MIT license which can be found in the file | |
# LICENSE.md at the top level of the AtChem2 distribution. | |
# | |
# ----------------------------------------------------------------------------- | |
# Workflow for the continuous integration (CI) of AtChem2, using | |
# Github Actions and Codecov | |
# | |
# Acknowledgements: J. Allsopp | |
# -------------------------------------------------------------------- # | |
name: AtChem2 CI | |
# ------------------------------ EVENTS ------------------------------ # | |
# Controls when the workflow is activated | |
on: | |
# Triggers when a pull request is created or updated (only on the | |
# master branch) | |
pull_request: | |
branches: [ master ] | |
# Triggers when a push is made to the master branch (either by | |
# merging a pull request, or by direct commit) | |
push: | |
branches: [ master ] | |
# Run manually from the Actions tab | |
workflow_dispatch: | |
# ------------------------------ JOBS ------------------------------ # | |
# This workflow contains a single job called `ci_testing` which | |
# compiles the AtChem2 model, runs the Testsuite, and checks the code | |
# coverage using Codecov (https://app.codecov.io/gh/AtChem/AtChem2) | |
jobs: | |
ci_testing: | |
# The job runs on both linux (ubuntu) and macos runner images, | |
# with three versions of gnu fortran -- the runner images are | |
# described here: https://github.com/actions/runner-images | |
runs-on: ${{ matrix.os }} | |
strategy: | |
matrix: | |
os: [ubuntu-22.04, macos-11, macos-12] | |
fortran: [9, 10, 11] | |
exclude: # TODO: gfortran-9 does not work on macos-12 | |
- os: macos-12 | |
fortran: 9 | |
fail-fast: false | |
# ------------------------------------------------------------- | |
# Sequence of tasks to be executed as part of the `ci_testing` job: | |
# 1. Checkout the repository | |
# 2. Install gfortran, AtChem2 dependencies | |
# 3. Compile AtChem2 | |
# 4. Run the Testsuite with default settings | |
# 5. Recompile AtChem2, run unit and model tests for Codecov | |
steps: | |
# ------------------------------------------------------------- | |
# (1) Checkout the repository under $GITHUB_WORKSPACE | |
- name: Checkout repo | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 2 | |
# ------------------------------------------------------------- | |
# (2) Install gfortran, if not supplied with the runner image, | |
# and the AtChem2 dependencies: CVODE, openlibm, numdiff, FRUIT | |
# gfortran on macos-11 | |
- name: Install gfortran-9 (macos-11) | |
if: matrix.os == 'macos-11' && matrix.fortran == 9 | |
run: brew install gcc@${{ matrix.fortran }} | |
# gfortran on macos-12 | |
- name: Install gfortran-9 and gfortran-10 (macos-12) | |
if: matrix.os == 'macos-12' && (matrix.fortran == 9 || matrix.fortran == 10) | |
run: brew install gcc@${{ matrix.fortran }} | |
# AtChem2 dependencies | |
- name: Install CVODE | |
run: ./tools/install/install_cvode.sh $PWD $(which gfortran-${{ matrix.fortran }}) | |
- name: Install openlibm | |
run: ./tools/install/install_openlibm.sh $PWD | |
- name: Install numdiff | |
run: ./tools/install/install_numdiff.sh $PWD | |
- name: Install FRUIT | |
run: sudo ./tools/install/install_fruit.sh $PWD | |
# ------------------------------------------------------------- | |
# (3) Compile AtChem2 using the standard compilation flags | |
- name: Build AtChem2 | |
# Set $FORT_VERSION for use with the `Makefile`, which is | |
# called by the `build_atchem2.sh` script | |
env: | |
FORT_VERSION: ${{ matrix.fortran }} | |
run: | | |
cp tools/install/Makefile.skel Makefile | |
./build/build_atchem2.sh ./model/mechanism.fac ./model/configuration/ ./mcm/ | |
# macos only | |
if [ $RUNNER_OS != "Linux" ] ; then | |
install_name_tool -change libopenlibm.4.dylib $PWD/openlibm-0.8.1/libopenlibm.4.dylib atchem2 ; | |
install_name_tool -change @rpath/libsundials_cvode.2.dylib $PWD/cvode/lib/libsundials_cvode.dylib atchem2 ; | |
install_name_tool -change @rpath/libsundials_fnvecserial.2.dylib $PWD/cvode/lib/libsundials_fnvecserial.dylib atchem2 ; | |
install_name_tool -change @rpath/libsundials_nvecserial.2.dylib $PWD/cvode/lib/libsundials_nvecserial.dylib atchem2 ; | |
fi | |
# ------------------------------------------------------------- | |
# (4) Run the Testsuite using the standard compilation flags and | |
# default settings: indent, style, unit, model tests | |
- name: Indent and Style tests | |
run: | | |
make indenttest | |
make styletest | |
- name: Unit and Model tests | |
# Set $FORT_VERSION for use with the `Makefile` | |
env: | |
FORT_VERSION: ${{ matrix.fortran }} | |
run: | | |
export PATH=$PATH:$PWD/numdiff/bin | |
make unittests | |
make oldtests # NB: oldtests will eventually be merged into modeltests | |
#make modeltests # TODO: temporarily deactivated (pass on linux, fail on macos) | |
# ------------------------------------------------------------- | |
# (5) Recompile AtChem2 using the code coverage compilation | |
# flags, then upload the gcov files to Codecov | |
- name: Unit and Model tests (x Codecov) | |
if: matrix.os == 'ubuntu-22.04' && matrix.fortran == 11 | |
# Set $FORT_VERSION for use with the `Makefile` | |
env: | |
FORT_VERSION: ${{ matrix.fortran }} | |
run: | | |
export PATH=$PATH:$PWD/numdiff/bin | |
make clean | |
# unit tests | |
make unittests CCOV=true | |
mv tests/unit_tests/*.gc* ./ # needed for GCC-11 handling of *.gcda, *.gcna files | |
# model tests | |
make modeltests CCOV=true # run only the new Testsuite | |
- name: Upload coverage reports to Codecov | |
if: matrix.os == 'ubuntu-22.04' && matrix.fortran == 11 | |
uses: codecov/codecov-action@v3 | |
with: | |
gcov: true |