-
Notifications
You must be signed in to change notification settings - Fork 12
111 lines (102 loc) · 3.09 KB
/
tests.yaml
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
# GeoSight is UNICEF's geospatial web-based business intelligence platform.
#
# Contact : [email protected]
#
# .. note:: This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by
# the Free Software Foundation; either version 3 of the License, or
# (at your option) any later version.
#
# __author__ = '[email protected]'
# __date__ = '13/06/2023'
# __copyright__ = ('Copyright 2023, Unicef')
name: Tests
on:
push:
branches: [ main ]
pull_request:
branches: [ main, version-2.0.0 ]
jobs:
flake8_py3:
name: Python Lint
runs-on: ubuntu-latest
steps:
- name: Setup Python
uses: actions/setup-python@v1
with:
python-version: 3.7
architecture: x64
- name: Checkout PyTorch
uses: actions/checkout@master
- name: Install flake8
run: pip install flake8
- name: Install flake8-docstrings
run: pip install flake8-docstrings
- name: Run flake8
uses: suo/flake8-github-action@releases/v1
with:
checkName: 'Python Lint' # NOTE: this needs to be the same as the job name
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
django_app_test:
needs: flake8_py3
name: 'Django App'
runs-on: ubuntu-latest
env:
APP_IMAGE: kartoza/geosight
steps:
- uses: actions/checkout@v2
- name: Set up QEMU
uses: docker/setup-qemu-action@v1
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
- name: Build test image
uses: docker/build-push-action@v2
with:
context: .
file: deployment/docker/Dockerfile
push: false
load: true
target: dev
tags: ${{ env.APP_IMAGE }}:dev
cache-from: |
type=gha,scope=test
type=gha,scope=prod
cache-to: type=gha,scope=test
- name: Run docker-compose services
working-directory: deployment
run: |
echo "Override docker-compose for testing purposes"
cp docker-compose.test.yml docker-compose.override.yml
cp .template.env .env
cd ../
make devweb
make wait-db
make devweb-entrypoint
make devweb-runserver
make load-test-data
make sleep
- name: Test production config ready
run: make production-check
- name: Test django endpoint
run: |
curl http://localhost:2000/
if [ $? -ne 0 ]; then
echo "Curl command failed"
exit 1
fi
- name: Test E2E
working-directory: ./playwright/ci-test
run: |
npm install
npm ci
npx playwright install --with-deps
npx playwright test --workers 1
- uses: actions/upload-artifact@v3
if: always()
with:
name: playwright-report
path: playwright/ci-test/playwright-report/
retention-days: 30
- name: Test backend
run: make devweb-test