| 1 |
# vim: et ts=2 sw=2 |
| 2 |
--- |
| 3 |
name: Python build and package |
| 4 |
|
| 5 |
on: [push] |
| 6 |
|
| 7 |
jobs: |
| 8 |
build: |
| 9 |
runs-on: ubuntu-latest |
| 10 |
strategy: |
| 11 |
matrix: |
| 12 |
# python-version: ['3.9', '3.10', '3.11', '3.12', '3.13'] |
| 13 |
python-version: ['3.9'] |
| 14 |
|
| 15 |
steps: |
| 16 |
- uses: actions/checkout@v4 |
| 17 |
|
| 18 |
- name: Set up Python ${{ matrix.python-version }} |
| 19 |
uses: actions/setup-python@v5 |
| 20 |
with: |
| 21 |
python-version: ${{ matrix.python-version }} |
| 22 |
|
| 23 |
- name: Install dependencies |
| 24 |
run: | |
| 25 |
sudo apt-get install sqlite3 |
| 26 |
python -m pip install wheel |
| 27 |
python -m pip install -U pip flake8 |
| 28 |
python -m pip install -r requirements.txt |
| 29 |
|
| 30 |
- name: Lint Python code |
| 31 |
run: | |
| 32 |
flake8 src tests --config=.flake8 --select=E9,F63,F7,F82 --show-source |
| 33 |
flake8 src tests --config=.flake8 --exit-zero --max-complexity=10 --max-line-length=127 |
| 34 |
|
| 35 |
- name: Run unit tests |
| 36 |
env: |
| 37 |
NETWORK_TESTS: 0 |
| 38 |
PYTHONPATH: '.:src' |
| 39 |
run: | |
| 40 |
mkdir -p /tmp/fangfrisch/unittest |
| 41 |
sqlite3 /tmp/fangfrisch/unittest/db.sqlite < tests/tests.sql |
| 42 |
python -m unittest discover tests/ -v |
| 43 |
|
| 44 |
- name: Build |
| 45 |
run: python -m build |
| 46 |
|
| 47 |
- name: Upload artifacts |
| 48 |
uses: actions/upload-artifact@v4 |
| 49 |
with: |
| 50 |
name: ffdist-py${{ matrix.python-version }} |
| 51 |
path: dist/* |