-
Notifications
You must be signed in to change notification settings - Fork 437
186 lines (182 loc) · 7 KB
/
test.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
name: Run tests
on:
push:
branches: '*'
pull_request:
branches: '*'
jobs:
test:
timeout-minutes: 30
strategy:
matrix:
os: [ubuntu-20.04, ubuntu-latest, macos-11, macos-latest, windows-2019, windows-latest]
python-version: ['3.5', '3.6', '3.7', '3.8']
exclude:
# Python 3.5 and 3.6 not available in the latest Ubuntu runners
- os: ubuntu-latest
python-version: '3.5'
- os: ubuntu-latest
python-version: '3.6'
fail-fast: false
runs-on: ${{ matrix.os }}
name: Test Py ${{ matrix.python-version }} - ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: Display Python info
run: |
python -c "import sys; print(sys.version)"
python -c "import platform, struct; print(platform.machine(), struct.calcsize('P') * 8)"
python -c "import sys; print(sys.executable)"
python -m pip --version
pip --version
pip config list
pip freeze
- name: Prepare Ubuntu
if: runner.os == 'Linux'
run: |
sudo apt-get update
sudo apt-get install -y libxkbcommon-x11-0 xvfb
- name: Install Mu dependencies
run: |
pip install .[dev]
pip list
timeout-minutes: 10
- name: Run tests
if: runner.os == 'Linux'
run: xvfb-run make check
timeout-minutes: 5
- name: Run tests
if: runner.os != 'Linux'
run: python make.py check
timeout-minutes: 5
test-arm:
runs-on: ubuntu-latest
name: Test Py 3.7 - arm-debian-buster
steps:
- uses: actions/checkout@v4
- name: Set up QEMU
id: qemu
uses: docker/setup-qemu-action@v3
with:
image: tonistiigi/binfmt:latest
platforms: 'linux/arm64,linux/arm/v7,linux/arm/v6'
- name: Check Debian image info
uses: docker://multiarch/debian-debootstrap:armhf-buster
with:
args: /bin/bash -c "uname -a && cat /etc/os-release"
- name: Install dependencies and run tests
uses: docker://multiarch/debian-debootstrap:armhf-buster
with:
args: >
bash -c "
apt-get update &&
apt-get install -y python3 python3-pip python3-virtualenv &&
apt-get install -y python3-pyqt5 python3-pyqt5.qsci python3-pyqt5.qtserialport python3-pyqt5.qtsvg python3-pyqt5.qtchart &&
apt-get install -y libxmlsec1-dev libxml2 libxml2-dev libxkbcommon-x11-0 libatlas-base-dev &&
apt-get install -y git xvfb &&
python3 -m virtualenv venv --python=python3 --system-site-packages &&
source venv/bin/activate &&
python -c \"import platform, struct, sys; print(platform.machine(), struct.calcsize('P') * 8, sys.version)\" &&
python -m pip --version &&
python -m pip config set global.extra-index-url https://www.piwheels.org/simple &&
python -m pip config list &&
python -m pip list &&
python -m pip install .[dev] &&
python -m pip list &&
QT_QPA_PLATFORM=\"offscreen\" &&
xvfb-run python make.py check &&
echo 'Finished successfully! :)'
"
test-pios:
name: Test PiOS ${{ matrix.docker-tag }}
runs-on: ubuntu-latest
strategy:
matrix:
docker-tag: ['stretch-2018-03-13', 'buster-2021-05-28', 'buster-legacy-2023-05-03']
fail-fast: false
services:
rpios:
# Custom made images for Mu: https://github.com/carlosperate/docker-qemu-rpi-os
image: ghcr.io/carlosperate/qemu-rpi-os-lite:${{ matrix.docker-tag }}-mu
ports: ["5022:5022"]
steps:
# This delay is a bit hacky, but can't find a way to signal when OS is ready
- name: Wait 2m30s for the docker image to start up QEMU and Raspberry Pi OS
run: sleep 150
- name: Clone project & setup it as the bash entry directory
uses: appleboy/ssh-action@master
with:
host: rpios
username: pi
password: raspberry
port: ${{ job.services.rpios.ports[5022] }}
script: |
mkdir ~/mu && cd ~/mu
git init
git remote add origin ${{ github.server_url }}/${{ github.repository }}.git
git fetch --progress --depth=1 origin ${{ github.sha }}
git checkout --progress FETCH_HEAD
echo "cd ~/mu" > ~/.bashrc_new && cat ~/.bashrc >> ~/.bashrc_new
rm ~/.bashrc && mv ~/.bashrc_new ~/.bashrc
# As Pi OS stretch is no longer supported the repository URL was moved and is no longer updated
- name: Update Stretch sources.list
if: ${{ matrix.docker-tag == 'stretch-2018-03-13' }}
uses: appleboy/ssh-action@master
with:
host: rpios
username: pi
password: raspberry
port: ${{ job.services.rpios.ports[5022] }}
script: echo "deb http://legacy.raspbian.org/raspbian/ stretch main contrib non-free rpi" | sudo tee /etc/apt/sources.list
- name: Install Mu extra apt dependencies
uses: appleboy/ssh-action@master
with:
host: rpios
username: pi
password: raspberry
port: ${{ job.services.rpios.ports[5022] }}
script: |
sudo apt-get update
sudo apt-get install -y python3-virtualenv
- name: Create venv and install Python dependencies
uses: appleboy/ssh-action@master
with:
host: rpios
username: pi
password: raspberry
port: ${{ job.services.rpios.ports[5022] }}
command_timeout: 20m
script: |
python3 -m virtualenv ~/mu/.venv -v --python=python3 --system-site-packages
echo "source ~/mu/.venv/bin/activate" > ~/.bashrc_new && cat ~/.bashrc >> ~/.bashrc_new
rm ~/.bashrc && mv ~/.bashrc_new ~/.bashrc
source .venv/bin/activate
python -m pip list
python -m pip install ."[dev]"
- name: Environment info
uses: appleboy/ssh-action@master
with:
host: rpios
username: pi
password: raspberry
port: ${{ job.services.rpios.ports[5022] }}
script: |
uname -a
cat /etc/os-release
python3 -c "import platform as p, sys; print(sys.executable, p.architecture(), p.machine(), sys.version, sep='\n')"
python3 -m pip --version
python3 -m pip list
- name: Run tests
uses: appleboy/ssh-action@master
with:
host: rpios
username: pi
password: raspberry
port: ${{ job.services.rpios.ports[5022] }}
# The time out can be decreased to 30 min when Stretch is dropped
command_timeout: 45m
script: xvfb-run python make.py check