Got pytest working with bazel
This commit is contained in:
parent
6ff12bacf8
commit
77a4545496
4
.gitignore
vendored
4
.gitignore
vendored
|
@ -9,6 +9,10 @@ instance/
|
||||||
.coverage
|
.coverage
|
||||||
htmlcov/
|
htmlcov/
|
||||||
|
|
||||||
|
.docker-config.json
|
||||||
|
|
||||||
dist/
|
dist/
|
||||||
build/
|
build/
|
||||||
*.egg-info/
|
*.egg-info/
|
||||||
|
|
||||||
|
bazel-*
|
||||||
|
|
37
BUILD
Normal file
37
BUILD
Normal file
|
@ -0,0 +1,37 @@
|
||||||
|
load("@io_bazel_rules_docker//container:container.bzl", "container_push")
|
||||||
|
load("@rules_python//python:defs.bzl", "py_library", "py_test")
|
||||||
|
load("@my_deps//:requirements.bzl", "requirement")
|
||||||
|
|
||||||
|
py_library(
|
||||||
|
name = "shillerben-homepage",
|
||||||
|
srcs = ["my_homepage/__init__.py"],
|
||||||
|
data = glob(["my_homepage/templates/*"]),
|
||||||
|
deps = [
|
||||||
|
requirement("click"),
|
||||||
|
requirement("Flask"),
|
||||||
|
requirement("gunicorn"),
|
||||||
|
requirement("itsdangerous"),
|
||||||
|
requirement("Jinja2"),
|
||||||
|
requirement("MarkupSafe"),
|
||||||
|
requirement("Werkzeug"),
|
||||||
|
]
|
||||||
|
)
|
||||||
|
|
||||||
|
py_test(
|
||||||
|
name = "website_test",
|
||||||
|
main = "test_website.py",
|
||||||
|
srcs = ["tests/test_website.py"],
|
||||||
|
deps = [
|
||||||
|
":shillerben-homepage",
|
||||||
|
requirement("pytest"),
|
||||||
|
],
|
||||||
|
)
|
||||||
|
|
||||||
|
container_push(
|
||||||
|
name = "push-image",
|
||||||
|
image = ":shillerben-homepage",
|
||||||
|
format = "Docker",
|
||||||
|
registry = "docker.shillerben.com",
|
||||||
|
repository = "shillerben-homepage",
|
||||||
|
tag = "latest",
|
||||||
|
)
|
|
@ -1,4 +1,4 @@
|
||||||
FROM python:3.8
|
FROM python:3.10
|
||||||
|
|
||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
|
|
||||||
|
|
48
WORKSPACE
Normal file
48
WORKSPACE
Normal file
|
@ -0,0 +1,48 @@
|
||||||
|
#workspace("my-homepage")
|
||||||
|
|
||||||
|
load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
|
||||||
|
load("@rules_python//python:repositories.bzl", "python_register_toolchains")
|
||||||
|
load("@python310//:defs.bzl", "interpreter")
|
||||||
|
load("@rules_python//python:pip.bzl", "pip_install")
|
||||||
|
load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
|
||||||
|
load("@io_bazel_rules_docker//toolchains/docker:toolchain.bzl",
|
||||||
|
docker_toolchain_configure="toolchain_configure"
|
||||||
|
)
|
||||||
|
load(
|
||||||
|
"@io_bazel_rules_docker//repositories:repositories.bzl",
|
||||||
|
container_repositories = "repositories",
|
||||||
|
)
|
||||||
|
load("@io_bazel_rules_docker//repositories:deps.bzl", container_deps = "deps")
|
||||||
|
|
||||||
|
http_archive(
|
||||||
|
name = "rules_python",
|
||||||
|
sha256 = "b593d13bb43c94ce94b483c2858e53a9b811f6f10e1e0eedc61073bd90e58d9c",
|
||||||
|
strip_prefix = "rules_python-0.12.0",
|
||||||
|
url = "https://github.com/bazelbuild/rules_python/archive/refs/tags/0.12.0.tar.gz",
|
||||||
|
)
|
||||||
|
|
||||||
|
python_register_toolchains(
|
||||||
|
name = "python310",
|
||||||
|
python_version = "3.10.6",
|
||||||
|
)
|
||||||
|
|
||||||
|
pip_install(
|
||||||
|
name = "my_deps",
|
||||||
|
python_interpreter_target = interpreter,
|
||||||
|
requirements = "//:requirements.txt"
|
||||||
|
)
|
||||||
|
|
||||||
|
http_archive(
|
||||||
|
name = "io_bazel_rules_docker",
|
||||||
|
sha256 = "b1e80761a8a8243d03ebca8845e9cc1ba6c82ce7c5179ce2b295cd36f7e394bf",
|
||||||
|
urls = ["https://github.com/bazelbuild/rules_docker/releases/download/v0.25.0/rules_docker-v0.25.0.tar.gz"],
|
||||||
|
)
|
||||||
|
|
||||||
|
docker_toolchain_configure(
|
||||||
|
name = "docker_config",
|
||||||
|
client_config = ":.docker-config.json",
|
||||||
|
)
|
||||||
|
|
||||||
|
container_repositories()
|
||||||
|
|
||||||
|
container_deps()
|
|
@ -5,3 +5,4 @@ itsdangerous==1.1.0
|
||||||
Jinja2==2.11.2
|
Jinja2==2.11.2
|
||||||
MarkupSafe==1.1.1
|
MarkupSafe==1.1.1
|
||||||
Werkzeug==1.0.1
|
Werkzeug==1.0.1
|
||||||
|
pytest
|
||||||
|
|
Loading…
Reference in New Issue
Block a user