Skip to content

CI: Update AppImage build workflow to avoid using actions/checkout. #1688

CI: Update AppImage build workflow to avoid using actions/checkout.

CI: Update AppImage build workflow to avoid using actions/checkout. #1688

Workflow file for this run

name: Run tests
on:
push:
branches: '*'
pull_request:
branches: '*'
jobs:
test:
timeout-minutes: 30
strategy:
matrix:
# macos-13 is x86 and macos-14 is arm64
os: [ubuntu-20.04, ubuntu-latest, macos-13, 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@v5
with:
python-version: ${{ matrix.python-version }}
env:
# Workaround to issue using Python 3.5
# https://github.com/actions/setup-python/issues/866
PIP_TRUSTED_HOST: "pypi.python.org pypi.org files.pythonhosted.org"
- 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/[email protected]
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/[email protected]
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/[email protected]
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/[email protected]
with:
host: rpios
username: pi
password: raspberry
port: ${{ job.services.rpios.ports[5022] }}
command_timeout: 25m
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/[email protected]
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/[email protected]
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