-
Notifications
You must be signed in to change notification settings - Fork 340
150 lines (139 loc) · 5.24 KB
/
integration-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
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
# 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: Integration tests
on:
pull_request:
paths-ignore:
- "docs/**"
- "**.md"
- ".github/workflows/*"
- "!.github/workflows/integration-test.yaml"
push:
paths-ignore:
- "docs/**"
- "**.md"
- ".github/workflows/*"
- "!.github/workflows/integration-test.yaml"
branches-ignore:
- "dependabot/**"
- "pre-commit-ci-update-config"
workflow_dispatch:
jobs:
integration-tests:
# integration tests run in a container,
# not in the worker, so this version is not relevant to the tests
# and can be the same for all tested versions
runs-on: ubuntu-22.04
name: ${{ matrix.name }}
strategy:
fail-fast: false
matrix:
include:
- name: "Debian 11, Py 3.9"
distro_image: "debian:11"
extra_flags: ""
- name: "Debian 12, Py 3.11"
distro_image: "debian:12"
extra_flags: ""
- name: "Ubuntu 20.04, Py 3.8"
distro_image: "ubuntu:20.04"
extra_flags: ""
- name: "Ubuntu 22.04 Py 3.10"
distro_image: "ubuntu:22.04"
extra_flags: ""
- name: "Ubuntu 24.04 Py 3.12"
distro_image: "ubuntu:24.04"
extra_flags: ""
- name: "Ubuntu 22.04, Py 3.10, from main"
distro_image: "ubuntu:22.04"
extra_flags: --upgrade-from=main
- name: "Ubuntu 22.04, Py 3.10, from latest"
distro_image: "ubuntu:22.04"
extra_flags: --upgrade-from=latest
- name: "Ubuntu 22.04, Py 3.10, from 0.2.0"
distro_image: "ubuntu:22.04"
extra_flags: --upgrade-from=0.2.0
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: "3.10"
- name: Build systemd image, derived from ${{ matrix.distro_image }}
run: |
.github/integration-test.py build-image \
--build-arg "BASE_IMAGE=${{ matrix.distro_image }}"
# Overview of how this logic influences the end result.
# - integration-test.yaml:
#
# - Runs integration-test.py build-image, to build a systemd based image
# to use later.
#
# - Runs integration-test.py run-tests, to start a systemd based
# container, run the bootstrap.py script inside it, and then run
# pytest from the hub python environment setup by the bootstrap
# script.
#
# About passed --installer-args:
#
# - --admin admin:admin
# Required for test_admin_installer.py
#
# - --plugin /srv/src/integration-tests/plugins/simplest
# Required for test_simplest_plugin.py
#
- name: pytest integration-tests/
id: integration-tests
run: |
.github/integration-test.py run-test integration-tests \
--installer-args "--admin test-admin-username:test-admin-password" \
--installer-args "--plugin /srv/src/integration-tests/plugins/simplest" \
${{ matrix.extra_flags }} \
test_hub.py \
test_proxy.py \
test_install.py \
test_extensions.py \
test_admin_installer.py \
test_simplest_plugin.py
timeout-minutes: 15
- name: show logs
if: always() && steps.integration-tests.outcome != 'skipped'
run: |
.github/integration-test.py show-logs integration-tests
integration-tests-bootstrap:
# integration tests run in a container,
# not in the worker, so this version is not relevant to the tests
# and can be the same for all tested versions
runs-on: ubuntu-22.04
name: ${{ matrix.name }}
strategy:
fail-fast: false
matrix:
include:
- name: "Ubuntu 22.04 Py 3.10 (test_bootstrap.py)"
distro_image: "ubuntu:22.04"
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: "3.10"
# FIXME: The test_bootstrap.py script has duplicated logic to run build
# and start images and run things in them. This makes tests slower,
# and adds code to maintain. Let's try to remove it.
#
# - bootstrap.py's failure detections, put in unit tests?
# - bootstrap.py's --show-progress-page test, include as a normal
# integration test?
#
- name: Install integration-tests/requirements.txt for test_bootstrap.py
run: pip install -r integration-tests/requirements.txt
- name: Run bootstrap tests (Runs in/Builds ${{ matrix.distro_image }} derived image)
run: |
pytest integration-tests/test_bootstrap.py
timeout-minutes: 10
env:
# integration-tests/test_bootstrap.py will build and start containers
# based on this environment variable. This is similar to how
# .github/integration-test.py build-image can take a --build-arg
# setting the base image via a Dockerfile ARG.
BASE_IMAGE: ${{ matrix.distro_image }}