-
Notifications
You must be signed in to change notification settings - Fork 3
147 lines (147 loc) · 4.26 KB
/
ci_job.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
name: CI Tests
run-name: ${{ github.actor }} is testing the code
# Set the access for individual scopes, or use permissions: write-all
permissions:
pull-requests: write
on:
push:
pull_request:
workflow_dispatch:
jobs:
lint:
runs-on: ubuntu-latest
steps:
-
name: Ceckout
uses: actions/checkout@v4
-
name: Set up Python 3.10
uses: actions/setup-python@v3
with:
python-version: "3.10"
-
name: Install packages
run: |
python3 -m pip install -e .[test]
-
name: Linting
run: make lint
test:
runs-on: ubuntu-latest
env:
NUMEXPR_MAX_THREADS: 8
GIT_SUBMODULE_STRATEGY: recursive
strategy:
max-parallel: 5
matrix:
python-version: [3.7, 3.8, 3.9, "3.10", "3.11"]
steps:
-
name: Checkout
uses: actions/checkout@v4
with:
submodules: recursive
-
name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v3
with:
python-version: ${{matrix.python-version}}
-
name: Add conda to system path
run: |
# $CONDA is an environment variable pointing to the root of the
# miniconda directory
echo $CONDA/bin >> $GITHUB_PATH
-
name: Set up services
run: |
docker compose up -d --remove-orphans
-
name: Install dependencies on python ${{matrix.python-version}}
run: |
conda create -c conda-forge -n tests -y -q python pip cartopy make mysql-common==8.3.0 mysql-libs=8.3.0 mysqlclient
conda run -n tests python -m pip install -e .[test] dask==2024.8.0
-
name: Running tests for python ${{ matrix.python-version }}
run: |
conda run -n tests make test_coverage
-
name: Upload coverage to Codecov
uses: codecov/codecov-action@v1
docs:
runs-on: ubuntu-latest
permissions:
contents: write
env:
NUMEXPR_MAX_THREADS: 8
GIT_SUBMODULE_STRATEGY: recursive
DJANGO_ALLOW_ASYNC_UNSAFE: 1
steps:
-
name: Checkout
uses: actions/checkout@v4
with:
submodules: recursive
-
name: Set up Python
uses: actions/setup-python@v3
-
name: Add conda to system path
run: |
echo $CONDA/bin >> $GITHUB_PATH
-
name: Install freva
run: |
conda create -c conda-forge -n docs -y -q cartopy make mysql-common==8.3.0 mysql-libs=8.3.0 mysqlclient dask==2024.8.0 freva
-
name: Set up services
run: |
docker compose up -d --remove-orphans
-
name: Preparing docs
run: |
conda run -n docs make prepdocs
-
name: Creating docs
run: |
conda run -n docs make docs
-
name: Setup Pages
uses: actions/configure-pages@v2
if: ${{ github.ref == 'refs/heads/main' }}
-
name: Upload artifact
uses: actions/upload-pages-artifact@v1
if: ${{ github.ref == 'refs/heads/main' }}
with:
# Upload entire repository
path: './docs/build/html'
-
name: Deploy
uses: peaceiris/actions-gh-pages@v3
if: ${{ github.ref == 'refs/heads/main' }}
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./docs/build/html
dependabot:
name: Merge PR by dependabot
runs-on: ubuntu-latest
needs: [docs, test, lint]
# Specifically check that dependabot (or another trusted party) created this pull-request, and that it has been labelled correctly.
if: github.event.pull_request.user.login == 'dependabot[bot]'
steps:
- name: Dependabot metadata
id: metadata
uses: dependabot/fetch-metadata@v1
with:
github-token: "${{ secrets.GITHUB_TOKEN }}"
- name: Approve dependabot's PR
run: gh pr review --approve "$PR_URL"
env:
PR_URL: ${{github.event.pull_request.html_url}}
GITHUB_TOKEN: ${{secrets.TOKEN}}
- name: Auto-merge for dependabot's PR
run: gh pr merge --merge --auto "$PR_URL"
env:
PR_URL: ${{github.event.pull_request.html_url}}
GITHUB_TOKEN: ${{secrets.TOKEN}}