-
Notifications
You must be signed in to change notification settings - Fork 11
102 lines (98 loc) · 3.04 KB
/
main.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
# This GitHub Actions workflow contains four jobs:
# -- First, Lint Code uses the latest Ubuntu image and Python 3.9 to check
# the code for defects, using the Poetry lint task.
# -- Second, Lint Markdown uses the latest Ubuntu image and markdownlint to
# check markdown files for defects.
# -- Third, Check Spelling uses the latest Ubuntu image and cspell to check for spelling
# defects in the markdown.
# -- Fourth, Test uses a strategy matrix to test the code with different operating
# systems and Python versions and determine code coverage, using the Poetry test task.
name: Lint and Test
on: [push, pull_request]
jobs:
code:
name: Lint Code
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v2
- name: Setup Python 3.7
uses: actions/setup-python@v2
id: setup-python
with:
python-version: 3.7
- name: Install Poetry
uses: Gr1N/setup-poetry@v8
with:
poetry-version: 1.5.0
- name: Setup Poetry
run: |
poetry --version
poetry config virtualenvs.create true
poetry config virtualenvs.in-project true
poetry env info
- name: Install dependencies
run: poetry install --no-interaction --no-ansi
- name: Lint code
run: poetry run task lint
markdown:
name: Lint Markdown
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Run markdownlint
uses: DavidAnson/markdownlint-cli2-action@v4
spelling:
name: Check Spelling
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Run cspell
uses: zwaldowski/cspell-action@v1
with:
paths: "**/*.md"
config: .github/cspell.json
test:
name: Test
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest]
python-version: ["3.7", "3.10"]
include:
- os: macos-latest
python-version: "3.9"
- os: windows-latest
python-version: "3.8"
env:
OS: ${{ matrix.os }}
PYTHON: ${{ matrix.python-version }}
steps:
- name: Checkout repository
uses: actions/checkout@v2
- name: Setup Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}
- name: Install Poetry
uses: Gr1N/setup-poetry@v8
with:
poetry-version: 1.5.0
- name: Setup Poetry
run: |
poetry --version
poetry config virtualenvs.create true
poetry config virtualenvs.in-project true
poetry env info
- name: Install dependencies
run: poetry install --no-interaction --no-ansi
- name: Execute tests
if: matrix.os != 'windows-latest'
run: poetry run task test