-
Notifications
You must be signed in to change notification settings - Fork 8
98 lines (87 loc) · 2.65 KB
/
build.yaml
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
name: build
on:
workflow_dispatch:
push:
branches:
- "main"
paths:
- "rabpro/**"
- "tests/**"
- .coveragerc
- setup.py
- environment.yml
- .github/workflows/build.yaml
pull_request:
paths:
- "rabpro/**"
- .github/workflows/build.yaml
schedule:
- cron: '0 0 10 * *' # run workflow at 12AM on tenth day of every month
jobs:
build:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest , macos-latest] # windows-latest
python-version: [3.9]
include:
# All paths are relative to $HOME
- os: ubuntu-latest
data-path: .local/share/rabpro/
- os: macos-latest
data-path: Library/Application Support/rabpro/
# - os: windows-latest
# data-path: AppData/Local/rabpro/rabpro/
defaults:
run:
shell: bash -l {0}
steps:
- name: Checkout repo
uses: actions/checkout@v4
- name: Cache conda
uses: actions/cache@v4
env:
# Increase this value to reset cache if environment.yml has not changed
CACHE_NUMBER: 0
with:
path: ~/conda_pkgs_dir/
key: ${{ runner.os }}-conda-${{ env.CACHE_NUMBER }}-${{ hashFiles('environment.yml') }}
restore-keys: |
${{ runner.os }}-conda-${{ env.CACHE_NUMBER }}-
${{ runner.os }}-conda-
${{ runner.os }}-
- name: Set up conda environment
uses: conda-incubator/setup-miniconda@v3
with:
python-version: ${{ matrix.python-version }}
miniforge-variant: Mambaforge
activate-environment: rabpro
environment-file: environment.yml
channels: conda-forge
auto-activate-base: false
use-only-tar-bz2: true # needs to be set for caching to work
- name: Install dependencies and rabpro
run: |
conda info
conda list
pip install coverage
pip install pytest
pip install .
- name: Set up credentials
run: |
mkdir -p "$HOME/.config/earthengine"
echo "$EARTH_ENGINE_KEY" > "$HOME/.config/earthengine/credentials"
env:
EARTH_ENGINE_KEY: ${{ secrets.EARTH_ENGINE_SECRET }}
- name: Set up data
run: |
mkdir -p "$HOME/$DATA_PATH"
cp -r ./tests/data/MERIT_Hydro ./tests/data/HydroBasins "$HOME/$DATA_PATH"
env:
DATA_PATH: ${{ matrix.data-path }}
- name: Run unit tests
run: |
python -m pytest
# coverage run -m pytest
# coverage report -m