-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdagger-ci.py
More file actions
80 lines (71 loc) · 2.41 KB
/
dagger-ci.py
File metadata and controls
80 lines (71 loc) · 2.41 KB
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
"""Execute a command."""
import sys
import anyio
import dagger
async def test():
async with dagger.Connection(dagger.Config(log_output=sys.stderr)) as client:
# get reference to the local project
src = client.host().directory(
".", exclude=[".git", ".venv", ".venvdagger", "dist", "junit"]
)
python = (
client.container()
.from_("python:3.13-slim")
# Install uv
.with_exec(
[
"python",
"-m",
"pip",
"install",
"uv",
]
)
# mount cloned repository into image
.with_directory("/src", src)
# set current working directory for next commands
.with_workdir("/src")
# install dependencies with uv
.with_exec(["uv", "sync"])
.with_env_variable("API_USERNAME", "DUMMY")
.with_env_variable("API_PASSWORD", "DUMMY")
.with_env_variable("API_BASE_URL", "https://foreninglet.dk/api/")
.with_env_variable("API_VERSION", "version=1")
.with_env_variable("API_MEMBERS_API", "members")
.with_env_variable("API_ACTIVITIES_API", "activities")
.with_env_variable("API_RESIGNED_MEMBERS_API", "members/status/resigned")
.with_env_variable("MEMBERSHIP_KEYWORDS", "medlemskab,medlemsskab")
.with_env_variable("TEST_ENVIRONMENT", "True")
# Check standards
.with_exec(
[
"uv",
"run",
"black",
"--check",
"--diff",
"--color",
"--exclude",
"(.venv|foreninglet_data/sdk/)",
".",
]
)
# run tests
.with_exec(
[
"uv",
"run",
"pytest",
"--vcr-record=none",
"tests/",
"--junitxml=junit/test-results.xml",
"--cov=foreninglet_data",
"--cov-report=xml",
"--cov-report=html",
]
)
)
# execute
await python.sync()
print("Tests succeeded!")
anyio.run(test)