-
Notifications
You must be signed in to change notification settings - Fork 0
113 lines (100 loc) · 2.82 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
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
name: CI
on:
push:
branches: [main]
pull_request:
branches: ["**"]
jobs:
Linting:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Fetch base and install Poetry
run: |
git fetch origin ${{github.base_ref}}
pipx install poetry
- name: Setup Python
uses: actions/setup-python@v4
with:
python-version: "3.11"
cache: "poetry"
- name: Install Python Packages
run: |
poetry install --only dev
- name: Run flake8
run: poetry run flake8 geoapi
- name: Formatting with black
run: |
cd devops
poetry run black --check 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@v4
- name: Fetch base and install Poetry
run: |
git fetch origin ${{github.base_ref}}
pipx install poetry
- name: Setup Python
uses: actions/setup-python@v4
with:
python-version: "3.11"
cache: "poetry"
- name: Install ffmpeg
run: |
sudo apt-get update
sudo apt-get install -y ffmpeg
- 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: postgis/postgis:11-3.0-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@v4
- 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"