-
Notifications
You must be signed in to change notification settings - Fork 1
112 lines (105 loc) · 4.13 KB
/
Copy pathpython-package.yml
File metadata and controls
112 lines (105 loc) · 4.13 KB
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
# This workflow will install Python dependencies, run tests and lint with a variety of Python versions
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions
name: Python package
on:
push:
branches:
- master
pull_request:
branches:
- master
jobs:
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: "3.12"
- uses: astral-sh/setup-uv@v7
- name: Lint with ruff
run: |
# stop the build if there are Python syntax errors or undefined names
uv run -- ruff check . --select=E9,F63,F7,F82 --statistics --exclude=.venv/,./src/whathappened/migrations/
# exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide
uv run -- ruff check . --exit-zero --statistics --exclude=.venv/,./src/whathappened/migrations/
coverage:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: "3.12"
- uses: astral-sh/setup-uv@v7
- name: Test with pytest and make coverage report
run: |
uv run pytest -vvv --cov=whathappened
uv run coverage report
uv run coverage html
continue-on-error: ${{ contains(matrix.python-version, 'beta')}}
- name: Archive coverage html report
uses: actions/upload-artifact@v4
with:
name: code-coverage-report
path: htmlcov
check-migration:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: "3.12"
- uses: astral-sh/setup-uv@v7
- name: Check if database needs migration.
run: |
FLASK_APP=./src/whathappened.web uv run -- flask db upgrade
FLASK_APP=./src/whathappened.web uv run -- flask db check
continue-on-error: ${{ contains(matrix.python-version, 'beta')}}
test-frontend:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Test frontend
run: |
npm install; npm run test
build:
strategy:
matrix:
python-version: ["3.12", "3.13", "3.14"]
os: [ubuntu-24.04, macos-14]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v3
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- uses: astral-sh/setup-uv@v7
- name: Install dependencies
run: |
uv venv
uv pip install --upgrade setuptools
npm install; cd ..
- name: Build assets
run: |
FLASK_APP=src/whathappened.web uv run -- flask assets build
FLASK_APP=src/whathappened.web uv run -- flask main build
continue-on-error: ${{ contains(matrix.python-version, 'beta')}}
- name: Test with pytest and make coverage report
run: |
uv run pytest -vvv
continue-on-error: ${{ contains(matrix.python-version, 'beta')}}
- name: Setup database
run: |
make setup
- name: Run package creation
run: |
make dist
- name: Archive package
uses: actions/upload-artifact@v4
with:
name: whathappened-${{ matrix.os }}-${{ matrix.python-version }}
path: dist