Skip to content

add redis implementation #276

add redis implementation

add redis implementation #276

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:
ETCDCTL_API: "3"
PROTOCOL_BUFFERS_PYTHON_IMPLEMENTATION: python
ETCD_DOWNLOAD_VERSION: "3.4.24"
CONSUL_VERSION: "1.14.4"
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:
- python: "3.7"
- python: "3.8"
backend: "etcd"
- python: "3.9"
backend: "consul"
- python: "3.10"
backend: "redis"
- python: "3.11"
steps:
# NOTE: In GitHub workflows, environment variables are set by writing
# assignment statements to a file. They will be set in the following
# steps as if would used `export MY_ENV=my-value`.
- name: Configure environment variables
run: |
echo "PATH=$PWD/bin:$PATH" >> $GITHUB_ENV
- uses: actions/checkout@v4
# NOTE: actions/setup-python@v5 make use of a cache within the GitHub base
# environment and setup in a fraction of a second.
- name: Install Python ${{ matrix.python }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python }}
- name: Install Python dependencies
run: |
pip install --upgrade setuptools pip
pip install -r dev-requirements.txt -e .
python -m jupyterhub_traefik_proxy.install --output=./bin
pip freeze
- name: Install consul
if: matrix.backend == 'consul'
run: |
curl -L https://releases.hashicorp.com/consul/${CONSUL_VERSION}/consul_${CONSUL_VERSION}_linux_amd64.zip > consul.zip
unzip consul.zip -d ./bin consul
- name: Install etcd
if: matrix.backend == 'etcd'
run: |
curl -L https://github.com/etcd-io/etcd/releases/download/v${ETCD_DOWNLOAD_VERSION}/etcd-v${ETCD_DOWNLOAD_VERSION}-linux-amd64.tar.gz > etcd.tar.gz
tar -xzf etcd.tar.gz -C ./bin --strip-components=1 --wildcards '*/etcd*'
- name: Install redis
if: matrix.backend == 'redis'
# from https://redis.io/docs/install/install-redis/install-redis-on-linux/
run: |
curl -fsSL https://packages.redis.io/gpg | sudo gpg --dearmor -o /usr/share/keyrings/redis-archive-keyring.gpg
echo "deb [signed-by=/usr/share/keyrings/redis-archive-keyring.gpg] https://packages.redis.io/deb $(lsb_release -cs) main" | sudo tee /etc/apt/sources.list.d/redis.list
sudo apt-get -y update
sudo apt-get -y install redis
- name: Select tests
run: |
if [[ ! -z "${{ matrix.backend }}" ]]; then
# select backend subset
echo "PYTEST_ADDOPTS=-k ${{ matrix.backend }}" >> "${GITHUB_ENV}"
else
# default: select everything _but_ the KV backend tests
echo "PYTEST_ADDOPTS=-k 'not etcd and not consul and not redis'" >> "${GITHUB_ENV}"
fi
- name: Run tests
run: |
# Using the "--slow-last" flag, should run the slow tests last
pytest -v --durations 10 --maxfail 3 --slow-last --color=yes --cov=jupyterhub_traefik_proxy tests
- name: Submit codecov report
run: |
codecov