Skip to content

Drop compatibility with older autopy versions #573

Drop compatibility with older autopy versions

Drop compatibility with older autopy versions #573

Workflow file for this run

name: CI
on:
push:
pull_request:
workflow_dispatch:
jobs:
linux-multi-python:
name: Linux ${{ matrix.install_variant }} with Python ${{ matrix.python-version }}
runs-on: ubuntu-latest
env:
DISPLAY: ':99.0'
strategy:
matrix:
python-version: [3.10.8, 3.11, 3.12, 3.13]
install_variant: ["pip"]
include:
- python-version: 3.12
install_variant: "rpm.fedora.40"
- python-version: 3.12
install_variant: "deb.ubuntu.noble"
fail-fast: false
steps:
- run: echo "Job triggered by a ${{ github.event_name }} event on branch is ${{ github.ref }} in repository is ${{ github.repository }}, runner on ${{ runner.os }}"
- name: Check out repository code
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
cache: 'pip'
cache-dependency-path: 'packaging/pip_requirements.txt'
if: matrix.install_variant == 'pip'
- name: Display Python version
run: python -c "import sys; print(sys.version)"
if: matrix.install_variant == 'pip'
- name: Refresh system packager mirrors and packages
run: sudo apt-get -y update
- name: Install non-python dependencies using system packager
run: |
# ocr
sudo apt-get -y install pkg-config tesseract-ocr libtesseract-dev
# xdotool
sudo apt-get -y install xdotool x11-apps imagemagick
# vncdotool
sudo apt-get -y install xfonts-base x11vnc
# pyautogui
sudo apt-get -y install gnome-screenshot
# pyqt6 for integration testing
sudo apt-get install libegl1 libxcb-cursor0
if: matrix.install_variant == 'pip'
- name: Install any dependencies and build the package
run: |
pip --default-timeout=60 install -r packaging/pip_requirements.txt
# build tools
pip install wheel twine
pushd packaging
python3 setup.py sdist bdist_wheel
popd
if: matrix.install_variant == 'pip'
- run: sleep 3
- name: Cache large ML models
uses: actions/cache@v4
with:
path: ~/.cache/torch/hub/checkpoints
key: fasterrcnn-258fb6c6+maskrcnn-bf2d0c1e
- name: Prepare virtual screen (fake display)
run: |
sudo apt-get -y install libx11-dev libxtst-dev xvfb vim-common
sudo apt-get install -y x11-utils libxkbcommon-x11-0 libxcb-icccm4 libxcb-image0 libxcb-keysyms1 libxcb-randr0 libxcb-render-util0 libxcb-xinerama0 libxcb-xfixes0
Xvfb :99 -screen 0 1024x768x24 &> /tmp/xvfb.log &
sudo touch ~/.Xauthority
sudo xauth -f ~/.Xauthority add ${HOST}:99 . $(xxd -l 16 -p /dev/urandom)
sudo chmod a+rxw ~/.Xauthority
# give xvfb some time to start
sleep 3
- name: Run current semi-isolation semi-integration tests (to be separated in the future)
run: |
if [[ "${{ matrix.install_variant }}" != "pip" ]]; then cd packaging && bash packager_docker.sh;
else cd tests && bash coverage_analysis.sh; fi
env:
INSTALL_VARIANT: ${{ matrix.install_variant }}
TESSDATA_PREFIX: /usr/share/tesseract-ocr/5/tessdata
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v4
with:
files: tests/coverage.xml
verbose: true
if: matrix.install_variant == 'pip'
- run: echo "🥑 This job's status is ${{ job.status }}."
- name: Set Artifacts and Release Variables
id: set_vars
run: |
VERSION="$( cat /home/runner/work/guibot/guibot/VERSION )"
# Get the part before the last dot "0.51" for example
prefix=${VERSION%.*}
# Get the part after the last dot "1" for example
suffix=${VERSION##*.}
# Combine them with a hyphen "0.51.1" -> "0.51-1"
VERSION_HYPHEN="${prefix}-${suffix}"
if [[ "$(echo ${{ matrix.install_variant }} | cut -d '.' -f 2)" == "fedora" ]]; then
readonly variant_version=$(echo ${{ matrix.install_variant }} | cut -d '.' -f 3)
PACKAGE_NAME="python3-guibot-${VERSION_HYPHEN}.fc${variant_version}.x86_64.rpm"
PACKAGE_PATH="/home/runner/work/guibot/guibot/${PACKAGE_NAME}"
elif [[ "${{ matrix.install_variant }}" == "pip" ]]; then
PACKAGE_NAME="guibot-${VERSION}-py3-none-any.whl"
PACKAGE_PATH="/home/runner/work/guibot/guibot/packaging/dist/${PACKAGE_NAME}"
else
PACKAGE_NAME="python3-guibot_${VERSION_HYPHEN}_all.deb"
PACKAGE_PATH="/home/runner/work/guibot/guibot/${PACKAGE_NAME}"
fi
echo "artifact_name=$PACKAGE_NAME" >> $GITHUB_ENV
echo "artifact_full_path=$PACKAGE_PATH" >> $GITHUB_ENV
- name: Upload Artifacts
uses: actions/upload-artifact@v4
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
name: '${{ env.artifact_name }}'
path: '${{ env.artifact_full_path }}'
if: matrix.install_variant != 'pip' || matrix.python-version == 3.13
windows:
name: Windows with any available coverage
runs-on: windows-latest
steps:
- name: Check out repository code
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Set up Python 3
uses: actions/setup-python@v5
with:
python-version: '3.12'
cache: 'pip'
cache-dependency-path: 'packaging/pip_requirements.txt'
- name: Local pip installation on Windows
run: |
cd packaging
pip install --upgrade pip
pip install -r pip_requirements.txt
pip install .
- name: Cache large ML models
uses: actions/cache@v4
with:
path: ~/.cache/torch/hub/checkpoints
key: fasterrcnn-258fb6c6+maskrcnn-bf2d0c1e
- name: Prepare virtual screen (fake display)
run: |
pip install wxPython==4.2.4
python -c "import wx; app = wx.App(); display = wx.Display()"
- name: Run current semi-isolation semi-integration tests (to be separated in the future)
run: |
cd tests
bash coverage_analysis.sh
env:
# tesseract doesn't have original installers for Windows
DISABLE_OCR: 1
# drag/drop and in particular drop has problems with AutoPy on Windows
DISABLE_DRAG: 1
# requires X server and thus only available on Linux
DISABLE_XDOTOOL: 1
# requires VNC server and thus only available on Linux
DISABLE_VNCDOTOOL: 1
macos:
name: MacOS with any available coverage
runs-on: macos-latest
steps:
- name: Check out repository code
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Set up Python 3
uses: actions/setup-python@v5
with:
python-version: '3.12'
cache: 'pip'
cache-dependency-path: 'packaging/pip_requirements.txt'
- name: Install non-python dependencies using system packager
run: |
# ocr
brew install tesseract
- name: Local pip installation on macOS
run: |
cd packaging
pip install --upgrade pip
pip install -r pip_requirements.txt
pip install .
- name: Cache large ML models
uses: actions/cache@v4
with:
path: ~/.cache/torch/hub/checkpoints
key: fasterrcnn-258fb6c6+maskrcnn-bf2d0c1e
- name: Prepare virtual screen (fake display)
run: |
pip install wxPython==4.2.4
python -c "import wx; app = wx.App(); display = wx.Display()"
- name: Run current semi-isolation semi-integration tests (to be separated in the future)
run: |
cd tests
bash coverage_analysis.sh
env:
# drag/drop and in particular drop has problems with AutoPy on macOS
DISABLE_DRAG: 1
# requires X server and thus only available on Linux
DISABLE_XDOTOOL: 1
# requires VNC server and thus only available on Linux
DISABLE_VNCDOTOOL: 1
# TODO: enable PyAutoGUI for macOS if there is more interest
DISABLE_PYAUTOGUI: 1