Skip to content

[pre-commit.ci] pre-commit autoupdate #263

[pre-commit.ci] pre-commit autoupdate

[pre-commit.ci] pre-commit autoupdate #263

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-20.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"
- 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@v4 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@v4
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 etcd, 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
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: 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 etcd/consul backend tests
echo "PYTEST_ADDOPTS=-k 'not etcd and not consul'" >> "${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