-
Notifications
You must be signed in to change notification settings - Fork 2
78 lines (67 loc) · 2.26 KB
/
ci.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
name: CI
on:
push:
branches: [ "main" ]
pull_request:
branches: [ "main" ]
permissions:
contents: read
env:
POETRY_VERSION: 1.2.2
defaults:
run:
shell: bash
jobs:
lint-and-test:
name: 🎨🚦 Lint & Test
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: ["ubuntu-latest", "macos-latest", "windows-latest"]
python-version: ["3.7", "3.8", "3.9", "3.10"]
steps:
- name: ✨ Check out repository
uses: actions/checkout@v3
- name: Get pipx variables
id: pipx-vars
shell: bash
run: |
echo pipx-home=$PIPX_HOME >> $GITHUB_OUTPUT
echo pipx-bin-dir=$PIPX_BIN_DIR >> $GITHUB_OUTPUT
- if: ${{ runner.os == 'Windows' }}
name: Use GNU tar
shell: cmd
run: |
echo "Adding GNU tar to PATH"
echo C:\Program Files\Git\usr\bin>>"%GITHUB_PATH%"
- name: ⚙️ Cache Poetry ${{ env.POETRY_VERSION }}
id: cache-poetry
uses: actions/cache@v3
with:
path: |
${{ steps.pipx-vars.outputs.pipx-home }}
${{ steps.pipx-vars.outputs.pipx-bin-dir }}
key: poetry-${{ runner.os }}-poetry-${{ env.POETRY_VERSION }}-0
- name: ⚙️ Install Poetry ${{ env.POETRY_VERSION }}
run: |
pipx install poetry==${POETRY_VERSION}
poetry --version
- name: ⚙️ Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
cache: poetry
- name: 📦 Install dependencies
run: poetry install --no-interaction --no-root
- name: 🎨 isort
run: poetry run isort --check-only --verbose **/*.py
- name: 🎨 black
run: poetry run black --check .
- name: 🎨 pylint
run: poetry run pylint surblclient tests
# stop the build if there are Python syntax errors or undefined names
# poetry run flake8 . --extend-exclude .venv --count --select=E9,F63,F7,F82 --show-source --statistics
# exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide
# poetry run flake8 . --extend-exclude .venv --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics
- name: 🚦 Test with pytest
run: poetry run pytest --cov=surblclient