-
Notifications
You must be signed in to change notification settings - Fork 30
143 lines (124 loc) · 4.64 KB
/
test.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
# 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 apt package for an
# ubuntu lts release, or snap package. To avoid complexity we don't
# build from source which would allow us to pick a version to
# install, 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
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@v4