Files
Daniel Bast b7f14397b0 Add Python 3.12 to test matrix as upper bound and fix findings
This is done in advance to open the door for upgrading to newer Python
versions on seeedsigner-os at any time.

Fixes / required changes:
* Fix `E   ValueError: mutable default <class 'seedsigner.views.view.Destination'> for field next_destination is not allowed: use default_factory`
* Install package during CI with pip instead of calling the setup.py (which
  got deprecated a while a ago and breaks with Python 3.11/3.12)
* Update Pillow version to 10.0.1 = first version with Python 3.12 support
2024-05-16 15:30:38 +02:00

67 lines
2.0 KiB
YAML

name: CI
on:
push:
branches:
- dev
- main
pull_request:
concurrency:
# Concurrency group that uses the workflow name and PR number if available
# or commit SHA as a fallback. If a new build is triggered under that
# concurrency group while a previous build is running it will be canceled.
# Repeated pushes to a PR will cancel all previous builds, while multiple
# merges to main will not cancel.
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.sha }}
cancel-in-progress: true
jobs:
test:
runs-on: ubuntu-latest
strategy:
matrix:
# 3.10: currently used by Seedsigner
# 3.12: latest stable Python as upper test bound
python-version: ["3.10", "3.12"]
steps:
- uses: actions/checkout@v3
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
sudo apt-get install libzbar0
python -m pip install --upgrade pip
pip install -r requirements.txt -r tests/requirements.txt
pip install .
- name: Test with pytest
run: |
mkdir artifacts
python -m pytest \
--color=yes \
--cov=seedsigner \
--cov-append \
--cov-branch \
--cov-report term \
--cov-report html \
--cov-report html:./artifacts/cov_html \
--cov-report xml \
--durations 5 \
-vv
- name: Generate screenshots
run: |
python -m pytest tests/screenshot_generator/generator.py
cp -r ./seedsigner-screenshots ./artifacts/
- name: Archive CI Artifacts
uses: actions/upload-artifact@v3
with:
name: ci-artifacts
path: artifacts/**
retention-days: 10
# Upload also when tests fail. The workflow result (red/green) will
# be not effected by this.
if: always()