-
-
Notifications
You must be signed in to change notification settings - Fork 63
113 lines (106 loc) · 3.38 KB
/
python-lint-tests.yml
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
113
name: CI
on:
push:
branches:
- master
- release/*
pull_request:
branches:
- master
- release/*
jobs:
# ----------------------------------------
lint-tests:
strategy:
fail-fast: true
matrix:
python-version: [3.9, '3.10', '3.11']
os: [ubuntu-latest, macos-latest, windows-latest]
defaults:
run:
shell: bash
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v3
- name: Install poetry
run: pipx install poetry!=1.4.1
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
cache: 'poetry'
- name: Install project
run: poetry install -E all
- name: Lint and static analysis
if: matrix.os == 'ubuntu-latest' && matrix.python-version == '3.11' # no need to run that 9x
run: |
poetry run ruff check --show-source vpype vpype_cli vpype_viewer tests
poetry run black --check --diff vpype vpype_cli vpype_viewer tests
poetry run mypy
# needed for tests to work on ubuntu (libEGL.so.1)
- name: Install EGL mesa
if: matrix.os == 'ubuntu-latest'
run: |
sudo apt-get update -y -qq
sudo apt-get install -y -qq libegl1-mesa libegl1-mesa-dev
# PYTEST STRATEGY
# macOS is the only runner who has working ModernGL behaviour
# macOS + 3.11 is used for code coverage
- name: Pytest (code coverage)
run: |
poetry run pytest --cov=./ --cov-report=xml
if: matrix.os == 'macos-latest' && matrix.python-version == '3.11'
- name: Pytest
run: |
poetry run pytest
if: matrix.os == 'macos-latest' && matrix.python-version != '3.11'
- name: Pytest (no image similarity check)
run: |
poetry run pytest --skip-image-similarity
if: matrix.os != 'macos-latest'
- name: Upload comparison test results
if: failure()
uses: actions/upload-artifact@v3
with:
name: test_report_${{ runner.os }}_${{ matrix.python-version }}
path: |
test_report_img_sim/**/*
test_report_reference_svg/**/*
if-no-files-found: ignore
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v3
with:
token: ${{ secrets.CODECOV_TOKEN }}
file: ./coverage.xml
if: matrix.os == 'macos-latest' && matrix.python-version == '3.11'
# ----------------------------------------
windows-installer:
defaults:
run:
shell: bash
runs-on: windows-latest
steps:
- uses: actions/checkout@v3
- name: Install poetry
run: pipx install poetry!=1.4.1
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: '3.11'
cache: 'poetry'
- name: Install project
run: poetry install -E all
- name: Run PyInstaller
run: |
VERSION="`poetry version --short`-${GITHUB_SHA}"
echo "version=${VERSION}" >> $GITHUB_ENV
poetry run ${GITHUB_WORKSPACE}\\scripts\\build.bat
- name: Create NSIS installer
uses: joncloud/makensis-action@v4
with:
script-file: scripts\\installer_win.nsi
arguments: /V4 /DVERSION=${{ env.version }}
- uses: actions/upload-artifact@v3
with:
name: vpype-${{ env.version }}-setup.exe
path: dist/vpype-${{ env.version }}-setup.exe