ci: add github actions workflow #1
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- | |
name: Automated Tests | |
on: | |
push: | |
branches: | |
- main | |
pull_request: | |
branches: | |
- main | |
workflow_dispatch: {} | |
jobs: | |
tests: | |
name: Python tests | |
strategy: | |
matrix: | |
os: ["ubuntu-latest"] | |
python-version: ["3.7", "3.8", "3.9", "3.10", "3.11", "3.12"] | |
include: | |
- os: "ubuntu-20.04" | |
python-version: "3.6" | |
runs-on: ${{ matrix.os }} | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up Python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: ${{ matrix.python-version }} | |
- name: Install tests dependencies | |
run: | | |
sudo apt-get install -y build-essential libcairo2-dev libgirepository1.0-dev libpango1.0-dev | |
python -m pip install --upgrade pip | |
- name: Install application with its dependencies | |
if: ${{ matrix.python-version != '3.6' }} | |
run: | | |
pip install . .[web] .[tests] | |
# Unfortunately, pip and setuptools in Python 3.6 do not fully support | |
# PEP517 pyproject.toml. As a workaround for this version, the setup.py | |
# script provided by RFL.build package is copied and executed. | |
# | |
# Some dependencies are pre-installed to add version constraints, in order | |
# to force installation of old versions compatible with Python 3.6. | |
# | |
# Some RacksDB optional dependencies are declared in extra packages. | |
# This is not supported by setup.py script from RFL.build. As a workaround | |
# these dependencies are installed manually afterwhile. | |
- name: Install application with its dependencies (Python 3.6) | |
if: ${{ matrix.python-version == '3.6' }} | |
run: | | |
echo "::notice::Installing RFL.build" | |
pip install RFL.build | |
echo "::notice::Installing PyYAML (old version)" | |
pip install PyYAML==5.4.1 | |
echo "::notice::Installing PyGObject (old version)" | |
pip install "PyGObject<3.43.0" | |
cp -v ${Python3_ROOT_DIR}/lib/python3.6/site-packages/rfl/build/scripts/setup setup.py | |
python3 setup.py install | |
echo "::notice::Installing optional dependencies required for tests" | |
pip install pytest | |
# The cached_property decorator is integrated in Python 3.8+. For older versions, | |
# install cached_property external library. | |
- if: ${{ matrix.python-version == '3.6' || matrix.python-version == '3.7' }} | |
run: pip install cached_property | |
- name: Run tests | |
run: pytest |