Skip to content

Commit 840b974

Browse files
committed
🚀 chore(grid upgrade): turbocharged Selenium Grid + streamlined workflows 🧪🐳
- requires-python >= 3.12 - Updated config.yaml with hub_image and browser images set to latest 🚦 - Split GitHub Actions into Docker 🐳 and K8s ☸️ test flows for clarity and better coverage 📊 - Introduced pidfile.py for clean kubectl port-forward process handling in KinD 🧼 - Added psutil + stubs to pyproject.toml for helper PidFile functions ⚙️ - Swapped Optional for modern `Type | None` typing 🧹 - Added rich CLI entrypoint using Typer: - `server dev` / `server run` for FastAPI server modes 🚀 - `helm` subcommand for Kubernetes deployment management ☸️ - Includes styled help via rich markup ✨ - 📚 Updated `README.md` with latest usage and architecture info - ➕ Added `CITATION.cff`, `ATTRIBUTION.md` and `CONTRIBUTING.md` for transparency and community contribution guidelines ✅ ALL TESTS PASSED (local/act, Docker, K3s) — full green lights! 💚
1 parent e14b106 commit 840b974

40 files changed

+1898
-1109
lines changed
Lines changed: 103 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,43 +1,91 @@
1-
# WARNING: This workflow runs integration and end-to-end (E2E) tests, which require significant resources (Docker, Kubernetes, browsers, etc.).
2-
# Running this workflow may consume a large amount of GitHub Actions minutes and may quickly exhaust your free tier or incur costs.
3-
# It is recommended to run this workflow only when necessary (e.g., before releases or major merges).
4-
# Or just run locally :)
5-
6-
name: Manual Integration & E2E Tests (High Resource Usage)
1+
name: Integration & E2E Tests (Docker and KinD [kubernetes in docker])
72

83
on:
94
workflow_dispatch:
5+
push:
6+
branches: [main]
7+
pull_request:
8+
branches: [main]
9+
10+
env:
11+
UV_SYSTEM_PYTHON: 1
12+
MIN_COVERAGE: 60
1013

1114
jobs:
12-
integration-e2e-tests:
15+
16+
docker-tests:
17+
name: Run Docker-based tests
1318
runs-on: ubuntu-latest
14-
env:
15-
UV_SYSTEM_PYTHON: 1
19+
timeout-minutes: 2
1620

1721
steps:
18-
- uses: actions/checkout@v4
19-
- uses: actions/setup-python@v5
22+
- name: Checkout code
23+
uses: actions/checkout@v4
24+
- name: Setup Python
25+
uses: actions/setup-python@v5
26+
with:
27+
python-version-file: .python-version
28+
29+
- name: Setup uv
30+
uses: astral-sh/setup-uv@v6
31+
with:
32+
enable-cache: true
33+
cache-dependency-glob: |
34+
pyproject.toml
35+
uv.lock
36+
37+
- name: Install dependencies
38+
run: uv sync --locked --all-groups --extra test
39+
40+
- name: Run Docker integration & E2E tests with coverage
41+
run: uv run coverage run --parallel-mode -m pytest -m "integration or e2e" -k "docker"
42+
43+
- name: Upload Docker coverage data
44+
uses: actions/upload-artifact@v3
45+
with:
46+
name: coverage-docker
47+
path: .coverage*
48+
49+
kubernetes-tests:
50+
name: Run Kubernetes-based tests
51+
runs-on: ubuntu-latest
52+
timeout-minutes: 4
53+
54+
steps:
55+
- name: Checkout code
56+
uses: actions/checkout@v4
57+
- name: Setup Python
58+
uses: actions/setup-python@v5
2059
with:
2160
python-version-file: .python-version
22-
- uses: astral-sh/setup-uv@v6
61+
62+
- name: Setup uv
63+
uses: astral-sh/setup-uv@v6
2364
with:
2465
enable-cache: true
2566
cache-dependency-glob: |
2667
pyproject.toml
2768
uv.lock
28-
- name: Set up KinD cluster
69+
70+
- name: Setup KinD cluster
2971
uses: helm/kind-action@v1
3072
with:
31-
version: v0.26.0
73+
version: v0.29.0
3274
cluster_name: integration-e2e-tests
33-
- name: Install yq (yaml parser)
34-
run: |
35-
sudo wget https://github.com/mikefarah/yq/releases/download/v4.45.4/yq_linux_amd64 -O /usr/bin/yq
36-
sudo chmod +x /usr/bin/yq
75+
76+
- name: Setup Helm
77+
uses: azure/setup-helm@v4
78+
with:
79+
version: "v3.18.4"
80+
- name: Setup yq (yaml parser)
81+
uses: mikefarah/yq@v4
82+
with:
83+
cmd: yq --version
3784
- name: Rename KinD context
3885
run: |
3986
new_context=$(yq '.kubernetes.context' config.yaml)
4087
kubectl config rename-context kind-integration-e2e-tests "$new_context"
88+
4189
- name: Export KUBERNETES__KUBECONFIG
4290
run: |
4391
if [ "$EUID" -eq 0 ]; then
@@ -46,14 +94,44 @@ jobs:
4694
kube_config="$HOME/.kube/config"
4795
fi
4896
echo "KUBERNETES__KUBECONFIG=$kube_config" >> $GITHUB_ENV
49-
- name: Install Helm CLI
50-
run: |
51-
curl https://raw.githubusercontent.com/helm/helm/main/scripts/get-helm-3 | bash
97+
5298
- name: Install dependencies
5399
run: uv sync --locked --all-groups --extra test
100+
54101
- name: Deploy Selenium Grid to KinD
55102
run: uv run helm-selenium-grid deploy
56-
- name: Run tests with coverage
57-
run: uv run coverage run -m pytest -m "integration or e2e"
58-
- name: Run coverage report
59-
run: uv run coverage report --fail-under=60
103+
104+
- name: Run Kubernetes integration & E2E tests with coverage
105+
timeout-minutes: 2
106+
run: |
107+
uv run coverage run --parallel-mode -m pytest -m "integration or e2e" -k "kubernetes"
108+
109+
- name: Upload Kubernetes coverage data
110+
uses: actions/upload-artifact@v3
111+
with:
112+
name: coverage-kubernetes
113+
path: .coverage*
114+
115+
coverage-report:
116+
name: Combine coverage reports and report
117+
runs-on: ubuntu-latest
118+
needs: [docker-tests, kubernetes-tests]
119+
timeout-minutes: 2
120+
121+
steps:
122+
- uses: actions/checkout@v4
123+
124+
- name: Download Docker coverage data
125+
uses: actions/download-artifact@v3
126+
with:
127+
name: coverage-docker
128+
129+
- name: Download Kubernetes coverage data
130+
uses: actions/download-artifact@v3
131+
with:
132+
name: coverage-kubernetes
133+
134+
- name: Combine and report coverage
135+
run: |
136+
uv run coverage combine
137+
uv run coverage report --fail-under=$MIN_COVERAGE

.pre-commit-config.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ repos:
99
- id: ruff
1010
args: [--fix]
1111
- id: ruff-format
12-
args: ["--line-length", "100", "--target-version", "py310"]
12+
args: ["--line-length", "100", "--target-version", "py312"]
1313
- repo: local
1414
hooks:
1515
- id: mypy

.vscode/settings.json

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,5 @@
33
"python.testing.pytestArgs": ["./src/tests"],
44
"python.testing.unittestEnabled": false,
55
"python.testing.pytestEnabled": true,
6-
"python.analysis.diagnosticSeverityOverrides": {
7-
// let mypy handle
8-
"reportUnknownVariableType": false,
9-
"reportUnknownArgumentType": false
10-
}
6+
"python.analysis.typeCheckingMode": "off" // using Mypy
117
}

0 commit comments

Comments
 (0)