Skip to content

Update Testing

Update Testing #68

Workflow file for this run

name: Test AMRClaw
on:
push:
branches: [ "master" ]
pull_request:
branches: [ "master" ]
workflow_dispatch:
permissions:
contents: read
env:
CLAW: ${{ github.workspace }}
jobs:
tests:
name: >
Build ${{ matrix.build }} - ${{ matrix.os }} with ${{ matrix.python-version }}.
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false # Probably want to turn this off for a large matrix
matrix:
os: [ubuntu-latest] #, macos-latest]
python-version: ["3.12"]
build: [optimized]
toolchain:
- {compiler: gcc, version: 14}
- {compiler: gcc, version: 15}
# - {compiler: intel, version: '2025.0'}
# - {compiler: intel-classic, version: '2021.10'}
# - {compiler: nvidia-hpc, version: '25.1'}
# - {compiler: lfortran, version: '0.45.0'} # Does not work with meson
include:
- os: ubuntu-latest
build: [optimized, debug]
python-version: ["3.8", "3.12"]
exclude:
- os: ubuntu-latest
toolchain: {compiler: gcc, version: 15}
steps:
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Set up compilers
uses: fortran-lang/setup-fortran@v1
id: setup-fortran
with:
compiler: ${{ matrix.toolchain.compiler }}
version: ${{ matrix.toolchain.version }}
- name: Install python dependencies
run: |
python -m pip install --upgrade pip
pip install flake8 meson-python ninja pytest numpy
- name: Checkout Clawpack
uses: actions/[email protected]
with:
repository: clawpack/clawpack
submodules: true
- name: Checkout AMRClaw branch
uses: actions/[email protected]
with:
path: amrclaw
- name: Install clawpack python
run: |
pip install --no-build-isolation --editable .
- name: Lint with flake8
if: ${{ matrix.build == 'debug' }}
run: |
cd ${CLAW}/amrclaw
# stop the build if there are Python syntax errors or undefined names
flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics --exclude dev
# exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide
flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics
- name: Test with pytest
run: |
if [ "${{ matrix.build }}" == "debug" ]; then
if [ "${{ matrix.toolchain.compiler}}" == "gcc" ]; then
export FFLAGS="-O0 -W -Wall -fbounds-check -fcheck=all -pedantic-errors -Wunderflow -fbacktrace -ffpe-trap=invalid,zero,overflow -g"
elif [ "${{ matrix.toolchain.compiler}}" == "intel" ]; then
export FFLAGS="-O0 -g -check all -warn all -traceback"
elif [ "${{ matrix.toolchain.compiler}}" == "intel-classic" ]; then
export FFLAGS="-O0 -g -check all -warn all -traceback"
elif [ "${{ matrix.toolchain.compiler}}" == "nvidia-hpc" ]; then
export FFLAGS="-O0 -g -check all -warn all -traceback"
elif [ "${{ matrix.toolchain.compiler}}" == "lfortran" ]; then
export FFLAGS="-O0 -g -fcheck=all -fbacktrace
else
echo "Unknown compiler: ${{ matrix.toolchain.compiler }}"
exit 1
fi
export OMP_NUM_THREADS=1
elif [ "${{ matrix.build }}" == "optimized" ]; then
if [ "${{ matrix.toolchain.compiler}}" == "gcc" ]; then
export FFLAGS="-O1 -march=native -mtune=native -fopenmp"
elif [ "${{ matrix.toolchain.compiler}}" == "intel" ]; then
export FFLAGS="-O1 -xHost -qopenmp"
elif [ "${{ matrix.toolchain.compiler}}" == "intel-classic" ]; then
export FFLAGS="-O1 -xHost -qopenmp"
elif [ "${{ matrix.toolchain.compiler}}" == "nvidia-hpc" ]; then
export FFLAGS="-O1 -xHost -qopenmp"
elif [ "${{ matrix.toolchain.compiler}}" == "lfortran" ]; then
export FFLAGS="-O1 -fopenmp"
else
echo "Unknown compiler: ${{ matrix.toolchain.compiler }}"
exit 1
fi
export OMP_NUM_THREADS=2
else
echo "Unknown build type: ${{ matrix.build }}"
exit 1
fi
cd ${CLAW}/amrclaw
pytest
- name: Upload test results
if: failure()
uses: actions/upload-artifact@v4
with:
name: test_results
path: ${{ env.CLAW }}/amrclaw/*_output
if-no-files-found: ignore