-
Notifications
You must be signed in to change notification settings - Fork 483
103 lines (87 loc) · 2.71 KB
/
basic_test.yaml
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
# Copyright (c) 2021-2022 Chris Reed
# pyocd workflow for:
# - checking code with flake8
# - running unit tests
# - run test/import_all.py script
# - build source distro and wheel, check with twine
name: basic test
# Don't run for changes that only affect the docs directory.
on:
push:
paths-ignore:
- 'docs/**'
pull_request:
paths-ignore:
- 'docs/**'
jobs:
build:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os:
- ubuntu-latest
- macos-latest
- windows-latest
python-version:
- "3.7"
- "3.8"
- "3.9"
- "3.10"
- "3.11"
exclude:
- os: macos-latest
python-version: "3.7"
steps:
# Only check out HEAD. We don't need the full history.
- uses: actions/checkout@v3
with:
fetch-depth: 1
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
# This requires pip 20.1+. As of 28 Feb 2021 this condition is met for all supported
# Python versions on all OSes.
- name: Get pip cache dir
id: pip-cache
run: |
echo "::set-output name=dir::$(pip cache dir)"
- name: Setup pip cache
uses: actions/cache@v3
with:
path: ${{ steps.pip-cache.outputs.dir }}
key: ${{ runner.os }}-pip-${{ hashFiles('**/setup.cfg') }}
restore-keys: |
${{ runner.os }}-pip-
- name: Install dependencies
run: |
python -m pip install --upgrade setuptools pip wheel build twine
pip install -e .[test]
- name: Setup flake8 annotations
# This commit is v1.1. Using exact commit for security.
uses: rbialon/flake8-annotations@48819b39d57c621b5a64a1cdce40a5caa6a43b89
# Stop the build if there are Python syntax errors or undefined names.
- name: Lint with flake8
run: |
flake8 pyocd test --count --select=E9,F63,F7,F82 --show-source --statistics
- name: Test with pytest
run: |
pytest --junitxml=test-results-${{ matrix.os }}-${{ matrix.python-version }}.xml --cov=pyocd
- name: Test importing all modules
run: |
python test/import_all.py
- name: Test build
run: |
python -mbuild
- name: Check packages
run: |
twine check dist/*
- name: Upload pytest test results
uses: actions/upload-artifact@v3
with:
name: pytest-results-${{ matrix.python-version }}
path: |
test-results-${{ matrix.os }}-${{ matrix.python-version }}.xml
.coverage*
# Use always() to always run this step to publish test results when there are test failures
if: ${{ always() }}