-
Notifications
You must be signed in to change notification settings - Fork 5
165 lines (157 loc) · 4.69 KB
/
main.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
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
name: RavenPy
on:
push:
branches:
- master
pull_request:
env:
RAVEN_TESTING_DATA_BRANCH: master
jobs:
black:
name: Code linting
runs-on: ubuntu-latest
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: ${{ github.ref != 'refs/heads/master' }}
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v4
with:
python-version: "3.9"
- name: Install tox and setuptools
run: |
pip install tox
pip install --upgrade "setuptools<65.6"
- name: Run linting suite
run: tox -e black
pip:
name: Python${{ matrix.python-version }} (${{ matrix.os }})
needs: black
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
include:
- tox-env: py38-linux
python-version: "3.8"
os: ubuntu-latest
- tox-env: py38-macos
python-version: "3.8"
os: macos-latest
- tox-env: py39-linux
python-version: "3.9"
os: ubuntu-latest
- tox-env: py310-linux
python-version: "3.10"
os: ubuntu-latest
- tox-env: py311-linux
python-version: "3.11"
os: ubuntu-latest
- tox-env: py311-macos
python-version: "3.11"
os: macos-latest
steps:
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: Install GDAL (Ubuntu)
if: matrix.os == 'ubuntu-latest'
run: |
sudo apt-get update
sudo apt-get install libgdal-dev
- name: Install GDAL (macOS)
if: matrix.os == 'macos-latest'
uses: tecolicom/actions-use-homebrew-tools@v1
with:
tools: gdal
cache: yes
- name: Set GDAL_VERSION (Ubuntu)
if: matrix.os == 'ubuntu-latest'
run: |
echo "GDAL_VERSION=$(gdal-config --version)" >> $GITHUB_ENV
- name: Set GDAL_VERSION (macOS)
if: matrix.os == 'macos-latest'
run: |
echo "GDAL_VERSION=$(gdalinfo --version | awk '{print $2}' | sed s'/.$//')" >> $GITHUB_ENV
- name: Install tox
run: |
pip install tox~=4.0
- name: Test with tox and report coverage
run: |
python3 -m tox -e ${{ matrix.tox-env }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
COVERALLS_FLAG_NAME: run-${{ matrix.tox-env }}
COVERALLS_PARALLEL: true
COVERALLS_SERVICE_NAME: github
conda:
name: Python${{ matrix.python-version }} (${{ matrix.os }}) (Conda)
needs: black
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
include:
- os: ubuntu-latest
python-version: "3.9"
- os: ubuntu-latest
python-version: "3.10"
- os: ubuntu-latest
python-version: "3.11"
- os: macos-latest
python-version: "3.9"
defaults:
run:
shell: bash -l {0}
steps:
- uses: actions/checkout@v4
- name: Patch Environment File
if: matrix.os == 'windows-latest'
run: |
sed -i 's/climpred >=2.2.0/xesmf/' environment.yml
- name: Setup Conda (Micromamba) with Python${{ matrix.python-version }}
uses: mamba-org/setup-micromamba@v1
with:
cache-downloads: true
cache-environment: true
cache-environment-key: environment-${{ matrix.python-version }}-${{ matrix.os }}-${{ github.head_ref }}
environment-file: environment.yml
create-args: >-
conda
python=${{ matrix.python-version }}
- name: Conda and Mamba versions
run: |
conda --version
echo "micromamba: $(micromamba --version)"
- name: Install RavenPy
run: |
pip install -e ".[dev]"
- name: List installed packages
run: |
conda list
- name: Test RavenPy
run: |
pytest --cov --numprocesses=logical
- name: Report coverage
run: coveralls --service=github
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
COVERALLS_FLAG_NAME: run-conda_${{ matrix.python-version }}_${{ matrix.os }}
COVERALLS_PARALLEL: true
COVERALLS_SERVICE_NAME: github
finish:
needs:
- pip
- conda
runs-on: ubuntu-latest
container: python:3-slim
steps:
- name: Coveralls Finished
run: |
pip install --upgrade coveralls
coveralls --finish
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
COVERALLS_SERVICE_NAME: github