-
Notifications
You must be signed in to change notification settings - Fork 0
68 lines (59 loc) · 1.67 KB
/
ci.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
name: Continuous Integration
on:
push:
branches:
- main
- develop
pull_request:
jobs:
ci:
name: Lint and Test
runs-on: ubuntu-20.04
env:
DATABASE_URL: mongodb://mongo:mongo@localhost:27017/notifications?authSource=admin
REDIS_HOST: localhost
REDIS_PORT: 6379
services:
mongodb:
image: mongo
env:
MONGO_INITDB_DATABASE: notifications
MONGO_INITDB_ROOT_USERNAME: mongo
MONGO_INITDB_ROOT_PASSWORD: mongo
ports:
- 27017:27017
redis:
image: redis:alpine
ports:
- 6379:6379
steps:
- uses: actions/checkout@v2
- name: Set up Python 3.10
uses: actions/setup-python@v2
with:
python-version: "3.10"
- name: Install Poetry
uses: snok/install-poetry@v1.1.6
with:
virtualenvs-in-project: false
virtualenvs-path: ~/.virtualenvs
- name: Load cached Poetry venv
id: cached-poetry-dependencies
uses: actions/cache@v2
with:
path: ~/.virtualenvs
key: ${{ runner.os }}-poetry-${{ hashFiles('**/poetry.lock') }}
- name: Install Dependencies
run: poetry install
if: steps.cached-poetry-dependencies.outputs.cache-hit != 'true'
- name: Pre-commit cache
uses: actions/cache@v2
with:
path: ~/.cache/pre-commit
key: ${{ runner.os }}-pre-commit-${{ hashFiles('.pre-commit-config.yaml') }}
restore-keys: |
${{ runner.os }}-pre-commit-
- name: Run pre-commit hooks
run: make lint
- name: Run tests with pytest
run: make test