Skip to content

Test python 3.12, redis 7, traefik 3 - and misc updates to align with jupyterhub-python-repo-template #309

Test python 3.12, redis 7, traefik 3 - and misc updates to align with jupyterhub-python-repo-template

Test python 3.12, redis 7, traefik 3 - and misc updates to align with jupyterhub-python-repo-template #309

Workflow file for this run

# This is a GitHub workflow defining a set of jobs with a set of steps.
# ref: https://docs.github.com/en/actions/learn-github-actions/workflow-syntax-for-github-actions
#
name: Run tests
on:
pull_request:
paths-ignore:
- "docs/**"
- "**.md"
- "**.rst"
- ".github/workflows/*"
- "!.github/workflows/test.yml"
push:
paths-ignore:
- "docs/**"
- "**.md"
- "**.rst"
- ".github/workflows/*"
- "!.github/workflows/test.yml"
branches-ignore:
- "dependabot/**"
- "pre-commit-ci-update-config"
workflow_dispatch:
env:
PROTOCOL_BUFFERS_PYTHON_IMPLEMENTATION: python
jobs:
# Run "pytest tests" for various Python versions
pytest:
runs-on: ubuntu-22.04
timeout-minutes: 30
strategy:
# Keep running even if one variation of the job fail
fail-fast: false
matrix:
include:
# Test against old and new python, and traefik v2 and v3
- python: "3.8"
backend: file
traefik-version: "v2.10.7"
- python: "3.12"
backend: file
traefik-version: "v3.0.0-beta5"
# Test each backend that requires a python client against a modern
# version of python to ensure clients are compatible.
#
# - About redis versions:
# redis can be installed from source, as an ubuntu distribution, or
# snap package. To avoid complexity we don't build from source, but we
# test against the ubuntu and snap package, where the ubuntu package
# typically is behind the snap package.
#
# redis-version is provided as a matrix input only to provide
# visibility via github's web UI.
#
- python: "3.12"
backend: redis
install-via: apt # version 6.0.16 in ubuntu 22.04, https://packages.ubuntu.com/jammy/redis-server
redis-version: "6.0.16?"
- python: "3.12"
backend: redis
install-via: snap # version 7.2.4 or higher, https://snapcraft.io/redis
redis-version: ">=7.2.4"
- python: "3.12"
backend: etcd
etcd-version: "v3.4.29" # https://github.com/etcd-io/etcd/releases
- python: "3.12"
backend: consul
consul-version: "1.17.2" # https://github.com/hashicorp/consul/releases (but omit v prefix)
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python }}
- name: Install Python dependencies
run: |
pip install --upgrade setuptools pip
pip install -e ".[test]"
- name: List Python dependencies
run: |
pip freeze
- name: Add bin directories to PATH
run: |
echo "PATH=$PWD/bin:/snap/redis/current/usr/bin/:$PATH" >> $GITHUB_ENV
- name: Install traefik
run: |
TRAEFIK_VERSION=
if [[ ! -z "${{ matrix.traefik-version }}" ]]; then
TRAEFIK_VERSION=--traefik-version=${{ matrix.traefik-version }}
fi
python -m jupyterhub_traefik_proxy.install --output=./bin ${TRAEFIK_VERSION}
traefik version
- name: Install consul
if: matrix.backend == 'consul'
run: |
curl -L https://releases.hashicorp.com/consul/${{ matrix.consul-version }}/consul_${{ matrix.consul-version }}_linux_amd64.zip > consul.zip
unzip consul.zip -d ./bin consul
consul version
- name: Install etcd
if: matrix.backend == 'etcd'
run: |
curl -L https://github.com/etcd-io/etcd/releases/download/${{ matrix.etcd-version }}/etcd-${{ matrix.etcd-version }}-linux-amd64.tar.gz > etcd.tar.gz
tar -xzf etcd.tar.gz -C ./bin --strip-components=1 --wildcards '*/etcd*'
etcdctl version
- name: Install redis via ${{ matrix.install-via }}
if: matrix.backend == 'redis'
run: |
if [[ "${{ matrix.install-via }}" == "apt" ]]; then
sudo apt-get -y install redis
else
sudo snap install redis
fi
redis-server --version
- name: Run tests
run: |
if [[ "${{ matrix.backend }}" == "file" ]]; then
# select everything _but_ the KV store backend tests
export PYTEST_ADDOPTS="-k 'not etcd and not consul and not redis'"
else
# select backend subset
export PYTEST_ADDOPTS="-k ${{ matrix.backend }}"
fi
pytest
- uses: codecov/codecov-action@v3