-
Notifications
You must be signed in to change notification settings - Fork 30
112 lines (97 loc) · 3.38 KB
/
tests.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
name: Tests
on:
pull_request:
branches:
- main
paths:
- tests/*
- hydromt/*
- data/*
- pyproject.toml
schedule:
- cron: '0 0 * * *'
jobs:
build:
defaults:
run:
shell: bash -l {0}
strategy:
matrix:
os: [ubuntu-latest]
python-version: ['3.9','3.10','3.11']
name: py ${{ matrix.python-version }}
runs-on: ${{ matrix.os }}
concurrency:
group: ${{ github.workflow }}-${{ matrix.python-version }}-${{ github.ref }}
cancel-in-progress: true
steps:
- uses: actions/checkout@v3
- name: Setup Mambaforge
uses: conda-incubator/setup-miniconda@v2
with:
python-version: 3.11
miniforge-variant: Mambaforge
miniforge-version: latest
channels: conda-forge
activate-environment: hydromt
use-mamba: true
- name: Generate env spec
run: python make_env.py doc
- name: Set cache date
run: echo "DATE=$(date +'%Y%m%d')" >> $GITHUB_ENV
- uses: actions/cache@v2
with:
path: /usr/share/miniconda3/envs/hydromt
key: docs-conda-${{ hashFiles('environment.yml') }}-${{ env.DATE }}
id: cache
- name: Update environment
run: mamba env update -n hydromt -f environment.yml
if: steps.cache.outputs.cache-hit != 'true'
# - name: Generate env spec
# run: pip install tomli && python make_env.py test --py ${{ matrix.python-version }}
# - name: Get current date
# id: date
# run: echo "date=$(date +%Y-%m-%d)" >> "${GITHUB_OUTPUT}"
# - name: Setup Micromamba
# uses: mamba-org/setup-micromamba@v1
# env:
# ACTIONS_STEP_DEBUG: true
# with:
# condarc: |
# channels:
# - conda-forge
# cache-environment-key: environment-${{ steps.date.outputs.date }}-${{matrix.python-version}}
# cache-downloads-key: downloads-${{ steps.date.outputs.date }}-${{matrix.python-version}}
# cache-downloads: false
# cache-environment: false
# environment-file: ./environment.yml
# environment-name: hydromt
# # init-shell: bash
# post-cleanup: 'all'
# - name: Set cache date
# run: echo "DATE=$(date +'%Y%m%d')" >> $GITHUB_ENV
# - uses: actions/cache@v2
# with:
# path: /usr/share/miniconda3/envs/hydromt
# key: ${{ matrix.python-version }}-conda-${{ hashFiles('environment.yml') }}-${{ env.DATE }}
# id: cache
# - name: Setup Mambaforge
# uses: conda-incubator/setup-miniconda@v2
# with:
# auto-update-conda: false
# use-only-tar-bz2: true
# channels: conda-forge
# python-version: ${{ matrix.python-version }}
# miniforge-variant: Mambaforge
# miniforge-version: latest
# activate-environment: hydromt
# use-mamba: true
# - name: Update environment
# run: mamba env update -n hydromt -f environment.yml
# if: steps.cache.outputs.cache-hit != 'true'
- name: Test
# if: github.event_name != 'schedule'
run: python -m pytest --verbose --cov=hydromt --cov-report xml
- name: Upload code coverage
# if: github.event_name != 'schedule'
uses: codecov/codecov-action@v3