|
1 | 1 | name: CI
|
2 |
| - |
3 | 2 | on:
|
4 | 3 | push:
|
5 | 4 | branches:
|
6 | 5 | - dev
|
7 | 6 | - master
|
| 7 | + - dev_* |
8 | 8 | tags:
|
9 | 9 | - v*
|
10 | 10 | pull_request:
|
|
15 | 15 | - cron: '10 2 * * 0'
|
16 | 16 | workflow_dispatch:
|
17 | 17 |
|
18 |
| - |
19 | 18 | jobs:
|
20 |
| - linters: |
21 |
| - name: Linters - ${{ matrix.os.on }} - ${{ matrix.python.version }} |
22 |
| - runs-on: ${{ matrix.os.on }} |
23 |
| - timeout-minutes: 10 |
24 |
| - strategy: |
25 |
| - fail-fast: false |
26 |
| - matrix: |
27 |
| - os: |
28 |
| - - on: ubuntu-latest |
29 |
| - # - on: macos-latest |
30 |
| - # - on: windows-latest |
31 |
| - python: |
32 |
| - - version: '3.8' |
33 |
| - - version: '3.9' |
34 |
| - - version: '3.10' |
35 |
| - - version: '3.11' |
36 |
| - steps: |
37 |
| - - uses: actions/checkout@v3 |
38 |
| - - uses: actions/setup-python@v4 |
39 |
| - with: |
40 |
| - python-version: ${{ matrix.python.version }} |
41 |
| - cache: 'pip' |
42 |
| - - run: pip install -e ".[all]" |
43 |
| - - run: codespell |
44 |
| - - run: pylint --recursive=y examples pymodbus test |
45 |
| - - run: pre-commit run --all-files |
46 |
| - - run: cd doc; ./build_html |
47 |
| - - run: mypy pymodbus |
48 |
| - |
49 |
| - integreation_test: |
50 |
| - name: pytest - ${{ matrix.os.on }} - ${{ matrix.python.version }} |
51 |
| - runs-on: ${{ matrix.os.on }} |
| 19 | + testing: |
| 20 | + name: ${{ matrix.os }} - ${{ matrix.python }} |
| 21 | + runs-on: ${{ matrix.os }} |
52 | 22 | timeout-minutes: 20
|
53 | 23 | strategy:
|
54 | 24 | fail-fast: false
|
55 | 25 | matrix:
|
56 |
| - os: |
57 |
| - - on: ubuntu-latest |
58 |
| - - on: macos-latest |
59 |
| - - on: windows-latest |
60 |
| - python: |
61 |
| - - version: '3.8' |
62 |
| - - version: '3.9' |
63 |
| - - version: '3.10' |
64 |
| - - version: '3.11' |
| 26 | + os: [ubuntu-latest, macos-latest, windows-latest] |
| 27 | + python: ['3.8', '3.9', '3.10', '3.11', '3.12'] |
| 28 | + include: |
| 29 | + - python: '3.8' |
| 30 | + run_lint: true |
| 31 | + - python: '3.12' |
| 32 | + run_doc: true |
| 33 | + run_lint: true |
| 34 | + - os: macos-latest |
| 35 | + run_doc: false |
| 36 | + run_lint: false |
| 37 | + - os: windows-latest |
| 38 | + run_doc: false |
| 39 | + run_lint: false |
| 40 | + |
65 | 41 | steps:
|
66 |
| - - uses: actions/checkout@v3 |
67 |
| - - uses: actions/setup-python@v4 |
| 42 | + - name: Checkout repo from github |
| 43 | + uses: actions/checkout@v4.1.0 |
| 44 | + |
| 45 | + - name: Set up Python ${{ matrix.python }} |
| 46 | + uses: actions/setup-python@v4.7.1 |
68 | 47 | with:
|
69 |
| - python-version: ${{ matrix.python.version }} |
70 |
| - cache: 'pip' |
71 |
| - - run: pip install -e ".[all]" |
| 48 | + python-version: ${{ matrix.python }} |
| 49 | + |
| 50 | + - name: Set venv path (NON Windows) |
| 51 | + if: matrix.os != 'windows-latest' |
| 52 | + run: | |
| 53 | + echo "VIRTUAL_ENV=${{ github.workspace }}/venv" >> $GITHUB_ENV |
| 54 | + echo ${{ github.workspace }}/venv/bin >> $GITHUB_PATH |
72 | 55 |
|
73 |
| - - run: pytest -n0 -v --full-trace --timeout=1200 |
| 56 | + - name: Set venv path (Windows) |
| 57 | + if: matrix.os == 'windows-latest' |
| 58 | + run: | |
| 59 | + echo "VIRTUAL_ENV=${{ github.workspace }}\\venv" >> $Env:GITHUB_ENV |
| 60 | + echo "${{ github.workspace }}\\venv\\Scripts" >> $Env:GITHUB_PATH |
| 61 | +
|
| 62 | + - name: Restore base Python virtual environment |
| 63 | + id: cache-venv |
| 64 | + uses: actions/cache@v3.3.2 |
| 65 | + with: |
| 66 | + path: ${{ env.VIRTUAL_ENV }} |
| 67 | + key: >- |
| 68 | + ${{ runner.os }}-${{ matrix.python }}-venv-${{ |
| 69 | + hashFiles('pyproject.toml') }} |
| 70 | +
|
| 71 | + - name: Create venv (NEW CACHE) |
| 72 | + if: steps.cache-venv.outputs.cache-hit != 'true' |
| 73 | + run: | |
| 74 | + python -m venv ${{ env.VIRTUAL_ENV }} |
| 75 | + python -m pip install --upgrade pip |
| 76 | + pip install -e ".[all]" |
| 77 | +
|
| 78 | + - name: codespell |
| 79 | + if: matrix.run_doc == true |
| 80 | + run: | |
| 81 | + codespell |
| 82 | +
|
| 83 | + - name: dcoumentation |
| 84 | + if: matrix.run_doc == true |
| 85 | + run: | |
| 86 | + cd doc; ./build_html |
| 87 | +
|
| 88 | + - name: pylint |
| 89 | + if: matrix.run_lint == true |
| 90 | + run: | |
| 91 | + pylint --recursive=y examples pymodbus test |
| 92 | +
|
| 93 | + - name: mypy |
| 94 | + if: matrix.run_lint == true |
| 95 | + run: | |
| 96 | + mypy pymodbus |
| 97 | +
|
| 98 | + - name: ruff |
| 99 | + if: matrix.run_lint == true |
| 100 | + run: | |
| 101 | + ruff . |
| 102 | +
|
| 103 | + - name: pytest |
| 104 | + run: | |
| 105 | + env |
| 106 | + pytest -v --full-trace --timeout=1200 |
74 | 107 |
|
75 | 108 | analyze:
|
76 | 109 | name: Analyze Python
|
77 | 110 | runs-on: ubuntu-22.04
|
78 |
| - |
| 111 | + timeout-minutes: 10 |
79 | 112 | steps:
|
80 | 113 | - uses: actions/checkout@v3
|
| 114 | + |
81 | 115 | - uses: github/codeql-action/init@v2
|
82 | 116 | with:
|
83 | 117 | languages: python
|
| 118 | + |
84 | 119 | - uses: github/codeql-action/autobuild@v2
|
| 120 | + |
85 | 121 | - uses: github/codeql-action/analyze@v2
|
86 | 122 |
|
87 | 123 | ci_complete:
|
88 | 124 | name: ci_complete
|
89 | 125 | runs-on: ubuntu-latest
|
90 | 126 | needs:
|
91 |
| - - linters |
92 | 127 | - analyze
|
93 |
| - - integreation_test |
| 128 | + - testing |
94 | 129 | timeout-minutes: 1
|
95 | 130 | steps:
|
96 |
| - - name: Dummy |
97 |
| - run: ls |
| 131 | + - run: echo 'finish job' |
0 commit comments