chore: verify PAT permission changes / dev release pipeline is fixed #187
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Test and Lint | |
on: | |
pull_request: | |
paths: | |
- 'src/**.py' | |
- 'tests/**.py' | |
- 'conftest.py' | |
jobs: | |
build: | |
runs-on: ${{ matrix.os }} | |
strategy: | |
matrix: | |
os: [ubuntu-latest, windows-latest] | |
python-version: ["3.9", "3.10", "3.11", "3.12"] | |
env: | |
COVERAGE_TOTAL: 100 | |
PYLINT_PASS_SCORE: "10.00" | |
steps: | |
- name: Checkout repo | |
uses: actions/checkout@v2 | |
- name: Set up Python | |
uses: actions/setup-python@main | |
with: | |
python-version: ${{ matrix.python-version }} | |
cache: 'pip' | |
- uses: actions/cache@v2 | |
with: | |
path: ${{ env.pythonLocation }} | |
key: ${{ env.pythonLocation }}-${{ hashFiles('pyproject.toml') }} | |
- name: Install dependencies | |
run: | | |
python -m pip install --upgrade pip | |
pip install --editable ".[dev]" | |
- name: Run pylint on Ubuntu | |
if: matrix.os == 'ubuntu-latest' | |
run: | | |
PYLINT=`pylint --verbose $(git ls-files '*.py')` | |
PASS=`echo $PYLINT | grep "Your code has been rated at ${{ env.PYLINT_PASS_SCORE}}/10"` | |
if [ -z $PASS ]; then | |
echo $PYLINT | |
exit 1; | |
fi | |
- name: Run pylint on Windows | |
# TODO(a-rich): Pylint on Windows with Python 3.12 raises "'zipimporter' object has no attribute 'find_module'" | |
# AttributeError: 'zipimporter' object has no attribute 'find_module'. Did you mean: 'load_module'? | |
# File "C:\hostedtoolcache\windows\Python\3.12.1\x64\Lib\site-packages\pylint\lint\pylinter.py", line 888, in get_ast | |
if: matrix.os == 'windows-latest' && matrix.python-version != '3.12' | |
run: | | |
$PYLINT=pylint --verbose (Get-ChildItem -Recurse -Filter *.py | ForEach-Object { $_.FullName }) | |
$PASS=$PYLINT -match "Your code has been rated at $env:PYLINT_PASS_SCORE/10" | |
Write-Output $PYLINT | |
- name: Run pytest with coverage on Ubuntu | |
if: matrix.os == 'ubuntu-latest' | |
run: | | |
PYTEST=`pytest --cov --cov-report term-missing --show-capture=no` | |
PASS=`echo $PYTEST | grep -E "TOTAL\s+[0-9]+\s+0+\s+${{ env.COVERAGE_TOTAL }}%"` | |
if [ -z $PASS ]; then | |
echo $PYTEST | |
exit 1 | |
fi | |
- name: Run pytest with coverage on Windows | |
if: matrix.os == 'windows-latest' | |
run: | | |
$PYTEST=pytest --cov --cov-report term-missing --show-capture=no | |
$PASS=$PYTEST -match "TOTAL\s+\d+\s+0+\s+$env:COVERAGE_TOTAL%" | |
if (-not $PASS) { | |
Write-Output $PYTEST | |
exit 1 | |
} |