-
Notifications
You must be signed in to change notification settings - Fork 99
/
noxfile.py
66 lines (57 loc) · 1.71 KB
/
noxfile.py
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
import os
from pathlib import Path
import nox
@nox.session(python="3.9", reuse_venv=True)
def run_min_version_test(session):
# explicit venv to avoid overwriting local venv if exists
py_str = "test-venv"
session.run(
"uv",
"sync",
env={"UV_PROJECT_ENVIRONMENT": py_str, "VIRTUAL_ENV": py_str},
)
session.run(
"uv",
"run",
"pytest",
"tests_basic/core",
env={"UV_PROJECT_ENVIRONMENT": py_str, "VIRTUAL_ENV": py_str},
)
@nox.session(python=False)
def serve_docs(session):
session.run(
"sphinx-autobuild",
"docs/source",
"docs/build",
"--port",
"8777",
"--open-browser",
)
@nox.session(python=False)
def build_docs(session):
"""Build the docs; used in CI pipelines to test the build. Will always rebuild and will always fail if there are any warnings"""
session.run(
"sphinx-build",
"docs/source",
"docs/build",
"-W",
"--keep-going",
"-a",
"-E",
"-b",
"html",
"-q",
)
@nox.session(python=False)
def update_dev_kraken(session):
"""Run the Kraken build to update it with new pylinac changes"""
if Path("GCP_creds.json").exists():
os.environ["GCP_BUILD_CREDS"] = Path("gcp_build_creds.json").open().read()
key_info = os.environ["GCP_BUILD_CREDS"]
with open("service_key.json", "w") as key_file:
key_file.write(key_info)
session.run(
"gcloud", "auth", "activate-service-account", "--key-file", "service_key.json"
)
session.run("gcloud", "config", "set", "project", "radmachine")
session.run("gcloud", "builds", "triggers", "run", "Kraken", "--branch=master")