-
Notifications
You must be signed in to change notification settings - Fork 1
159 lines (132 loc) · 4.11 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
152
153
154
155
156
157
158
159
name: Continuos Integration
on:
push:
branches:
- main
paths:
- 'docs/changelog.rst'
pull_request:
branches:
- main
schedule:
- cron: '0 0 * * 1' # Every Monday at 00:00 UTC
jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: [
"3.7",
"3.8",
"3.9",
"3.10",
"3.11",
"pypy-3.8",
"pypy-3.9"
]
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
cache: "pip"
cache-dependency-path: "requirements/dev.txt"
- name: Install Python dependencies
run: pip install -r requirements/dev.txt
- name: Python test and coverage
run: pytest
- name: Save html coverage report
if: ${{ always() && matrix.python-version == '3.11' }}
uses: actions/upload-artifact@v3
with:
name: html-coverage-report
path: tests/coverage-results/htmlcov/
- name: Save xml coverage report
if: ${{ matrix.python-version == '3.11' }}
uses: actions/upload-artifact@v3
with:
name: xml-coverage-report
path: tests/coverage-results/coverage.xml
- name: Python type check
run: mypy .
- name: Python linter
run: |
prospector
prospector --profile tests/.prospector.yaml tests
- name: Code format
run: |
isort --check --diff .
black --check --diff .
- name: Security vulnerability scan
run: |
bandit --recursive cly
safety check --file requirements/dev.txt --full-report
- name: Test documentation
run: |
sphinx-apidoc --module-first --private --output-dir docs/modules cly
sphinx-build -W -T -v -n -a docs public
- name: Usage example
run: |
tests/batcomputer.py
tests/batcomputer.py id --help
tests/batcomputer.py ls --help
docker-check:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Build Docker image
run: docker build --tag cly - < docker/Dockerfile
- name: Dockerfile linter
uses: hadolint/hadolint-action@v2.0.0
with:
dockerfile: docker/Dockerfile
- name: Docker image security vulnerability scan
continue-on-error: true
uses: snyk/actions/docker@master
env:
SNYK_TOKEN: ${{ secrets.SNYK_TOKEN }}
with:
image: cly
args: --severity-threshold=medium --file=docker/Dockerfile
project-check:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
ref: ${{ github.event.pull_request.head.sha }} # Checkout pull request HEAD commit instead of merge commit
fetch-depth: 0
- uses: actions/setup-python@v4
with:
python-version: "3.11"
cache: "pip"
cache-dependency-path: "requirements/*.txt"
- name: Install Python dependencies
run: pip install -r requirements/dev.txt
# TODO study how to check commit messages with emojis
#- name: Check commit messages
# run: gitlint --commits f9cb55e198f55faa8f06998985a88c785247c00c..
- name: Code format
run: ec -verbose
- name: Check version information
run: |
pip install -e .
./scripts/versioning.py
sonarcloud:
needs: build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Use xml coverage report
uses: actions/download-artifact@v3
with:
name: xml-coverage-report
path: tests/coverage-results/
- name: Change dir name for sonar
run: sed -i 's*home/runner/work/cly/cly*github/workspace*g' tests/coverage-results/coverage.xml
- name: SonarCloud Scan
uses: SonarSource/sonarcloud-github-action@master
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}