-
Notifications
You must be signed in to change notification settings - Fork 51
273 lines (263 loc) · 8.76 KB
/
tethys.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
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
# Tethys Main CI
name: Tethys-CI
# Run on pushes and pull requests but not tags.
on:
push:
branches:
- "main"
- "release*"
pull_request:
branches:
- "*"
schedule:
- cron: "0 0 * * 0" # weekly
env:
CONDA_BUILD_PIN_LEVEL: minor
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
TEST_IMAGE: tethys:dev
POSTGRES_DB: tethys_postgis
POSTGRES_PASSWORD: please_dont_use_default_passwords
POSTGRES_PORT: 5432
TETHYS_DB_HOST: 172.17.0.1
TETHYS_DB_PORT: 5432
TETHYS_DB_USERNAME: tethys_default
TETHYS_DB_PASSWORD: please_dont_use_default_passwords
TETHYS_DB_SUPERUSER: tethys_super
TETHYS_DB_SUPERUSER_PASS: please_dont_use_default_passwords
jobs:
lint:
name: Lint with Flake8
runs-on: ubuntu-latest
steps:
- name: Checkout Source
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Install Flake8
run: pip install flake8
- name: Run Flake8
run: flake8 $GITHUB_WORKSPACE
format:
name: Check Black Formatting
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: psf/black@stable
tests:
name: Tests (${{ matrix.platform }})
runs-on: ${{ matrix.platform }}
strategy:
fail-fast: false
matrix:
platform: [ubuntu-latest, macos-latest]
python-version: [3.7]
steps:
# Checkout the source
- name: Checkout Source
uses: actions/checkout@v2
with:
fetch-depth: 0
# Install Tethys
- name: Install Tethys
run: |
cd ..
bash ./tethys/scripts/install_tethys.sh -h
bash ./tethys/scripts/install_tethys.sh --partial-tethys-install meds -n tethys -s $PWD/tethys
# Setup Tethys and Conda
- name: Setup Tethys and Conda
run: |
. ~/miniconda/etc/profile.d/conda.sh
conda activate tethys
conda list
tethys db start
pip install coveralls
# Test Tethys
- name: Test Tethys
run: |
. ~/miniconda/etc/profile.d/conda.sh
conda activate tethys
tethys test -c -u -v 2
# Generate Coverage Report
- name: Generate Coverage Report
if: matrix.platform == 'ubuntu-latest'
run: |
. ~/miniconda/etc/profile.d/conda.sh
conda activate tethys
coveralls --service=github
docker-build:
name: Docker Build
runs-on: ${{ matrix.platform }}
strategy:
fail-fast: false
matrix:
platform: [ubuntu-latest]
python-version: [3.7]
steps:
# Checkout the source
- name: Checkout Source
uses: actions/checkout@v2
with:
fetch-depth: 0
# Build the docker for no tag
- name: Build Without Tag
run: |
docker build -t ${{ secrets.DOCKER_UPLOAD_URL }}:dev .;
docker tag ${{ secrets.DOCKER_UPLOAD_URL }}:dev ${{ env.TEST_IMAGE }};
# Upload docker if pull request no tag
- name: Upload Docker No Tag
if: ${{ github.event_name != 'pull_request' }}
run: |
echo "Pushing to docker registry";
echo "${{ secrets.DOCKER_PASSWORD }}" | docker login -u "${{ secrets.DOCKER_USERNAME }}" --password-stdin;
docker push ${{ secrets.DOCKER_UPLOAD_URL }}:dev;
# No Upload if Pull Request
- name: No Upload
if: ${{ github.event_name == 'pull_request' }}
run: |
echo "Uploading is skipped for pull requests."
# Save image as artifact for startup test job
- name: Upload Docker Artifact
uses: ishworkh/docker-image-artifact-upload@v1
with:
image: ${{ env.TEST_IMAGE }}
retention_days: "1"
startup_test:
name: Docker Start-up Test
needs: [docker-build]
runs-on: ubuntu-latest
services:
tethys-postgis:
image: postgis/postgis:14-3.3
env:
POSTGRES_HOST: tethys-postgis
POSTGRES_PASSWORD: please_dont_use_default_passwords
POSTGRES_DB: tethys_postgis
POSTGRES_PORT: 5432
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 10
ports:
- 5432:5432
steps:
- name: Download Docker Artifact
uses: ishworkh/docker-image-artifact-download@v1
with:
image: ${{ env.TEST_IMAGE }}
- name: Run Salt Test
run: |
docker run --rm \
-e POSTGRES_DB=${{ env.POSTGRES_DB }} \
-e POSTGRES_PASSWORD=${{ env.POSTGRES_PASSWORD }} \
-e POSTGRES_PORT=${{ env.POSTGRES_PORT }} \
-e TETHYS_DB_HOST='${{ env.TETHYS_DB_HOST }}' \
-e TETHYS_DB_PORT=${{ env.TETHYS_DB_PORT }} \
-e TETHYS_DB_USERNAME=${{ env.TETHYS_DB_USERNAME }} \
-e TETHYS_DB_PASSWORD=${{ env.TETHYS_DB_PASSWORD }} \
-e TETHYS_DB_SUPERUSER=${{ env.TETHYS_DB_SUPERUSER }} \
-e TETHYS_DB_SUPERUSER_PASS=${{ env.TETHYS_DB_SUPERUSER_PASS }} \
${{ env.TEST_IMAGE }} \
/bin/bash -c "cd /usr/lib/tethys && source ./run.sh --test"
conda-build:
name: Conda Build
runs-on: ${{ matrix.platform }}
strategy:
fail-fast: false
matrix:
platform: [ubuntu-latest]
python-version: [3.7]
steps:
# Checkout the source
- name: Checkout Source
uses: actions/checkout@v2
with:
fetch-depth: 0
# Setup Tethys
- name: Setup Tethys
run: |
cd ..
bash ./tethys/scripts/install_tethys.sh --partial-tethys-install me -n tethys -s $PWD/tethys
. ~/miniconda/etc/profile.d/conda.sh
conda activate tethys
hash -r
conda config --set always_yes yes --set changeps1 no
conda update -q conda
# Export Conda Build Path
- name: Set Conda Build Path
uses: allenevans/[email protected]
with:
CONDA_BLD_PATH: "/home/runner/conda-bld"
# Generate Conda Recipe Without Constrained Dependencies
- name: Generate Conda Recipe
run: |
cd ..
. ~/miniconda/etc/profile.d/conda.sh;
conda activate tethys;
tethys gen metayaml --overwrite;
# Show Tethys Meta
- name: Show Tethys Meta
run: |
cd ..
cat ./tethys/conda.recipe/meta.yaml
# Build Conda
- name: Build Conda
run: |
cd ..
. ~/miniconda/etc/profile.d/conda.sh;
conda create -y -c conda-forge -n conda-build conda-build anaconda-client
conda activate conda-build
conda config --set anaconda_upload no
mkdir -p ~/conda-bld
conda-build -c conda-forge ./tethys/conda.recipe
# Upload Conda No Pull Request No Tag
- name: Upload Conda No Tag
if: ${{ github.event_name != 'pull_request' }}
run: |
cd ..
. ~/miniconda/etc/profile.d/conda.sh;
ls ~/conda-bld/noarch
conda activate conda-build
anaconda -t "${{ secrets.CONDA_UPLOAD_TOKEN }}" upload -u ${{ secrets.CONDA_UPLOAD_USER }} -l dev $CONDA_BLD_PATH/noarch/tethys-platform*.tar.bz2 --force;
# No Upload if Pull Request
- name: No Upload
if: ${{ github.event_name == 'pull_request' }}
run: |
echo "Uploading is skipped for pull requests."
# BUILD micro-tethys-platform
# Generate Conda Recipe Without Constrained Dependencies
- name: Generate Conda Recipe - micro
run: |
cd ..
. ~/miniconda/etc/profile.d/conda.sh;
conda activate tethys;
tethys gen metayaml --micro --overwrite;
# Show Tethys Meta
- name: Show Tethys Meta - micro
run: |
cd ..
cat ./tethys/conda.recipe/meta.yaml
# Build Conda
- name: Build Conda - micro
run: |
cd ..
. ~/miniconda/etc/profile.d/conda.sh;
conda create -y -c conda-forge -n conda-build conda-build anaconda-client
conda activate conda-build
conda config --set anaconda_upload no
mkdir -p ~/conda-bld
conda-build -c conda-forge ./tethys/conda.recipe
# Upload Conda No Pull Request No Tag
- name: Upload Conda No Tag - micro
if: ${{ github.event_name != 'pull_request' }}
run: |
cd ..
. ~/miniconda/etc/profile.d/conda.sh;
ls ~/conda-bld/noarch
conda activate conda-build
anaconda -t "${{ secrets.CONDA_UPLOAD_TOKEN }}" upload -u ${{ secrets.CONDA_UPLOAD_USER }} -l dev $CONDA_BLD_PATH/noarch/micro-tethys-platform*.tar.bz2 --force;
# No Upload if Pull Request
- name: No Upload - micro
if: ${{ github.event_name == 'pull_request' }}
run: |
echo "Uploading is skipped for pull requests."