-
Notifications
You must be signed in to change notification settings - Fork 0
96 lines (95 loc) · 2.67 KB
/
main.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
name: CI
on:
push:
branches: [main]
pull_request:
branches: ["**"]
jobs:
Linting:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Setup Python
uses: actions/setup-python@v4
with:
python-version: 3.11
- name: Install flake8
run: pip install flake8
- name: Run flake8
run: flake8 geoapi
Geoapi_Unit_Tests:
runs-on: ubuntu-latest
env:
APP_ENV: testing
DB_HOST: localhost
services:
postgres:
image: mdillon/postgis:11-alpine
env:
POSTGRES_USER: dev
POSTGRES_PASSWORD: dev
POSTGRES_DB: test
ports:
- 5432:5432
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
steps:
- uses: actions/checkout@v3
- name: Setup Python
uses: actions/setup-python@v4
with:
python-version: 3.11
- name: Install ffmpeg
run: |
sudo apt-get update
sudo apt-get install -y ffmpeg
- name: Setup Poetry
uses: abatilo/[email protected]
with:
poetry-version: 1.8.3
- uses: actions/cache@v1
with:
path: ~/.cache/pypoetry/virtualenvs
key: ${{ runner.os }}-poetry-${{ hashFiles('**/poetry.lock') }}
restore-keys: |
${{ runner.os }}-poetry-
- name: Install Python Packages
run: |
cd devops
poetry install --with dev,flask,worker
- name: Run server-side unit tests
run: |
cd devops
poetry run pytest ../geoapi
Workers_Unit_Tests:
runs-on: ubuntu-latest
services:
postgres:
image: mdillon/postgis:11-alpine
env:
POSTGRES_USER: dev
POSTGRES_PASSWORD: dev
POSTGRES_DB: test
ports:
- 5432:5432
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
steps:
- uses: actions/checkout@v3
- uses: docker/login-action@v1
with:
password: ${{ secrets.DOCKER_PASSWORD }}
username: ${{ secrets.DOCKER_USER }}
- name: Build worker image
run: |
docker pull taccaci/geoapi-workers:latest
docker build --cache-from taccaci/geoapi-workers:latest -t taccaci/geoapi-workers:latest -f devops/Dockerfile.worker --target development .
- name: Run worker test
run: |
docker run --network="host" -e APP_ENV='testing' -e DB_HOST='localhost' taccaci/geoapi-workers:latest pytest -m "worker"