Merge pull request #84 from Deltares/workflows #143
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: Test | |
on: | |
push: | |
branches: [ master ] | |
pull_request: | |
branches: [ master ] | |
jobs: | |
Test: | |
defaults: | |
run: | |
shell: bash -l {0} | |
strategy: | |
fail-fast: false | |
matrix: | |
os: ["ubuntu-latest" ] #, "macos-latest", "windows-latest"] | |
python-version: ["3.10", "3.11"] # fix tests to support older versions | |
include: | |
- os: ubuntu-latest | |
label: linux-64 | |
prefix: /usr/share/miniconda3/envs/fiat_test | |
name: ${{ matrix.label }} - py${{ matrix.python-version }} | |
runs-on: ${{ matrix.os }} | |
concurrency: | |
group: ${{ github.workflow }}-${{ matrix.python-version }}-${{ github.ref }} | |
cancel-in-progress: true | |
steps: | |
- name: Check-out source | |
uses: actions/checkout@v3 | |
- name: Setup Miniforge | |
uses: conda-incubator/setup-miniconda@v2 | |
with: | |
python-version: ${{ matrix.python-version }} | |
miniforge-variant: Miniforge3 | |
miniforge-version: latest | |
activate-environment: fiat_test | |
use-mamba: true | |
- name: Generate env yaml | |
run: pip install tomli && python make_env.py test --py-version ${{ matrix.python-version }} | |
- name: Set cache date | |
run: echo "DATE=$(date +'%Y%m%d')" >> $GITHUB_ENV | |
- name: Check cache | |
uses: actions/cache@v3 | |
with: | |
path: ${{ matrix.prefix }} | |
key: ${{ matrix.label }}-conda-${{ hashFiles('environment.yml') }}-${{ env.DATE }} | |
id: cache | |
- name: Update environment | |
run: mamba env update -f environment.yml | |
if: steps.cache.outputs.cache-hit != 'true' | |
- name: Install Delft-FIAT | |
run: | |
pip install -e . | |
- name: Create testdata | |
run: | |
python .testdata/create_test_data.py | |
- name: Test | |
run: python -m pytest --verbose --cov=fiat --cov-report xml | |
- name: Upload code coverage | |
uses: codecov/codecov-action@v3 |