-
Notifications
You must be signed in to change notification settings - Fork 9
57 lines (53 loc) · 1.56 KB
/
build-and-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
name: Unit Tests
on: [pull_request]
jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ["3.11"]
fail-fast: false
services:
mongodb:
image: mongo:6.0.4
env:
MONGO_INITDB_DATABASE: greenhouse
MONGO_INITDB_ROOT_USERNAME: farmer
MONGO_INITDB_ROOT_PASSWORD: tractor
ports:
- 27017:27017
steps:
- uses: actions/checkout@v3
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: Install Poetry
uses: snok/install-poetry@v1
- name: Load cached venv
id: cached-poetry-dependencies
uses: actions/cache@v3
with:
path: .venv
key: venv-${{ runner.os }}-3.11-${{ hashFiles('**/poetry.lock') }}
- name: Install dependencies
if: steps.cached-poetry-dependencies.outputs.cache-hit != 'true'
run: poetry install --no-interaction --no-root
- name: Test Code
run: poetry run pytest
env:
PYTHONDONTWRITEBYTECODE: 1
PYTHONUNBUFFERED: 1
ENVIRONMENT: test
TESTING: 0
UP: up
DOWN: down
WEB_SERVER: web_server
MONGO_HOST: mongodb
MONGO_PORT: 27017
MONGO_USER: farmer
MONGO_PASS: tractor
MONGO_DB: greenhouse
MONGO_COLLECTION: greens
MONGO_TEST_DB: farmland
MONGO_URL: mongodb://farmer:[email protected]:27017/?retryWrites=true&w=majority