-
Notifications
You must be signed in to change notification settings - Fork 1
131 lines (112 loc) · 3.76 KB
/
test.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
name: Tests
on:
pull_request:
push:
branches:
- master
- main
- next
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
env:
DEBIAN_FRONTEND: noninteractive
REGISTRY: ghcr.io
IMAGE_NAME: ${{ github.repository }}
CI: false
jobs:
python-unittests:
name: Python Unit tests
runs-on: ubuntu-latest
env:
POSTGRES_DB: postgres
POSTGRES_PASSWORD: postgres
POSTGRES_USER: postgres
POSTGRES_HOST: 127.0.0.1
MEMCACHE_HOST: 127.0.0.1
services:
postgres:
image: postgis/postgis:16-3.4
env:
POSTGRES_DB: postgres
POSTGRES_PASSWORD: postgres
POSTGRES_USER: postgres
ports:
- 5432:5432
# Set health checks to wait until postgres has started
options: >-
--health-cmd pg_isready
memcached:
image: memcached:alpine
ports:
- 11211:11211
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version-file: ./backend/.python-version
cache: 'pip'
cache-dependency-path: |
./backend/requirements.txt
./backend/dev-requirements.txt
- name: Install system libraries
working-directory: ./backend
run: |
sudo apt-get -qq update
sudo apt-get -qq install -y libpq-dev gdal-bin gettext
- name: Install dependencies
working-directory: ./backend
run: |
pip install -r requirements.txt -r dev-requirements.txt
- name: Run django unit tests
working-directory: ./backend
run: |
coverage run --parallel-mode --concurrency=multiprocessing ./manage.py test --parallel -v 3
coverage combine
coverage xml -o coverage.xml
- uses: codecov/codecov-action@v4
with:
files: ./backend/coverage.xml
flags: python-unittests
token: ${{ secrets.CODECOV_TOKEN }}
js-build:
name: JS tests
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version-file: ./front-end/.nvmrc
cache: 'npm'
cache-dependency-path: ./front-end/.nvmrc
- name: Install node dependencies
working-directory: ./front-end
run: |
npm ci --no-audit
- name: npm build
working-directory: ./front-end
run: |
cp .env.dist .env
npm run build
docker-build:
name: Docker build
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Docker meta
id: meta
uses: docker/metadata-action@v5
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Build and push
uses: docker/build-push-action@v6
with:
context: .
file: .docker/Dockerfile
push: false
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
target: prod