-
Notifications
You must be signed in to change notification settings - Fork 3
129 lines (112 loc) · 3.84 KB
/
run_unitTest_GenerateRiverFlows.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
name: Unit Tests
on: push
jobs:
test:
name: Set up and test
runs-on: ubuntu-latest
defaults:
run:
shell: bash -l {0}
services:
postgres:
image: postgis/postgis:14-3.2
env:
# must specify password for PG Docker container image, see: https://registry.hub.docker.com/_/postgres?tab=description&page=1&name=10
POSTGRES_USER: manyfews
POSTGRES_PASSWORD: manyfews
POSTGRES_DB: manyfews
ports:
- 5432:5432
# needed because the postgres container does not provide a healthcheck
options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5
steps:
- uses: actions/checkout@v2
-
name: Install dependencies
run: |
sudo apt-get install binutils libproj-dev gdal-bin
-
name: Cache Miniconda environment
uses: actions/cache@v3
with:
path: /usr/share/miniconda3/envs/anaconda-client-env
key: conda-${{ runner.os }}--${{ runner.arch }}--${{ steps.get-date.outputs.today }}-${{ hashFiles('config/manyFEWS.base.yml') }}-${{ env.CACHE_NUMBER }}
env:
# Increase this to manually invalidate the cache
CACHE_NUMBER: 0 +
id: cache
-
name: Install chromedriver
uses: nanasess/setup-chromedriver@v2
-
uses: conda-incubator/setup-miniconda@v2
with:
miniforge-variant: Mambaforge
miniforge-version: latest
activate-environment: anaconda-client-env
environment-file: config/manyFEWS.base.yml
python-version: 3.9
auto-activate-base: false
use-mamba: true
use-only-tar-bz2: true # IMPORTANT: This needs to be set for caching to work properly!
# https://github.com/conda-incubator/setup-miniconda/issues/105#issuecomment-730243912
-
name: Install dev dependencies and list packages
shell: bash -l {0}
run: |
conda env update -n anaconda-client-env -f config/manyFEWS.devel.yml
conda info
conda list
-
name: Install npm
uses: actions/setup-node@v2
with:
node-version: '16'
-
name: Run Django migrations
run: |
cp ./manyfews/.env.CI ./manyfews/.env
python manage.py migrate
working-directory: manyfews
-
name: Start XVFB
run: |
sudo Xvfb -ac :99 -screen 0 1280x1024x24 > /dev/null 2>&1 & # optional
-
name: Run Django tests
env:
ZENTRA_UN: ${{ secrets.ZENTRA_CLOUD_USERNAME }}
ZENTRA_PW: ${{ secrets.ZENTRA_CLOUD_PASSWORD }}
MAP_URL: ${{ secrets.MAP_URL }}
EMAIL_HOST_USER: ${{ secrets.EMAIL_HOST_USER }}
EMAIL_HOST_PASSWORD: ${{ secrets.EMAIL_HOST_PASSWORD }}
STATION_SN: ${{ vars.STATION_SN }}
DISPLAY: :99
run: coverage run --source='.' manage.py test
working-directory: manyfews
-
name: Check npm and webpack
run: |
npm install
npm run build
working-directory: manyfews
-
name: Check built assets are up-to-date
run: |
if [[ `git status --porcelain manyfews/webapp/static` ]]; then
echo "Static files are not up to date:"
git status --porcelain manyfews/webapp/static
echo "Run 'npm run build' from the 'manyfews' directory and commit the changes."
exit 1
fi
working-directory: manyfews
-
name: Create coverage.py XML report
run: |
coverage xml
working-directory: manyfews
-
name: Upload coverage reports to Codecov with GitHub Action
uses: codecov/codecov-action@v3
with:
token: ${{ secrets.CODECOV_TOKEN }}