-
Notifications
You must be signed in to change notification settings - Fork 308
130 lines (114 loc) · 4.33 KB
/
test.yaml
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
# This is a GitHub workflow defining a set of jobs with a set of steps.
# ref: https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions
#
name: Tests
on:
pull_request:
paths-ignore:
- "docs/**"
- "**.md"
- ".github/workflows/*.yaml"
- "!.github/workflows/test.yaml"
push:
paths-ignore:
- "docs/**"
- "**.md"
- ".github/workflows/*.yaml"
- "!.github/workflows/test.yaml"
branches-ignore:
- "dependabot/**"
- "pre-commit-ci-update-config"
tags: ["**"]
workflow_dispatch:
jobs:
test:
runs-on: ubuntu-22.04
timeout-minutes: 10
strategy:
fail-fast: false
matrix:
include:
- python-version: "3.8"
pip-install-spec: "jupyterhub==2.3.1 sqlalchemy==1.*"
- python-version: "3.9"
pip-install-spec: "jupyterhub==3.*"
- python-version: "3.11"
pip-install-spec: "jupyterhub==4.*"
- python-version: "3.11"
pip-install-spec: "jupyterhub==4.*"
test-variation: internal-ssl
- python-version: "3.11"
pip-install-spec: "jupyterhub==4.*"
test-variation: podman
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- uses: actions/setup-node@v4
with:
node-version: "18"
- name: setup docker swarm
run: docker swarm init
- name: Install Python dependencies
run: |
pip install ${{ matrix.pip-install-spec }}
pip install -e "." -r dev-requirements.txt
- name: List Python dependencies
run: |
pip freeze
- name: Install Node dependencies
run: |
npm install -g configurable-http-proxy
- name: Run tests
if: matrix.test-variation == ''
run: |
pytest tests --cov=dockerspawner
- name: Run examples/internal-ssl tests
if: matrix.test-variation == 'internal-ssl'
# FIXME: --cov=dockerspawner is omitted as the tested code lives inside
# the built dockerspawner image, so --cov=dockerspawner
# referencing the local source code doesn't get us test coverage.
#
run: |
pytest examples/internal-ssl --capture=no
- name: Run podman tests
continue-on-error: true
if: matrix.test-variation == 'podman'
# Podman's system service is started as a user managed process
# (user-mode / rootless), and the docker-api provided by podman is used
# by setting DOCKER_HOST to the podman provided docker-api.
#
# ref: https://docs.podman.io/en/latest/markdown/podman-system-service.1.html
# ref: https://docker-py.readthedocs.io/en/stable/client.html#envvar-DOCKER_HOST
#
run: |
# Default is unix://$XDG_RUNTIME_DIR/podman/podman.sock but XDG_RUNTIME_DIR may not be set
export DOCKER_HOST=unix://$HOME/podman.sock
podman system service --time=0 $DOCKER_HOST &
for n in $(seq 1 10); do
if ! docker version &>/dev/null; then
echo "podman system service - starting..."
sleep 1
else
echo "podman system service - started!"
echo ""
break
fi
done
# FIXME: we run into an error described in
# https://github.com/containers/podman/blob/main/troubleshooting.md#26-running-containers-with-resource-limits-fails-with-a-permissions-error
#
# This is a check for permissions of relevance, where we
# conclude we get "memory pids" on ubuntu-22.04. This confirms
# that we need additional permissions for the podman system
# service we have started as the current user, lacking such
# permissions.
#
# If this is resolved, also remove the continue-on-error
# section above.
#
cat "/sys/fs/cgroup/user.slice/user-$(id -u).slice/user@$(id -u).service/cgroup.controllers"
pytest tests/test_dockerspawner.py --cov=dockerspawner
# GitHub action reference: https://github.com/codecov/codecov-action
- uses: codecov/codecov-action@v3