Merge pull request #366 from ecmwf-ifs/naml-substitute-expr-string #1695
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
name: tests | |
# Controls when the workflow will run | |
on: | |
# Triggers the workflow on push events | |
push: | |
branches: [ 'main' ] | |
tags-ignore: [ '**' ] | |
# Triggers the workflow on pull request events | |
pull_request: | |
# Allows you to run this workflow manually from the Actions tab | |
workflow_dispatch: | |
jobs: | |
pytest: | |
name: pytest | |
strategy: | |
fail-fast: false # false: try to complete all jobs | |
matrix: | |
name: | |
- linux python-3.8 | |
- linux python-3.9 | |
- linux python-3.10 | |
- linux python-3.11 | |
- macos python-3.11 | |
include: | |
- name: linux python-3.8 | |
os: ubuntu-20.04 | |
python-version: '3.8' | |
- name: linux python-3.9 | |
os: ubuntu-20.04 | |
python-version: '3.9' | |
- name: linux python-3.10 | |
os: ubuntu-20.04 | |
python-version: '3.10' | |
- name: linux python-3.11 | |
os: ubuntu-20.04 | |
python-version: '3.11' | |
- name: macos python-3.11 | |
os: macos-14 | |
python-version: '3.11' | |
runs-on: ${{ matrix.os }} | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Set up Python ${{ matrix.python-version }} | |
uses: actions/setup-python@v5 | |
with: | |
python-version: ${{ matrix.python-version }} | |
cache: 'pip' | |
- name: Refresh package lists and install Loki dependencies | |
run: | | |
if [[ "${{ matrix.os }}" =~ macos ]]; then | |
brew install gcc@13 graphviz | |
else | |
sudo apt-get -o Acquire::Retries=3 update || true | |
sudo apt-get -o Acquire::Retries=3 install -y graphviz gfortran | |
fi | |
- name: Install OMNI + CLAW dependencies on Linux | |
if: ${{ ! startsWith(matrix.os, 'macos') }} | |
run: | | |
sudo apt-get -o Acquire::Retries=3 install -y byacc flex openjdk-11-jdk cmake ant | |
- name: Install Loki | |
run: | | |
if [[ "${{ matrix.os }}" =~ macos ]]; then | |
export CC=gcc-13 CXX=g++-13 FC=gfortran-13 | |
./install --with-examples --with-tests --with-dace | |
echo "export PATH=$(brew --prefix)/opt/[email protected]/libexec/bin:$(brew --prefix)/bin:${PATH}" | cat - loki-activate > loki-activate.tmp | |
mv loki-activate.tmp loki-activate | |
echo "export CC=gcc-13" >> loki-activate | |
echo "export CXX=g++-13" >> loki-activate | |
echo "export FC=gfortran-13" >> loki-activate | |
echo "export F90=gfortran-13" >> loki-activate | |
echo "export LD=gfortran-13" >> loki-activate | |
else | |
./install --with-claw --with-ofp --with-examples --with-tests --with-dace | |
fi | |
- name: Install up-to-date CMake | |
run: | | |
source loki-activate | |
pip install cmake | |
- name: Run Loki tests | |
run: | | |
source loki-activate | |
pytest --cov=./loki --cov-report=xml loki | |
- name: Upload loki coverage report to Codecov | |
uses: codecov/codecov-action@v4 | |
if: ${{ ! startsWith(matrix.os, 'macos') }} | |
with: | |
flags: loki | |
files: ./coverage.xml | |
env: | |
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} | |
- name: Run lint_rules tests | |
run: | | |
source loki-activate | |
pytest --cov=lint_rules/lint_rules --cov-report=xml lint_rules/tests | |
- name: Upload lint_rules coverage report to Codecov | |
uses: codecov/codecov-action@v4 | |
if: ${{ ! startsWith(matrix.os, 'macos') }} | |
with: | |
flags: lint_rules | |
files: ./coverage.xml | |
env: | |
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} |