Debian Codegraph @

.github/workflows/test.yml

raw
1 ---
2 name: Test
3
4 on: [push, pull_request]
5
6 jobs:
7 build:
8 name: build (Python ${{ matrix.python-version }}, Django ${{ matrix.django-version }})
9 runs-on: ubuntu-latest
10
11 strategy:
12 fail-fast: false
13 matrix:
14 python-version: ['3.8', '3.9', '3.10', '3.11', '3.12', '3.13-dev']
15 django-version: ['4.2', '5.0', 'main']
16
17 exclude:
18 # Exclude py3.8 and py3.9 for Django main and 5.0
19 - python-version: '3.8'
20 django-version: '5.0'
21 - python-version: '3.9'
22 django-version: '5.0'
23 - python-version: '3.8'
24 django-version: 'main'
25 - python-version: '3.9'
26 django-version: 'main'
27
28 services:
29
30 postgres:
31 image: postgres:latest
32 env:
33 POSTGRES_USER: postgres
34 POSTGRES_PASSWORD: postgres
35 POSTGRES_DB: github_actions
36 ports:
37 - 5432:5432
38 # needed because the postgres container does not provide a healthcheck
39 options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5
40
41 mysql:
42 image: mysql:latest
43 env:
44 MYSQL_DATABASE: mysql
45 MYSQL_ROOT_PASSWORD: mysql
46 ports:
47 - 3306:3306
48 options: --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=3
49
50 mariadb:
51 image: mariadb:latest
52 env:
53 MARIADB_DATABASE: mariadb
54 MARIADB_ROOT_PASSWORD: mariadb
55 ports:
56 - 3307:3306
57 options: --health-cmd="mariadb-admin ping" --health-interval=10s --health-timeout=5s --health-retries=3
58
59 steps:
60 - uses: actions/checkout@v4
61
62 - name: Set up Python ${{ matrix.python-version }}
63 uses: actions/setup-python@v5
64 with:
65 python-version: ${{ matrix.python-version }}
66 cache: 'pip'
67 cache-dependency-path: |
68 pyproject.toml
69 tox.ini
70 requirements/*.txt
71
72 - name: Install dependencies
73 run: |
74 python -m pip install --upgrade pip
75 pip install -r requirements/tox.txt
76
77 - name: Tox tests
78 run: |
79 tox -v
80 env:
81 DJANGO: ${{ matrix.django-version }}
82
83 - name: Upload coverage
84 uses: codecov/codecov-action@v3
85 with:
86 name: Python ${{ matrix.python-version }}, Django ${{ matrix.django-version }}
87
88
89 generated_file_checks:
90 name: Check generated files
91 runs-on: ubuntu-latest
92
93 steps:
94 - uses: actions/checkout@v4
95
96 - name: Install gettext
97 run: |
98 sudo apt-get update
99 sudo apt-get install -y gettext
100
101 - name: Set up newest stable Python version
102 uses: actions/setup-python@v5
103 with:
104 python-version: 3.11
105 cache: 'pip'
106 # Invalidate the cache when this file updates, as the dependencies' versions
107 # are pinned in the step below
108 cache-dependency-path: '.github/workflows/test.yml'
109
110 - name: Install dependencies
111 run: |
112 python -m pip install --upgrade pip
113 # Install this project in editable mode, so that its package metadata can be queried
114 pip install -e .
115 # Install the latest minor version of Django we support
116 pip install Django==5.0
117
118 - name: Check translation files are updated
119 run: python -m simple_history.tests.generated_file_checks.check_translations