image: python:latest stages: - test # prepare set up of latest python image to run style checks .prepare_style: &prepare_style - cat /etc/issue - python3 -V - which python3 - python3 -m venv ../venv - source ../venv/bin/activate - which python3 - pwd - ls -l - pip install -U pip - pip --version - pip install pytest black ruff pydocstyle - pytest --version - cat /etc/issue # prepare set up of Debian system to run py.test .prepare_debian: &prepare_debian - echo "Execute this command before any 'script:' commands." - cat /etc/issue - pwd - ls -l - echo "Install Python3" - apt-get update - apt-get install -y python3 python3-venv python3-rich - python3 -m venv --help - python3 -m venv venv - source venv/bin/activate - which python3 - python3 --version - echo "Install Python dependencies for running the tests" - pip install -U pip - pip --version - pip install pytest black ruff archspec - echo "Diagnostics - which versions are we using" - python3 --version - pytest --version - black --version - ruff --version - echo "Install additional packages we need to run spack-setup.sh" - apt-get install -y git rsync - echo "Install additional packages we need to run spack" # Taken from https://github.com/fangohr/oommf-in-spack/blob/main/Dockerfile - apt-get install -y --no-install-recommends autoconf build-essential ca-certificates coreutils curl environment-modules file gfortran git openssh-server unzip - export MPSD_MICROARCH=$(archspec cpu) - echo "Setting MPSD_MICROARCH variable to $MPSD_MICROARCH" - echo "Which version of Debian are we running?" - cat /etc/issue style: stage: test image: python:latest script: - *prepare_style - black --version - ruff --version - pydocstyle --version - ruff . - black --check --diff . - pydocstyle mpsd-software-environment.py - pydocstyle tests.py # we could also use `ruff --select D` for pycodestyle. But the behaviour is not exactly the same. test-bullseye: stage: test image: debian:bullseye-slim script: - *prepare_debian - pytest -v -l tests.py test-bookworm: stage: test image: debian:bookworm-slim script: - *prepare_debian - pytest -v -l tests.py