-
Notifications
You must be signed in to change notification settings - Fork 43
90 lines (88 loc) · 2.37 KB
/
python.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
name: Python CI
on:
push:
branches: [master]
paths:
- ".github/workflows/python.yml"
- "backend/**"
- "poetry.lock"
- "pyproject.toml"
- "requirements.txt"
- "tests/**"
pull_request:
branches: [master]
paths:
- ".github/workflows/python.yml"
- "backend/**"
- "poetry.lock"
- "pyproject.toml"
- "requirements.txt"
- "tests/**"
jobs:
lint:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: [3.11]
poetry-version: [1.8.1]
steps:
- uses: actions/checkout@v4
- name: Setup poetry
uses: abatilo/actions-poetry@v3
with:
poetry-version: ${{ matrix.poetry-version }}
- uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
cache: "poetry"
- name: Install dependencies
run: poetry install
- name: Ruff check
run: poetry run ruff check backend/ tests/
- name: Pyupgrade
run: poetry run pyupgrade --py311-plus **/*.py
test:
runs-on: ubuntu-latest
services:
spamassassin:
image: instantlinux/spamassassin:4.0.0-6
ports:
- 783:783
strategy:
matrix:
python-version: [3.11]
poetry-version: [1.8.1]
steps:
- uses: actions/checkout@v4
- name: Setup poetry
uses: abatilo/actions-poetry@v3
with:
poetry-version: ${{ matrix.poetry-version }}
- uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
cache: "poetry"
- name: Install dependencies
run: poetry install
- name: Make dummy frontend directory
run: mkdir -p frontend/dist/
- name: Wait until SpamAssasin ready
run: poetry run python scripts/ping.py
- name: Run tests
run: poetry run pytest -v --cov=app --cov-report=term-missing
- name: Coveralls
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: poetry run coveralls --service=github
coveralls:
name: Indicate completion to coveralls.io
needs: test
runs-on: ubuntu-latest
container: python:3-slim
steps:
- name: Finished
run: |
pip3 install --upgrade coveralls
coveralls --finish
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}