-
Notifications
You must be signed in to change notification settings - Fork 12
157 lines (135 loc) · 4.79 KB
/
Copy pathcode.yml
File metadata and controls
157 lines (135 loc) · 4.79 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
name: Code CI
on:
push:
branches:
- master
- main
tags:
- "*"
pull_request:
schedule:
# Run every Monday at 8am
- cron: '0 8 * * MON'
jobs:
lint:
runs-on: "ubuntu-latest"
steps:
- name: Checkout Source
uses: actions/checkout@v2
- name: Install Python
uses: actions/setup-python@v2
with:
python-version: "3.7"
- name: Install Python Dependencies
run: pip install flake8
- name: Lint
run: flake8
build:
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]
python: [cp36, cp37, cp38, cp39]
include:
# Put coverage and results files in the project directory for mac
- os: macos-latest
cov_file: "{project}/dist/coverage.xml"
results_file: "{project}/dist/pytest-results.xml"
# And for windows
- os: windows-latest
cov_file: "{project}/dist/coverage.xml"
results_file: "{project}/dist/pytest-results.xml"
# But put coverage and results files in the output dir mounted in docker for linux
- os: ubuntu-latest
cov_file: /output/coverage.xml
results_file: /output/pytest-results.xml
# Build an sdist on linux so it has the right line endings
- os: ubuntu-latest
sdist: true
name: build/${{ matrix.os }}/${{ matrix.python }}
runs-on: ${{ matrix.os }}
steps:
- name: Checkout Source
uses: actions/checkout@v2
with:
# require history to get back to last tag for version number of branches
fetch-depth: 0
submodules: true
- name: Install Python
uses: actions/setup-python@v2
with:
python-version: "3.7"
- name: Install Python Dependencies
# Pin cibuildwheel due to https://github.com/pypa/cibuildwheel/issues/962
run: pip install build cibuildwheel>=2.3.1
- name: Build Sdist
if: matrix.sdist
run: python -m build --sdist .
- name: Build Wheel
run: cibuildwheel --output-dir dist
env:
# Force old behaviour of pip - see https://github.com/pypa/cibuildwheel/issues/962
CIBW_ENVIRONMENT: PIP_USE_DEPRECATED=out-of-tree-build
CIBW_BUILD: ${{ matrix.python }}*64
CIBW_TEST_EXTRAS: dev
CIBW_TEST_COMMAND: pytest {project}/tests --cov-report xml:${{ matrix.cov_file }} --junit-xml=${{ matrix.results_file }}
# Disable auditwheel as it isn't compatible with setuptools_dso approach
# https://github.com/mdavidsaver/setuptools_dso/issues/17
CIBW_REPAIR_WHEEL_COMMAND: ""
CIBW_MANYLINUX_X86_64_IMAGE: manylinux2014
CIBW_ENVIRONMENT_LINUX: SETUPTOOLS_DSO_PLAT_NAME=manylinux2014_x86_64
CIBW_SKIP: "*-musllinux*" # epicscorelibs doesn't build on musllinux platforms
- name: Upload Wheel and Sdist
uses: actions/upload-artifact@v2
with:
name: dist
path: dist/softioc*
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v2
with:
name: ${{ matrix.os }}/${{ matrix.python }}
directory: dist
- name: Upload Unit Test Results
if: always()
uses: actions/upload-artifact@v2
with:
name: Unit Test Results (${{ matrix.os }}-${{ matrix.python }})
path: dist/pytest-results.xml
publish-test-results:
name: Publish Unit Tests Results
needs: build
runs-on: ubuntu-latest
if: always()
steps:
- name: Download Artifacts
uses: actions/download-artifact@v2
with:
path: artifacts
- name: Publish Unit Test Results
uses: EnricoMi/publish-unit-test-result-action@v1
with:
files: artifacts/**/*.xml
release:
needs: [build]
runs-on: ubuntu-latest
# upload to PyPI and make a release on every tag
if: github.event_name == 'push' && startsWith(github.event.ref, 'refs/tags')
steps:
- uses: actions/download-artifact@v2
with:
name: dist
path: dist
- name: Github Release
# We pin to the SHA, not the tag, for security reasons.
# https://docs.github.com/en/actions/learn-github-actions/security-hardening-for-github-actions#using-third-party-actions
uses: softprops/action-gh-release@2d72d869af3bf23602f9593a1e3fd739b80ac1eb # v0.1.12
with:
files: dist/*
body: See [Changelog](CHANGELOG.rst) for more details
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Publish to PyPI
env:
TWINE_USERNAME: __token__
TWINE_PASSWORD: ${{ secrets.pypi_token }}
run: pipx run twine upload dist/*