-
Notifications
You must be signed in to change notification settings - Fork 0
230 lines (224 loc) · 7.11 KB
/
plugable.yaml
File metadata and controls
230 lines (224 loc) · 7.11 KB
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
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
name: Plugable CI/CD Pipeline
on:
push:
branches:
- master
tags:
- "[0-9]+.[0-9]+.[0-9]+"
pull_request:
branches:
- master
types:
- opened
- reopened
env:
BUILD_PYTHON_VERSION: "3.10"
jobs:
check:
name: Check if testing is required
outputs:
test: ${{ steps.test.outputs.any_changed }}
build: ${{ steps.build.outputs.any_changed }}
runs-on: ubuntu-latest
steps:
- name: Checkout source
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Check if test-impacting files modified
id: test
uses: tj-actions/changed-files@v29.0.2
with:
files: |
src
test
poetry.lock
.github
- name: Check if build-impacting files modified
id: build
uses: tj-actions/changed-files@v29.0.2
with:
files: |
src
.github
test:
name: "Run unit, formatting, and linting tests"
needs: check
if: needs.check.outputs.test == 'true'
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ['3.8', '3.9', '3.10']
steps:
- name: Checkout source
uses: actions/checkout@v3
- name: Install Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: Upgrade pip to latest
run: python3 -m pip install --upgrade pip
- name: Get pip cache dir
id: pip-cache
run: echo "::set-output name=dir::$(pip cache dir)"
- name: Setup pip cache
uses: actions/cache@v3
with:
path: ${{ steps.pip-cache.outputs.dir }}
key: pip-${{ runner.os }}-${{ matrix.python-version }} }}
- name: Setup Poetry cache
uses: actions/cache@v2
with:
path: ~/.cache/pypoetry
key: poetry-cache-${{ runner.os }}-${{ matrix.python-version }} }}
- name: Setup package cache
uses: actions/cache@v2
with:
path: ~/.local
key: poetry-${{ runner.os }}-${{ matrix.python-version }}-${{ hashFiles('**/poetry.lock') }}
- name: Run test cases & lint checks
run: make test
- name: Convert coverage data into LCOV format
run: poetry run coverage lcov
- name: Send code coverage results to Coveralls
uses: coverallsapp/github-action@v1.0.1
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
path-to-lcov: ./coverage.lcov
parallel: true
coverage:
name: "Finalise parallel coverage upload"
runs-on: ubuntu-latest
needs: test
steps:
- name: Let Coveralls know that all tests have finished
uses: coverallsapp/github-action@v1.0.1
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
parallel-finished: true
build:
name: "Build packages"
runs-on: ubuntu-latest
needs:
- check
- test
if: needs.check.outputs.build == 'true'
outputs:
version: ${{ steps.version.outputs.version }}
steps:
- name: Checkout source
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Install Python ${{ env.BUILD_PYTHON_VERSION }}
uses: actions/setup-python@v4
with:
python-version: ${{ env.BUILD_PYTHON_VERSION }}
- name: Upgrade pip to latest
run: python3 -m pip install --upgrade pip
- name: Get pip cache dir
id: pip-cache
run: echo "::set-output name=dir::$(pip cache dir)"
- name: Setup pip cache
uses: actions/cache@v3
with:
path: ${{ steps.pip-cache.outputs.dir }}
key: pip-${{ runner.os }}-${{ env.BUILD_PYTHON_VERSION }} }}
- name: Setup Poetry cache
uses: actions/cache@v2
with:
path: ~/.cache/pypoetry
key: poetry-cache-${{ runner.os }}-${{ env.BUILD_PYTHON_VERSION }} }}
- name: Setup package cache
uses: actions/cache@v2
with:
path: ~/.local
key: poetry-${{ runner.os }}-${{ env.BUILD_PYTHON_VERSION }}-${{ hashFiles('**/poetry.lock') }}
- name: Install Poetry
run: make install
- name: Determine package version
id: version
run: "echo ::set-output name=version::$(poetry run python3 ./scripts/determine_version.py $(git describe --tags --candidates=99 --exclude \"*-*\"))"
- name: Save version to file
run: echo "${{ steps.version.outputs.version }}" > VERSION
- name: Set version
run: poetry version ${{ steps.version.outputs.version }}
- name: Build packages
run: make build
- name: Upload package artifacts
uses: actions/upload-artifact@v3
with:
name: dist-pkgs
path: dist/
- name: Upload license
uses: actions/upload-artifact@v3
with:
name: license-file
path: LICENSE
prerelease:
name: "Release new candidate version"
runs-on: "ubuntu-latest"
if: github.event_name == 'push' && github.ref == 'refs/heads/master'
needs: build
steps:
- name: Download license file
uses: actions/download-artifact@v3
with:
name: license-file
- name: Download built packages
uses: actions/download-artifact@v3
with:
name: dist-pkgs
- name: List out directory
run: ls -lah ./
- uses: "marvinpinto/action-automatic-releases@v1.2.1"
with:
repo_token: "${{ secrets.GITHUB_TOKEN }}"
automatic_release_tag: "${{ needs.build.outputs.version }}"
prerelease: true
title: "Prerelease Build: ${{ needs.build.outputs.version }}"
files: |
LICENSE
plugable-*
release:
name: "Release new version"
runs-on: "ubuntu-latest"
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags')
needs: build
steps:
- name: Download license file
uses: actions/download-artifact@v3
with:
name: license-file
- name: Download built packages
uses: actions/download-artifact@v3
with:
name: dist-pkgs
- uses: "marvinpinto/action-automatic-releases@v1.2.1"
with:
repo_token: "${{ secrets.GITHUB_TOKEN }}"
automatic_release_tag: "${{ needs.build.outputs.version }}"
prerelease: false
title: "Release Build: ${{ needs.build.outputs.version }}"
files: |
LICENSE
plugable-*
publish:
name: "Publish new release to PyPI"
runs-on: ubuntu-latest
needs: release
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags')
steps:
- name: Download built packages
uses: actions/download-artifact@v3
with:
name: dist-pkgs
- name: Make dist directory
run: mkdir ./dist
- name: Move packages into dist directory
run: mv ./plugable-* ./dist
- name: Publish packages to PyPI
uses: pypa/gh-action-pypi-publish@release/v1.5
with:
password: ${{ secrets.PYPI_API_TOKEN }}
skip_existing: true