Skip to content

Migrate to hatch #56

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 17 commits into from
Jun 3, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
64 changes: 39 additions & 25 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,35 +8,49 @@ on:
branches:
- "main"
- "master"

jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
run:

- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
with:
python-version: "3.10"
runs-on: ${{ matrix.config.os }}

- name: Install dependencies
# https://docs.github.com/en/free-pro-team@latest/actions/guides/building-and-testing-python#installing-dependencies
# If installing a development version of constellation, use:
# - pip3 install git+https://github.com/reside-ic/constellation@reside-62#egg=constellation
run: |
python -m pip install --upgrade setuptools pip wheel
pip3 install pytest-cov pycodestyle codecov
pip3 install -r requirements.txt
name: ${{matrix.config.os }} (${{ matrix.config.py }})

strategy:
fail-fast: false
matrix:
config:
- {os: ubuntu-latest, py: '3.8'}
- {os: ubuntu-latest, py: '3.9'}
- {os: ubuntu-latest, py: '3.10'}
- {os: ubuntu-latest, py: '3.11'}
- {os: ubuntu-latest, py: '3.12'}

- name: Tests
steps:
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.config.py }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.config.py }}
- name: Pull containers
run: |
docker pull redis:5.0
docker pull vimc/orderly.server:master
docker pull vimc/orderly-web:master
docker pull vimc/orderly-web-proxy:master
docker pull vimc/orderly-web-css-generator:master
docker pull vimc/orderly-web-user-cli:master
docker pull mrcide/outpack.orderly:main
docker pull mrcide/outpack_server:main
docker pull mrcide/packit-db:main
docker pull mrcide/packit-api:main
docker pull mrcide/montagu-packit:main
- name: Install dependencies
run: |
pytest --cov=src
env:
python -m pip install --upgrade pip
pip install hatch
- name: Test
env:
VAULT_TEST_GITHUB_PAT: ${{ secrets.VAULT_TEST_GITHUB_PAT }}

- name: Lint
run: |
pycodestyle .

- name: Upload coverage to Codecov
uses: codecov/codecov-action@v1
hatch run cov-ci
2 changes: 1 addition & 1 deletion config/packit/orderly-web.yml
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ packit:
tag: main
app:
name: montagu-packit
tag: mrc-5140-trusted-headers
tag: main
db:
name: packit-db
tag: main
2 changes: 2 additions & 0 deletions orderly_web/__about__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
__version__ = "1.4.0"
__name__ = "orderly_web"
20 changes: 10 additions & 10 deletions orderly_web/constellation.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,16 +47,16 @@ def orderly_constellation(cfg):

def outpack_server_container(cfg):
name = cfg.containers["outpack-server"]
mounts = [constellation.ConstellationMount("outpack", "/outpack")]
mounts = [constellation.ConstellationVolumeMount("outpack", "/outpack")]
outpack_server = constellation.ConstellationContainer(
name, cfg.outpack_ref, mounts=mounts)
return outpack_server


def outpack_migrate_container(cfg):
name = cfg.containers["outpack-migrate"]
mounts = [constellation.ConstellationMount("outpack", "/outpack"),
constellation.ConstellationMount("orderly", "/orderly")]
mounts = [constellation.ConstellationVolumeMount("outpack", "/outpack"),
constellation.ConstellationVolumeMount("orderly", "/orderly")]
args = ["/orderly", "/outpack", "--minutes=5"]
outpack_migrate = constellation.ConstellationContainer(
name, cfg.outpack_migrate_ref, mounts=mounts, args=args)
Expand Down Expand Up @@ -103,7 +103,7 @@ def packit_container(cfg):

def redis_container(cfg):
redis_name = cfg.containers["redis"]
redis_mounts = [constellation.ConstellationMount("redis", "/data")]
redis_mounts = [constellation.ConstellationVolumeMount("redis", "/data")]
redis_args = ["--appendonly", "yes"]
redis = constellation.ConstellationContainer(
redis_name, cfg.redis_ref, mounts=redis_mounts, args=redis_args,
Expand All @@ -127,7 +127,7 @@ def redis_configure(container, cfg):
def orderly_container(cfg, redis_container):
orderly_name = cfg.containers["orderly"]
orderly_args = ["--port", "8321", "--go-signal", "/go_signal", "/orderly"]
orderly_mounts = [constellation.ConstellationMount("orderly", "/orderly")]
orderly_mounts = [constellation.ConstellationVolumeMount("orderly", "/orderly")]
ports = [8321] if cfg.orderly_expose else None
environment = orderly_env(cfg, redis_container)
orderly = constellation.ConstellationContainer(
Expand Down Expand Up @@ -211,7 +211,7 @@ def orderly_start(container):
def worker_container(cfg, redis_container):
worker_name = cfg.containers["orderly-worker"]
worker_args = ["--go-signal", "/go_signal"]
worker_mounts = [constellation.ConstellationMount("orderly", "/orderly")]
worker_mounts = [constellation.ConstellationVolumeMount("orderly", "/orderly")]
worker_entrypoint = "/usr/local/bin/orderly_worker"
environment = orderly_env(cfg, redis_container)
worker = constellation.ConstellationService(
Expand All @@ -234,12 +234,12 @@ def worker_start(container):

def web_container(cfg):
web_name = cfg.containers["web"]
web_mounts = [constellation.ConstellationMount("orderly", "/orderly")]
web_mounts = [constellation.ConstellationVolumeMount("orderly", "/orderly")]
if cfg.sass_variables is not None:
web_mounts.append(constellation.ConstellationMount(
web_mounts.append(constellation.ConstellationVolumeMount(
"css", "/static/public/css"))
if "documents" in cfg.volumes:
web_mounts.append(constellation.ConstellationMount(
web_mounts.append(constellation.ConstellationVolumeMount(
"documents", "/documents"))
if cfg.web_dev_mode:
web_ports = [(cfg.web_port, ("127.0.0.1", cfg.web_port))]
Expand Down Expand Up @@ -362,7 +362,7 @@ def proxy_container(cfg, web, packit_api=None, packit=None):
proxy_args = [cfg.proxy_hostname, str(cfg.proxy_port_http),
str(cfg.proxy_port_https), web_addr, packit_api_addr,
packit_addr]
proxy_mounts = [constellation.ConstellationMount(
proxy_mounts = [constellation.ConstellationVolumeMount(
"proxy_logs", "/var/log/nginx")]
proxy_ports = [cfg.proxy_port_http, cfg.proxy_port_https]
proxy = constellation.ConstellationContainer(
Expand Down
63 changes: 63 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
[build-system]
requires = ["hatchling"]
build-backend = "hatchling.build"

[project]
name = "orderly-web"
dynamic = ["version"]
description = "Deploy scripts for OrderlyWeb"
readme = "README.md"
license = "MIT"
authors = [
{ name = "Rich FitzJohn", email = "[email protected]" },
]
classifiers = [
"License :: OSI Approved :: MIT License",
"Operating System :: OS Independent",
"Programming Language :: Python :: 3",
]
dependencies = [
"constellation==1.4.0",
"docker",
"docopt",
"hvac",
"Pillow",
"pytest",
"pyyaml",
"vault_dev",
]

[project.scripts]
orderly-web = "orderly_web.cli:main"

[project.urls]
Homepage = "https://github.com/vimc/orderly-web-deploy"

[tool.hatch.version]
path = "orderly_web/__about__.py"

[tool.hatch.build.targets.sdist]
include = [
"/orderly_web",
]

[tool.hatch.envs.default]
dependencies = [
"coverage[toml]>=6.5",
"pytest",
"pytest-cov",
]

[tool.hatch.envs.default.scripts]
test = "pytest {args:test}"
test-cov = "pytest --cov --cov-report= --cov-config=pyproject.toml {args:test}"
cov-report = "coverage report --show-missing"
cov = [
"test-cov",
"cov-report",
]
cov-report-xml = "coverage xml"
cov-ci = [
"test-cov",
"cov-report-xml",
]
8 changes: 0 additions & 8 deletions requirements.txt

This file was deleted.

2 changes: 0 additions & 2 deletions setup.cfg

This file was deleted.

41 changes: 0 additions & 41 deletions setup.py

This file was deleted.