-
Notifications
You must be signed in to change notification settings - Fork 1
113 lines (107 loc) · 3.3 KB
/
checks.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: checks
on:
push:
branches: [ main, develop ]
pull_request: # run on all PRs
schedule: # run weekly
- cron: "0 12 * * 0"
# HACK: let's add fake colandr envvars so tests can run
# TODO (burton): figure out a better way of configuring the app!
env:
COLANDR_DB_USER: "colandr_app"
COLANDR_DB_PASSWORD: "password"
COLANDR_DB_HOST: "localhost"
COLANDR_DB_NAME: "colandr"
COLANDR_DATABASE_URI: "postgresql+psycopg://colandr_app:password@localhost:5432/colandr"
COLANDR_SECRET_KEY: "colandr_secret_key"
COLANDR_APP_DIR: "/tmp"
COLANDR_MAIL_USERNAME: "colandr_mail_username"
COLANDR_MAIL_PASSWORD: "colandr_mail_password"
jobs:
tests:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
python-version: ["3.10", "3.11"]
# TODO: also run on macos-latest pending docker/colima issue
os: [ubuntu-latest]
services:
# NOTE: these containers should match those in app's docker compose file
colandr_db:
image: "postgres:16"
env:
POSTGRES_USER: ${{ env.COLANDR_DB_USER }}
POSTGRES_PASSWORD: ${{ env.COLANDR_DB_PASSWORD }}
POSTGRES_DB: ${{ env.COLANDR_DB_NAME }}
ports:
- 5432:5432
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
colandr_broker:
image: "redis:7.0"
options: >-
--health-cmd "redis-cli ping"
--health-interval 10s
--health-timeout 5s
--health-retries 5
ports:
- 6379:6379
steps:
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
cache: "pip"
cache-dependency-path: "pyproject.toml"
- name: Install dependencies
run: |
python -m pip install --upgrade pip wheel
python -m pip install -e '.[dev]'
- name: Download language data
run: |
python -m textacy download lang_identifier --version 3.0
python -m spacy download en_core_web_md
python -m spacy download es_core_news_md
python -m spacy download fr_core_news_md
- name: Test with pytest
run: |
python -m pytest tests --verbose
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.11"
cache: "pip"
cache-dependency-path: "pyproject.toml"
- name: Install dependencies
run: |
python -m pip install --upgrade pip wheel
python -m pip install -e '.[dev]'
- name: Check with ruff
run: |
python -m ruff check --output-format=github --exit-zero colandr
types:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.11"
cache: "pip"
cache-dependency-path: "pyproject.toml"
- name: Install dependencies
run: |
python -m pip install --upgrade pip wheel
python -m pip install -e '.[dev]'
- name: Check types with mypy
run: |
python -m mypy --install-types --non-interactive colandr