-
Notifications
You must be signed in to change notification settings - Fork 3
110 lines (93 loc) · 3.3 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
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
name: Python CI
on:
workflow_dispatch:
push:
branches: [main]
pull_request:
schedule:
- cron: "0 15 * * 0"
permissions: read-all
jobs:
build:
runs-on: ubuntu-latest
permissions: # for EnricoMi/publish-unit-test-result-action
checks: write
pull-requests: write # for comment_mode
contents: read # only for private repository
issues: read # only for private repository
strategy:
matrix:
python-version: ["3.10"]
poetry-version: ["1.2.2"]
steps:
- name: Checkout repository
uses: actions/checkout@f43a0e5ff2bd294095638e18286ca9a3d1956744
- name: Setup python environment
uses: ./.github/actions/python-setup
with:
python-version: ${{ matrix.python-version }}
poetry-version: ${{ matrix.poetry-version }}
- name: Lint python code by flake8
continue-on-error: true
run: poetry run flake8 src/ tests/ --format junit-xml --output-file report.xml
- name: Lint python code by flake8
continue-on-error: true
run: poetry run flake8 src/ tests/ --format html --htmldir=flake8
- name: Publish flake8 report to PR
uses: EnricoMi/publish-unit-test-result-action@8885e273a4343cd7b48eaa72428dea0c3067ea98
with:
check_name: flake8 results
junit_files: report.xml
- name: Upload flake8 report to artifact
uses: actions/upload-artifact@a8a3f3ad30e3422c9c7b888a15615d19a852ae32
with:
name: flake8-report
path: flake8/
- name: Test python code by pytest
continue-on-error: true
run: poetry run pytest
- name: Publish pytest report to PR
uses: EnricoMi/publish-unit-test-result-action@8885e273a4343cd7b48eaa72428dea0c3067ea98
with:
check_name: pytest results
junit_files: report.xml
- name: Upload pytest coverage report to artifact
uses: actions/upload-artifact@a8a3f3ad30e3422c9c7b888a15615d19a852ae32
with:
name: pytest-cov-report
path: htmlcov/
- name: Upload pytest report to artifact
uses: actions/upload-artifact@a8a3f3ad30e3422c9c7b888a15615d19a852ae32
with:
name: pytest-report
path: report.html
- name: Upload coverage to codecov
uses: codecov/codecov-action@ab904c41d6ece82784817410c45d8b8c02684457
with:
token: ${{ secrets.CODECOV_TOKEN }}
env_vars: OS,PYTHON
fail_ci_if_error: true
files: ./coverage.xml
flags: unittests
verbose: true
sast-codeql:
runs-on: ubuntu-latest
permissions:
actions: read
contents: read
security-events: write
strategy:
fail-fast: false
matrix:
language: ["python"]
steps:
- name: Checkout repository
uses: actions/checkout@f43a0e5ff2bd294095638e18286ca9a3d1956744
- name: Initialize CodeQL
uses: github/codeql-action/init@cdcdbb579706841c47f7063dda365e292e5cad7a
with:
languages: ${{ matrix.language }}
- name: Build automatically
uses: github/codeql-action/autobuild@cdcdbb579706841c47f7063dda365e292e5cad7a
- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@cdcdbb579706841c47f7063dda365e292e5cad7a