-
Notifications
You must be signed in to change notification settings - Fork 0
84 lines (69 loc) · 2.79 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
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
name: Tests
# Enable Buildkit and let compose use it to speed up image building
#env:
# DOCKER_BUILDKIT: 1
# COMPOSE_DOCKER_CLI_BUILD: 1
concurrency:
group: test-${{ github.head_ref }}
cancel-in-progress: true
env:
DJANGO_DEBUG: True
PYTHONUNBUFFERED: "1"
FORCE_COLOR: "1"
on:
pull_request:
branches: [ "master", "main" ]
paths-ignore: [ "docs/**", "README.md", "CONTRIBUTING.md", "CODE_OF_CONDUCT.md", "SECURITY.md", "LICENSE", "justfile"]
push:
branches: [ "master", "main" ]
paths-ignore: [ "docs/**", "README.md", "CONTRIBUTING.md", "CODE_OF_CONDUCT.md", "SECURITY.md", "LICENSE", "justfile" ]
jobs:
# With no caching at all the entire ci process takes 4m 30s to complete!
run:
name: Python ${{ matrix.python-version }} Django ${{ matrix.django-version }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest]
python-version: [ "3.11", "3.12" ]
django-version: ["5.0"]
steps:
- name: Checkout Code Repository
uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }} Django ${{ matrix.django-version }}
id: setup_python
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
django-version: ${{ matrix.django-version }}
- name: Install uv
run: pip install --upgrade uv
- name: Setup cache
uses: actions/cache@v4
with:
path: .venv
key: venv-${{ runner.os }}-${{ steps.setup_python.outputs.python-version}}-Django-${{ steps.setup_python.outputs.django_version }}-${{ hashFiles('requirements-dev.lock') }}
restore-keys: venv-${{ runner.os }}-${{ steps.setup_python.outputs.python-version}}-Django-${{ steps.setup_python.outputs.django_version }}
- name: Create venv, install dependencies
run: |
if [ ! -d .venv ]; then
python -m uv venv
fi
python -m uv pip install --upgrade -e .[test]
python -m uv pip install "en-core-web-trf @ https://github.com/explosion/spacy-models/releases/download/en_core_web_trf-3.7.3/en_core_web_trf-3.7.3-py3-none-any.whl"
python -m uv pip install Django~="${{ matrix.django-version }}.0"
source .venv/bin/activate
echo "$VIRTUAL_ENV/bin" >> $GITHUB_PATH
echo "VIRTUAL_ENV=$VIRTUAL_ENV" >> $GITHUB_ENV
- name: Test with pytest
run: |
sqlite3 tests/django_quotes.db '.databases'
python manage.py collectstatic --noinput
python -m pytest --cov-report= --cov-config=pyproject.toml --cov=src/django_quotes
python -m coverage lcov
- name: Submit coverage data to coveralls.io
uses: coverallsapp/github-action@master
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
path-to-lcov: "coverage.lcov"