Skip to content

Commit e18be73

Browse files
committed
updates CI
1 parent 5b5fd0f commit e18be73

File tree

2 files changed

+139
-111
lines changed

2 files changed

+139
-111
lines changed

.github/file-filters.yml

Lines changed: 7 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,3 @@
1-
# This is used by the action https://github.com/dorny/paths-filter
2-
docker: &docker
3-
- added|modified: './docker/**/*'
4-
- added|modified: './docker/*'
5-
61
dependencies: &dependencies
72
- 'pdm.lock'
83
- 'pyproject.toml'
@@ -13,33 +8,23 @@ actions: &actions
138
python: &python
149
- added|modified: 'src/**'
1510
- added|modified: 'tests/**'
16-
- 'manage.py'
11+
- added|modified: '.pre-commit-config.yaml'
1712

1813
changelog:
19-
- added|modified: 'changes/**'
2014
- 'CHANGELOG.md'
2115

22-
mypy:
23-
- *python
24-
- 'mypy.ini'
25-
26-
run_tests:
16+
run_tests: &tests
2717
- *actions
2818
- *python
29-
- *docker
3019
- *dependencies
31-
- 'pytest.ini'
32-
33-
migrations:
34-
- added|modified: 'src/**/migrations/*'
20+
- 'tox.ini'
3521

36-
lint:
37-
- *python
38-
- '.flake8'
39-
- 'pyproject.toml'
22+
package:
23+
- *tests
24+
- *dependencies
4025

4126
docs:
4227
- added|modified: './docs/**/*'
43-
- modified: './src/birder/config/__init__.py'
28+
- modified: './README.md'
4429
- modified: './github/workflows/docs.yml'
4530
- modified: './github/file-filters.yml'

.github/workflows/tests.yaml

Lines changed: 132 additions & 89 deletions
Original file line numberDiff line numberDiff line change
@@ -1,95 +1,138 @@
11
name: Test
22

33
on:
4-
push:
5-
branches:
6-
- master
7-
- develop
8-
pull_request:
4+
push:
5+
branches:
6+
- master
7+
- develop
8+
pull_request:
99

1010
jobs:
11-
pkg_meta:
12-
runs-on: ubuntu-latest
13-
steps:
14-
- uses: actions/checkout@v2
15-
- uses: actions/setup-python@v2
16-
17-
- name: Install dependencies
18-
run: |
19-
python -m pip install --upgrade pip tox
20-
- name: Lint with flake8
21-
run: |
22-
tox -e pkg_meta
23-
lint:
24-
runs-on: ubuntu-latest
25-
steps:
26-
- uses: actions/checkout@v2
27-
- uses: actions/setup-python@v2
28-
29-
- name: Install dependencies
30-
run: |
31-
python -m pip install --upgrade pip tox
32-
- name: Lint with flake8
33-
run: |
34-
tox -e lint
35-
36-
test:
37-
runs-on: ubuntu-latest
38-
strategy:
39-
fail-fast: false
40-
matrix:
41-
python-version: [ "3.11", "3.12"]
42-
django-version: [ "3.2", "4.2", "5.1"]
43-
db-engine: ["pg", "mysql"]
11+
changes:
12+
runs-on: ubuntu-latest
13+
timeout-minutes: 1
14+
defaults:
15+
run:
16+
shell: bash
17+
outputs:
18+
run_tests: ${{ steps.changes.outputs.run_tests }}
19+
steps:
20+
- name: Checkout code
21+
uses: actions/checkout@v4
22+
- id: changes
23+
name: Check for file changes
24+
uses: dorny/paths-filter@0bc4621a3135347011ad047f9ecf449bf72ce2bd # v3.0.0
25+
with:
26+
base: ${{ github.ref }}
27+
token: ${{ github.token }}
28+
filters: .github/file-filters.yml
29+
30+
pkg_meta:
31+
needs: [ changes ]
32+
if: needs.changes.outputs.run_tests == 'true'
33+
34+
runs-on: ubuntu-latest
35+
steps:
36+
- uses: actions/checkout@v4
37+
- uses: actions/setup-python@v2
38+
39+
- name: Install dependencies
40+
run: |
41+
python -m pip install --upgrade pip tox
42+
- name: Lint with flake8
43+
run: |
44+
tox -e pkg_meta
45+
lint:
46+
needs: [ changes ]
47+
if: needs.changes.outputs.run_tests == 'true'
48+
49+
runs-on: ubuntu-latest
50+
steps:
51+
- uses: actions/checkout@v4
52+
- uses: actions/setup-python@v2
53+
54+
- name: Install dependencies
55+
run: |
56+
python -m pip install --upgrade pip tox
57+
- name: Lint with flake8
58+
run: |
59+
tox -e lint
60+
61+
test:
62+
needs: [ changes ]
63+
if: needs.changes.outputs.run_tests == 'true'
64+
65+
runs-on: ubuntu-latest
66+
strategy:
67+
fail-fast: false
68+
matrix:
69+
python-version: [ "3.11", "3.12" ]
70+
django-version: [ "3.2", "4.2", "5.1" ]
71+
db-engine: [ "pg", "mysql" ]
72+
env:
73+
PY_VER: ${{ matrix.python-version}}
74+
DJ_VER: ${{ matrix.django-version}}
75+
DBENGINE: ${{ matrix.db-engine}}
76+
MYSQL_USER: 'root'
77+
MYSQL_PASSWORD: 'root'
78+
79+
services:
80+
postgres:
81+
image: postgres
4482
env:
45-
PY_VER: ${{ matrix.python-version}}
46-
DJ_VER: ${{ matrix.django-version}}
47-
DBENGINE: ${{ matrix.db-engine}}
48-
MYSQL_USER: 'root'
49-
MYSQL_PASSWORD: 'root'
50-
51-
services:
52-
postgres:
53-
image: postgres
54-
env:
55-
POSTGRES_USER: postgres
56-
POSTGRES_PASSWORD: postgres
57-
POSTGRES_DB: concurrency
58-
ports:
59-
- 5432:5432
60-
options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5
61-
62-
mysql:
63-
image: mysql:5.7
64-
env:
65-
MYSQL_DATABASE: test_db
66-
MYSQL_USER: user
67-
MYSQL_PASSWORD: password
68-
MYSQL_ROOT_PASSWORD: rootpassword
69-
ports:
70-
- 33306:3306
71-
options: --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=5
72-
73-
steps:
74-
- uses: actions/checkout@v2
75-
76-
- name: Setup MySQL
77-
run: |
78-
sudo /etc/init.d/mysql start
79-
mysql -e 'CREATE DATABASE concurrency;' -uroot -proot
80-
mysql -e 'SHOW DATABASES;' -uroot -proot
81-
82-
- name: Set up Python ${{ matrix.python-version }}
83-
uses: actions/setup-python@v2
84-
with:
85-
python-version: ${{ matrix.python-version }}
86-
87-
- name: Install dependencies
88-
run: python -m pip install --upgrade pip tox
89-
90-
- name: Test with
91-
run: tox -e d${DJ_VER//.}-py${PY_VER//.}-${DBENGINE}
92-
93-
- uses: codecov/codecov-action@v1
94-
with:
95-
verbose: true
83+
POSTGRES_USER: postgres
84+
POSTGRES_PASSWORD: postgres
85+
POSTGRES_DB: concurrency
86+
ports:
87+
- 5432:5432
88+
options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5
89+
90+
mysql:
91+
image: mysql:5.7
92+
env:
93+
MYSQL_DATABASE: test_db
94+
MYSQL_USER: user
95+
MYSQL_PASSWORD: password
96+
MYSQL_ROOT_PASSWORD: rootpassword
97+
ports:
98+
- 33306:3306
99+
options: --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=5
100+
101+
steps:
102+
- uses: actions/checkout@v4
103+
104+
- name: Setup MySQL
105+
run: |
106+
sudo /etc/init.d/mysql start
107+
mysql -e 'CREATE DATABASE concurrency;' -uroot -proot
108+
mysql -e 'SHOW DATABASES;' -uroot -proot
109+
110+
- name: Set up Python ${{ matrix.python-version }}
111+
uses: actions/setup-python@v5
112+
with:
113+
python-version: ${{ matrix.python-version }}
114+
115+
- name: Install dependencies
116+
run: python -m pip install --upgrade pip tox
117+
118+
- name: Test with
119+
run: tox -e d${DJ_VER//.}-py${PY_VER//.}-${DBENGINE}
120+
121+
- name: UUpload test results to Codecov
122+
uses: codecov/test-results-action@v1
123+
with:
124+
env_vars: OS
125+
flags: ${{ matrix.django }} ${{ matrix.python }}
126+
token: ${{ secrets.CODECOV_TOKEN }}
127+
verbose: true
128+
129+
- name: Upload coverage to Codecov
130+
uses: codecov/codecov-action@v5
131+
with:
132+
env_vars: OS,PYTHON
133+
fail_ci_if_error: true
134+
files: ./coverage1.xml,./coverage2.xml,!./cache
135+
flags: unittests
136+
name: codecov-umbrella
137+
token: ${{ secrets.CODECOV_TOKEN }}
138+
verbose: true

0 commit comments

Comments
 (0)