-
Notifications
You must be signed in to change notification settings - Fork 10
137 lines (120 loc) · 4.01 KB
/
test_build_deploy.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
name: Test on all platforms
on: [push, pull_request]
jobs:
tests:
name: Test Python ${{ matrix.python-version }} on ${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
include:
- os: windows-latest
python-version: 3.8
- os: windows-latest
python-version: 3.9
- os: windows-latest
python-version: '3.10'
- os: windows-latest
python-version: '3.11'
# I can't figure out how to get this to run on linux, feel free anyone to figure out and fix! :)
# - os: ubuntu-22.04
# python-version: 3.8
# - os: ubuntu-22.04
# python-version: 3.9
# - os: ubuntu-22.04
# python-version: '3.10'
# - os: ubuntu-22.04
# python-version: '3.11'
- os: macos-latest
python-version: 3.8
- os: macos-latest
python-version: 3.9
- os: macos-latest
python-version: '3.10'
- os: macos-latest
python-version: '3.11'
steps:
- name: Checkout mpf-monitor
uses: actions/checkout@v3
- name: Setup python
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: install Ubuntu dependencies
if: matrix.os == 'ubuntu-22.04'
run: |
sudo apt-get update
sudo apt-get install -y '^libxcb.*-dev' libx11-xcb-dev libglu1-mesa-dev libxrender-dev libxi-dev libxkbcommon-dev libxkbcommon-x11-dev
sudo apt-get install -y qt6-base-dev
- name: Install mpf-monitor
run: |
pip install --upgrade pip setuptools wheel build coveralls
pip install 'mpf>=0.57.0.dev1'
pip install -e .
- name: Lint with flake8
run: |
pip install flake8 pytest
# stop the build if there are Python syntax errors or undefined names
flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
# exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide
flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics
- name: Run tests
run: coverage run -m unittest discover -s mpfmonitor/tests
- name: Upload coverage data to coveralls.io
run: coveralls --service=github
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
COVERALLS_FLAG_NAME: ${{ matrix.python-version }}-${{ matrix.os }}
COVERALLS_PARALLEL: true
coveralls:
name: Indicate completion to coveralls.io
needs: tests
runs-on: ubuntu-latest
container: python:3-slim
steps:
- name: Finished
run: |
pip3 install --upgrade coveralls
coveralls --service=github --finish
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
build_wheels:
name: Build wheel
needs: tests
runs-on: ubuntu-latest
steps:
- name: Checkout mpf-monitor
uses: actions/checkout@v3
- name: Setup python
uses: actions/setup-python@v4
with:
python-version: 3.11
- name: Install mpf-monitor
run: |
pip install --upgrade pip setuptools wheel build
pip install 'mpf>=0.57.0.dev1'
pip install -e .
- name: Build wheel
run: python -m build
- uses: actions/upload-artifact@v3
with:
name: mpf-monitor-wheels
path: ./dist/*.*
publish_to_pypi: # only if this release has a tag and is a push from us (e.g. not a pull request)
name: Publish to PYPI
needs: build_wheels
runs-on: ubuntu-latest
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags')
environment:
name: pypi
url: https://pypi.org/p/mpf
permissions:
id-token: write
steps:
- name: Download wheels
uses: actions/download-artifact@v3
with:
name: mpf-monitor-wheels
path: dist
- name: Publish to PyPI
uses: pypa/gh-action-pypi-publish@release/v1