Skip to content

workflows: Remove Ubuntu 18, add Python 3.12 #42

workflows: Remove Ubuntu 18, add Python 3.12

workflows: Remove Ubuntu 18, add Python 3.12 #42

Workflow file for this run

# This workflow will install Python dependencies, run tests and lint with a single version of Python
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-python
name: Python application CI tests
on:
pull_request:
push:
branches:
- master
paths:
- pylabview/**
- tests/**
- examples/**
- .github/**
permissions:
contents: read
jobs:
ubuntu-tests:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-20.04, ubuntu-latest]
python-version: ["3.8", "3.10", "3.12"]
# No test for 3.5, the oldest supported; it works only on old Ubuntu (18), no longer available in Github runners
# Test 3.8, as that's the first which has XML parser updated, more tests will pass
# Test latest, to make sure the script works on current version of Python
# No need to test any python version on multiple Ubuntu versions, the Ubuntu version is
# only to provide best matching environment for the Python.
exclude:
- os: ubuntu-latest
python-version: "3.8"
- os: ubuntu-20.04
python-version: "3.10"
- os: ubuntu-20.04
python-version: "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: |
python -m pip install --upgrade pip
pip install flake8 pytest pytest-cov
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
- name: Lint with flake8
run: |
# stop the build if there are Python syntax errors or undefined names
flake8 ./pylabview --count --select=E9,F63,F7,F82 --show-source --statistics
# exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide
flake8 ./pylabview --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics
- name: Install package from repo
run: |
# depending on how it is run, pytest may be unable to locate the package if not installed
pip install -e .
- name: Download more RSRC files to test on
# Instead of the usual actions/download-artifact, we are downloading from Mega
uses: Difegue/action-megacmd@master
with:
args: get https://mega.nz/file/tM8ywDra#jAwqJN3SP25U6PDn0DQMvY1zBuTal5qYna9f22Z6Pi8 ${{ env.GITHUB_WORKSPACE }}
- name: Set ownership for downloaded files
# downloaded files are owned by root; unzip has no permission
run: |
sudo chown -R $(id -u):$(id -g) lv-std-libs-v1.zip
- name: Extract downloaded files
run: |
unzip -q lv-std-libs-v1.zip -d examples/lv-std-libs
- name: Test with pytest
run: |
pytest tests -o log_cli=true