Debian Codegraph @

.github/workflows/poetry.yml

raw symbols SCIP
1 # For details of what checks are run for PRs please refer below
2 # docs: https://docs.github.com/en/actions/reference/workflow-syntax-for-github-actions
3 name: Python CI
4
5 on:
6 push:
7 branches: ["main"]
8 pull_request:
9 workflow_dispatch:
10 schedule:
11 # schedule weekly tests, since some dependencies are not intended to be pinned
12 # this means: at 23:42 on Fridays
13 - cron: '42 23 * * 5'
14
15 concurrency:
16 group: ${{ github.workflow }}-${{ github.ref }}
17 cancel-in-progress: true
18
19 env:
20 REPORTS_DIR: CI_reports
21 PYTHON_VERSION_DEFAULT: "3.13"
22 POETRY_VERSION: "1.8.1"
23 TESTS_REPORTS_ARTIFACT: tests-reports
24
25 jobs:
26 coding-standards:
27 name: Linting & CodingStandards
28 runs-on: ubuntu-latest
29 timeout-minutes: 10
30 steps:
31 - name: Checkout
32 # see https://github.com/actions/checkout
33 uses: actions/checkout@v4
34 - name: Setup Python Environment
35 # see https://github.com/actions/setup-python
36 uses: actions/setup-python@v5
37 with:
38 python-version: ${{ env.PYTHON_VERSION_DEFAULT }}
39 architecture: 'x64'
40 - name: Install poetry
41 # see https://github.com/marketplace/actions/setup-poetry
42 uses: Gr1N/setup-poetry@v9
43 with:
44 poetry-version: ${{ env.POETRY_VERSION }}
45 - name: Install dependencies
46 run: poetry install --no-root
47 - name: Run tox
48 run: poetry run tox run -e flake8 -s false
49
50 static-code-analysis:
51 name: StaticCodingAnalysis (py${{ matrix.python-version}}${{ matrix.toxenv-factors }})
52 runs-on: ${{ matrix.os }}
53 timeout-minutes: 10
54 strategy:
55 fail-fast: false
56 matrix:
57 include:
58 - # test with the locked dependencies
59 os: ubuntu-latest
60 python-version: '3.13'
61 toxenv-factors: '-current'
62 - # test with the lowest dependencies
63 os: ubuntu-latest
64 python-version: '3.8'
65 toxenv-factors: '-lowest'
66 steps:
67 - name: Checkout
68 # see https://github.com/actions/checkout
69 uses: actions/checkout@v4
70 - name: Setup Python Environment
71 # see https://github.com/actions/setup-python
72 uses: actions/setup-python@v5
73 with:
74 python-version: ${{ matrix.python-version }}
75 architecture: 'x64'
76 - name: Install poetry
77 # see https://github.com/marketplace/actions/setup-poetry
78 uses: Gr1N/setup-poetry@v9
79 with:
80 poetry-version: ${{ env.POETRY_VERSION }}
81 - name: Install dependencies
82 run: poetry install --no-root
83 - name: Run tox
84 run: poetry run tox run -e mypy${{ matrix.toxenv-factors }} -s false
85
86 build-and-test:
87 name: Test (${{ matrix.os }} py${{ matrix.python-version }})
88 runs-on: ${{ matrix.os }}
89 timeout-minutes: 15
90 strategy:
91 fail-fast: false
92 matrix:
93 os: ['ubuntu-latest', 'windows-latest', 'macos-latest']
94 python-version:
95 - "3.13" # highest supported
96 - "3.12"
97 - "3.11"
98 - "3.10"
99 - "3.9"
100 - "3.8" # lowest supported
101 steps:
102 - name: Disabled Git auto EOL CRLF transforms
103 run: |
104 git config --global core.autocrlf false
105 git config --global core.eol lf
106 - name: Checkout
107 # see https://github.com/actions/checkout
108 uses: actions/checkout@v4
109 - name: Create reports directory
110 run: mkdir ${{ env.REPORTS_DIR }}
111 - name: Setup Python Environment
112 # see https://github.com/actions/setup-python
113 uses: actions/setup-python@v5
114 with:
115 python-version: ${{ matrix.python-version }}
116 architecture: 'x64'
117 - name: Validate Python Environment
118 run: echo "import sys; print('Python %s on %s in %s' % (sys.version, sys.platform, sys.getdefaultencoding()))" | python
119 - name: Install poetry
120 # see https://github.com/marketplace/actions/setup-poetry
121 uses: Gr1N/setup-poetry@v9
122 with:
123 poetry-version: ${{ env.POETRY_VERSION }}
124 - name: Install dependencies
125 run: poetry install --no-root
126 - name: Ensure build successful
127 run: poetry build
128 - name: Run tox
129 run: poetry run tox run -e py${{ matrix.toxenv-factors }} -s false
130 - name: Generate coverage reports
131 if: ${{ failure() || success() }}
132 shell: bash
133 run: |
134 set -eux
135 poetry run coverage report -m
136 poetry run coverage xml -o ${{ env.REPORTS_DIR }}/coverage-${{ matrix.os }}-${{ matrix.python-version }}.xml &&
137 poetry run coverage html -d ${{ env.REPORTS_DIR }}
138 - name: Artifact reports
139 if: ${{ ! cancelled() }}
140 # see https://github.com/actions/upload-artifact
141 uses: actions/upload-artifact@v4
142 with:
143 name: ${{ env.TESTS_REPORTS_ARTIFACT }}-${{ matrix.os }}-py${{ matrix.python-version }}
144 path: ${{ env.REPORTS_DIR }}
145 if-no-files-found: error