-
Notifications
You must be signed in to change notification settings - Fork 950
151 lines (131 loc) · 3.7 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
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
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
name: CI
on:
push:
branches:
- dev
- master
- wait_next_API
tags:
- v*
pull_request:
branches:
- dev
- wait_next_api
types: [opened, synchronize, reopened, ready_for_review]
schedule:
# Sunday at 02:10 UTC.
- cron: '10 2 * * 0'
workflow_dispatch:
jobs:
faildraft:
name: fail draft
if: github.event.pull_request.draft == true
runs-on: ubuntu-latest
steps:
- name: fail draft
run: |
exit 1
testing:
name: ${{ matrix.os }} - ${{ matrix.python }}
if: github.event.pull_request.draft == false
runs-on: ${{ matrix.os }}
timeout-minutes: 20
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
python: ['3.9', '3.10', '3.11', '3.12', "3.13.0"]
include:
- python: '3.9'
run_lint: true
- python: '3.13.0'
run_doc: true
run_lint: true
- os: macos-latest
run_doc: false
run_lint: false
- os: windows-latest
run_doc: false
run_lint: false
steps:
- name: Checkout repo from github
uses: actions/checkout@v4.1.1
- name: Set up Python ${{ matrix.python }}
uses: actions/setup-python@v5.1.0
with:
python-version: ${{ matrix.python }}
- name: Set venv path (NON Windows)
if: matrix.os != 'windows-latest'
run: |
echo "VIRTUAL_ENV=${{ github.workspace }}/venv" >> $GITHUB_ENV
echo ${{ github.workspace }}/venv/bin >> $GITHUB_PATH
- name: Set venv path (Windows)
if: matrix.os == 'windows-latest'
run: |
echo "VIRTUAL_ENV=${{ github.workspace }}\\venv" >> $Env:GITHUB_ENV
echo "${{ github.workspace }}\\venv\\Scripts" >> $Env:GITHUB_PATH
- name: Restore base Python virtual environment
id: cache-venv
uses: actions/cache@v4.0.2
with:
path: ${{ env.VIRTUAL_ENV }}
key: >-
${{ runner.os }}-${{ matrix.python }}-venv-${{
hashFiles('pyproject.toml') }}
- name: Create venv (NEW CACHE)
if: steps.cache-venv.outputs.cache-hit != 'true'
run: |
python -m venv ${{ env.VIRTUAL_ENV }}
python -m pip install --upgrade pip
pip install -e ".[all]"
- name: codespell
if: matrix.run_doc == true
run: |
codespell
- name: dcoumentation
if: matrix.run_doc == true
run: |
cd doc; ./build_html
- name: pylint
if: matrix.run_lint == true
run: |
pylint --recursive=y examples pymodbus test
- name: mypy
if: matrix.run_lint == true
run: |
mypy pymodbus examples
- name: ruff
if: matrix.run_lint == true
run: |
ruff check .
- name: pytest
if: ${{ (matrix.os != 'ubuntu-latest') || (matrix.python != '3.13') }}
run: |
env
pytest
- name: pytest coverage
if: ${{ (matrix.os == 'ubuntu-latest') && (matrix.python == '3.13') }}
run: |
env
pytest --cov
analyze:
name: Analyze Python
if: github.event.pull_request.draft == false
runs-on: ubuntu-22.04
timeout-minutes: 10
steps:
- uses: actions/checkout@v4.1.1
- uses: github/codeql-action/init@v3
with:
languages: python
- uses: github/codeql-action/autobuild@v3
- uses: github/codeql-action/analyze@v3
ci_complete:
name: ci_complete
runs-on: ubuntu-latest
needs:
- analyze
- testing
timeout-minutes: 1
steps:
- run: echo 'finish job'