-
Notifications
You must be signed in to change notification settings - Fork 26
193 lines (158 loc) · 4.53 KB
/
build.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
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
name: CI
on:
push:
branches:
- master
tags:
- v*
pull_request:
paths-ignore:
- '*.md'
- '**/*.md'
- 'docs/**.*'
jobs:
build:
strategy:
fail-fast: false
matrix:
python-version: ['3.6', '3.7', '3.8', '3.9', '3.10', '3.11', '3.12']
runs-on: ubuntu-latest
container:
image: python:${{ matrix.python-version }}
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Install
run: pip install -e .[dev]
- name: Test & Coverage
run: pytest -m 'unit or integration' --cov=ldfparser --cov-report xml
- name: Run Examples
if: always()
run: |
python ./examples/communication.py
python ./examples/ldf2json.py
python ./examples/read_comments.py
- name: Package
if: always()
run: python setup.py sdist bdist_wheel
- name: Upload coverage results
uses: codecov/codecov-action@v3
if: always()
with:
token: ${{ secrets.CODECOV_TOKEN }}
directory: ./
flags: ${{ matrix.python-version }}
name: Python-${{ matrix.python-version }}
fail_ci_if_error: false
flake8:
runs-on: ubuntu-latest
container:
image: python:3.6
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup flake8 annotations
uses: rbialon/flake8-annotations@v1
- name: Install
run: pip install -e .[dev]
- name: Lint using Flake8
run: flake8 --count --show-source --statistics
pylint:
runs-on: ubuntu-latest
container:
image: python:3.6
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Install
run: pip install -e .[dev]
- name: Lint using Pylint
run: pylint ldfparser --fail-under=8.5
pylint-tests:
runs-on: ubuntu-latest
container:
image: python:3.6
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Install
run: pip install -e .[dev]
- name: Lint using Pylint
run: pylint tests --disable="C0114,C0116,R0201" --fail-under=8.0
snapshot-test:
if: github.event_name == 'pull_request'
runs-on: ubuntu-latest
container:
image: python:3.6
steps:
- name: Checkout (current)
uses: actions/checkout@v4
with:
path: current
- name: Checkout (base)
uses: actions/checkout@v3
with:
path: base
ref: ${{ github.event.pull_request.base.ref }}
- name: Setup
run: pip install pytest
- name: Install base
working-directory: base
run: pip install -e .[dev]
- name: Generate snapshot data
working-directory: base
run: python tests/snapshot_data.py
- name: Move snapshot data
run: |
mkdir current/tests/snapshot/
mv base/tests/snapshot/* current/tests/snapshot/
- name: Install
working-directory: current
run: pip install -e .[dev]
- name: Snapshot test
working-directory: current
run: pytest -m 'snapshot'
performance-test:
if: github.event_name == 'pull_request'
runs-on: ubuntu-latest
container:
image: python:3.6
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Install
run: pip install -e .[dev]
- name: Run performance tests
run: pytest -m 'performance' --benchmark-json output.json
release:
if: startsWith(github.ref, 'refs/tags/v')
runs-on: ubuntu-latest
container:
image: python:3.6
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Install
run: pip install -e .[dev]
- name: Package
run: python setup.py sdist bdist_wheel
- name: Publish to PyPi
env:
TWINE_USERNAME: __token__
TWINE_PASSWORD: ${{ secrets.PYPI_TOKEN }}
run: twine upload dist/*
- name: Get version from tag
id: tag_name
run: echo "::set-output name=current_version::${GITHUB_REF#refs/tags/v}"
- name: Read Changelog
id: changelog
uses: mindsers/changelog-reader-action@v2
with:
validation_level: warn
version: ${{ steps.tag_name.outputs.current_version }}
path: CHANGELOG.md
- name: Create Release
uses: softprops/action-gh-release@v1
with:
name: Release ${{ steps.changelog.outputs.version }}
body: ${{ steps.changelog.outputs.changes }}