-
Notifications
You must be signed in to change notification settings - Fork 1
87 lines (70 loc) · 2.17 KB
/
python-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
79
80
81
82
83
84
85
86
87
# This workflow will for a variety of Python versions
# - install the code base
# - lint the code base
# - test the code base
# - upload the test coverage to codecov
#
# It will also
# - build the package
# - check the package
#
# For more information see: https://help.github.com/en/actions/language-and-framework-guides/using-python-with-github-actions#publishing-to-package-registries
name: CI using pip
on: [push, pull_request]
jobs:
Code_Consistency:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: chartboost/ruff-action@v1
- name: Suggestion to fix issues
if: ${{ failure() }}
run: |
echo "::notice::In project root run 'python.exe -m ruff . --fix' and commit changes to fix issues."
exit 1
Code_Testing:
strategy:
max-parallel: 4
matrix:
python-version: ['3.9', '3.10', '3.11', '3.12']
os: [ubuntu-latest, macos-latest, windows-latest]
runs-on: ${{ matrix.os }}
if: "!contains(github.event.head_commit.message, '[ci skip]')"
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Upgrade pip
run: |
python -m pip install --upgrade pip
- name: Install dependencies
run: pip install -e '.[dev]'
- name: Test with tox
run: |
pip install tox tox-gh-actions coverage
tox
- name: Upload coverage
uses: codecov/codecov-action@v3
with:
name: Pytest coverage
env_vars: OS,PYTHON,GITHUB_ACTIONS,GITHUB_ACTION,GITHUB_REF,GITHUB_REPOSITORY,GITHUB_HEAD_REF,GITHUB_RUN_ID,GITHUB_SHA,COVERAGE_FILE
env:
OS: ${{ matrix.os }}
PYTHON: ${{ matrix.python-version }}
Package_Testing:
runs-on: ubuntu-latest
if: "!contains(github.event.head_commit.message, '[ci skip]')"
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: 3.9
- name: Install dependencies and build
run: |
pip install -e '.[dev]'
python -m build
- name: Check Build
run: |
cd ./dist
pytest ../