Skip to content

Allow creation of executable binary combined frontend/backend #38

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 111 commits into from
May 29, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
111 commits
Select commit Hold shift + click to select a range
6e4bc50
add question
ejfine May 27, 2025
e1a1244
tests
ejfine May 27, 2025
809a55f
spec
ejfine May 27, 2025
361e29c
spell
ejfine May 27, 2025
252e857
jinja
ejfine May 27, 2025
c9d569c
Move entrypoint
ejfine May 27, 2025
652091b
fix jinja
ejfine May 27, 2025
1bec4bd
add init
ejfine May 27, 2025
2aee808
enable shared
ejfine May 27, 2025
68402e4
update docker
ejfine May 27, 2025
e60572c
constants
ejfine May 27, 2025
6771359
more constants
ejfine May 27, 2025
ac1d141
more constants
ejfine May 27, 2025
e34bbf1
cli
ejfine May 27, 2025
6735b1c
raw
ejfine May 27, 2025
b7868a0
More spec
ejfine May 27, 2025
8540011
logger
ejfine May 27, 2025
2aecf30
ignore
ejfine May 27, 2025
9226485
more static
ejfine May 27, 2025
dd4a27d
whiespace
ejfine May 27, 2025
e6f08cd
put graphql under API heading
ejfine May 27, 2025
6c9a35f
spec
ejfine May 27, 2025
7d18a13
uvocirn launch
ejfine May 27, 2025
b359135
format
ejfine May 27, 2025
091c6dd
whitespace
ejfine May 27, 2025
b3b8bc4
swagger
ejfine May 27, 2025
9af38b5
import
ejfine May 27, 2025
f4d51a1
whitespace
ejfine May 27, 2025
99f1d47
field
ejfine May 27, 2025
496a38e
conditional
ejfine May 27, 2025
43edadf
move mounte
ejfine May 27, 2025
75210f0
version
ejfine May 27, 2025
1282f80
docker
ejfine May 27, 2025
8499b0d
favicon
ejfine May 27, 2025
faee695
not
ejfine May 27, 2025
545104c
more not
ejfine May 27, 2025
c130f16
mock
ejfine May 27, 2025
fa16e94
swagger test
ejfine May 27, 2025
1cf27e1
tests
ejfine May 27, 2025
e422b2b
ruff
ejfine May 27, 2025
c43fb60
lower
ejfine May 27, 2025
d0792db
api route
ejfine May 27, 2025
f896650
more graphql
ejfine May 27, 2025
06c7716
bump timeout
ejfine May 27, 2025
e99c4cd
runtime config
ejfine May 27, 2025
1a18098
Docker
ejfine May 27, 2025
fd49c2a
expose
ejfine May 27, 2025
ac60b2b
comment
ejfine May 27, 2025
bb0818b
oquote
ejfine May 27, 2025
8eeb0a9
favicon
ejfine May 27, 2025
e44cfb5
favigone
ejfine May 27, 2025
d334b35
build ba
ejfine May 27, 2025
465f8c7
new build
ejfine May 27, 2025
5c63760
docker
ejfine May 27, 2025
e416b07
frontend ci
ejfine May 27, 2025
9fd0469
raw
ejfine May 27, 2025
17759f2
more if
ejfine May 27, 2025
bff4ec6
more leS
ejfine May 27, 2025
15ea47a
artifacts
ejfine May 27, 2025
e92dc14
windows
ejfine May 27, 2025
137108b
ls
ejfine May 27, 2025
c3f2e4b
debug mo
ejfine May 27, 2025
714a99a
artif
ejfine May 27, 2025
b075e87
raw
ejfine May 27, 2025
529cee7
rename testing
ejfine May 28, 2025
92a5411
Split tests
ejfine May 28, 2025
ae94545
dockerignore
ejfine May 28, 2025
588ef11
More stop time
ejfine May 28, 2025
a7f9858
fix windows spaceing
ejfine May 28, 2025
f8478e7
formatting
ejfine May 28, 2025
c9df3f3
more CI
ejfine May 28, 2025
df220d5
add shutdown route
ejfine May 28, 2025
d81203d
hack windows
ejfine May 28, 2025
281cb9b
hack windows
ejfine May 28, 2025
71f2e1d
favicon path
ejfine May 28, 2025
bd59181
add playwright
ejfine May 28, 2025
96e5a10
package
ejfine May 28, 2025
63c6330
quotes
ejfine May 28, 2025
930bf74
dash
ejfine May 28, 2025
f800016
fallback
ejfine May 28, 2025
82a8459
new path
ejfine May 28, 2025
b6de107
update app
ejfine May 28, 2025
9abe1a8
app runer
ejfine May 28, 2025
cbecf26
app
ejfine May 28, 2025
a40a391
fix ci
ejfine May 28, 2025
17d6351
double ci
ejfine May 28, 2025
3a4874a
PR comments
ejfine May 28, 2025
65fff28
127
ejfine May 28, 2025
1646c14
add to generate
ejfine May 28, 2025
778ca2d
all host
ejfine May 28, 2025
2926837
renmae
ejfine May 28, 2025
cacc608
logiNG
ejfine May 28, 2025
206c528
more logging
ejfine May 28, 2025
808edef
More file checks
ejfine May 28, 2025
684de4a
error no file
ejfine May 28, 2025
ded53b7
Tar
ejfine May 28, 2025
efbcdf8
ci fix
ejfine May 28, 2025
fd45320
fix ci
ejfine May 28, 2025
a1712e8
copier
ejfine May 28, 2025
ae3476c
ci
ejfine May 28, 2025
3cb7c1e
dot-env
ejfine May 28, 2025
526879e
copier taol
ejfine May 29, 2025
7beb936
sntax
ejfine May 29, 2025
ddf4df9
More updates
ejfine May 29, 2025
5555ca7
fi xsync
ejfine May 29, 2025
4fbea9b
coiper
ejfine May 29, 2025
df56d6e
new dotenv
ejfine May 29, 2025
c47f7d2
copier devcon
ejfine May 29, 2025
f36e4e5
del sh
ejfine May 29, 2025
a859ab4
whitespace
ejfine May 29, 2025
94e69ab
tag
ejfine May 29, 2025
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
2 changes: 1 addition & 1 deletion .copier-answers.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Changes here will be overwritten by Copier
_commit: v0.0.48
_commit: v0.0.49
_src_path: gh:LabAutomationAndScreening/copier-base-template.git
description: A web app that is hosted within a local intranet. Nuxt frontend, python
backend, docker-compose
Expand Down
2 changes: 1 addition & 1 deletion .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
Expand Up @@ -61,5 +61,5 @@
"initializeCommand": "sh .devcontainer/initialize-command.sh",
"onCreateCommand": "sh .devcontainer/on-create-command.sh",
"postStartCommand": "sh .devcontainer/post-start-command.sh"
// Devcontainer context hash (do not manually edit this, it's managed by a pre-commit hook): e620b37a # spellchecker:disable-line
// Devcontainer context hash (do not manually edit this, it's managed by a pre-commit hook): c4f0cce0 # spellchecker:disable-line
}
7 changes: 7 additions & 0 deletions .devcontainer/envs.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
[
{
"description": "main",
"relative_directory": ".",
"package_manager": "uv"
}
]
114 changes: 114 additions & 0 deletions .devcontainer/install-ci-tooling.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,114 @@
import argparse
import os
import platform
import shutil
import subprocess
import sys

UV_VERSION = "0.7.8"
PNPM_VERSION = "10.11.0"
COPIER_VERSION = "9.7.1"
COPIER_TEMPLATES_EXTENSION_VERSION = "0.3.1"
PRE_COMMIT_VERSION = "4.2.0"
GITHUB_WINDOWS_RUNNER_BIN_PATH = r"C:\Users\runneradmin\.local\bin"
parser = argparse.ArgumentParser(description="Install CI tooling for the repo")
_ = parser.add_argument(
"--no-python",
default=False,
action="store_true",
help="Do not process any environments using python package managers",
)
_ = parser.add_argument(
"--python-version",
default=f"{sys.version_info.major}.{sys.version_info.minor}.{sys.version_info.micro}",
type=str,
help="What version to install.",
)
_ = parser.add_argument(
"--no-node", action="store_true", default=False, help="Do not process any environments using node package managers"
)


def main():
args = parser.parse_args(sys.argv[1:])
is_windows = platform.system() == "Windows"
uv_env = dict(os.environ)
uv_env.update({"UV_PYTHON_PREFERENCE": "only-system", "UV_PYTHON": args.python_version})
uv_path = ((GITHUB_WINDOWS_RUNNER_BIN_PATH + "\\") if is_windows else "") + "uv"
if is_windows:
pwsh = shutil.which("pwsh") or shutil.which("powershell")
if not pwsh:
raise FileNotFoundError("Neither 'pwsh' nor 'powershell' found on PATH")
if not args.no_python:
if is_windows:
uv_env.update({"PATH": rf"{GITHUB_WINDOWS_RUNNER_BIN_PATH};{uv_env['PATH']}"})
# invoke installer in a pwsh process
_ = subprocess.run(
[
pwsh, # type: ignore[reportPossiblyUnboundVariable] # this matches the conditional above that defines pwsh
"-NoProfile",
"-NonInteractive",
"-Command",
f"irm https://astral.sh/uv/{UV_VERSION}/install.ps1 | iex",
],
check=True,
env=uv_env,
)
else:
_ = subprocess.run(
f"curl -fsSL https://astral.sh/uv/{UV_VERSION}/install.sh | sh",
check=True,
shell=True,
env=uv_env,
)
# TODO: add uv autocompletion to the shell https://docs.astral.sh/uv/getting-started/installation/#shell-autocompletion
_ = subprocess.run(
[
uv_path,
"tool",
"install",
f"copier=={COPIER_VERSION}",
"--with",
f"copier-templates-extensions=={COPIER_TEMPLATES_EXTENSION_VERSION}",
],
check=True,
env=uv_env,
)
_ = subprocess.run(
[
uv_path,
"tool",
"install",
f"pre-commit=={PRE_COMMIT_VERSION}",
],
check=True,
env=uv_env,
)
_ = subprocess.run(
[
uv_path,
"tool",
"list",
],
check=True,
env=uv_env,
)
if not args.no_node:
pnpm_install_sequence = ["npm -v", f"npm install -g pnpm@{PNPM_VERSION}", "pnpm -v"]
for cmd in pnpm_install_sequence:
cmd = (
[
pwsh, # type: ignore[reportPossiblyUnboundVariable] # this matches the conditional above that defines pwsh
"-NoProfile",
"-NonInteractive",
"-Command",
cmd,
]
if is_windows
else [cmd]
)
_ = subprocess.run(cmd, shell=True, check=True)


if __name__ == "__main__":
main()
29 changes: 0 additions & 29 deletions .devcontainer/install-ci-tooling.sh

This file was deleted.

120 changes: 120 additions & 0 deletions .devcontainer/manual-setup-deps.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,120 @@
import argparse
import enum
import json
import os
import platform
import shutil
import subprocess
import sys
from pathlib import Path
from typing import Any

REPO_ROOT_DIR = Path(__file__).parent.parent.resolve()
ENVS_CONFIG = REPO_ROOT_DIR / ".devcontainer" / "envs.json"
parser = argparse.ArgumentParser(description="Manual setup for dependencies in the repo")
_ = parser.add_argument(
"--python-version",
type=str,
default=f"{sys.version_info.major}.{sys.version_info.minor}.{sys.version_info.micro}",
help="What version to install.",
)
_ = parser.add_argument("--skip-check-lock", action="store_true", default=False, help="Skip the lock file check step")
_ = parser.add_argument(
"--optionally-check-lock", action="store_true", default=False, help="Check the lock file IFF it exists"
)
_ = parser.add_argument(
"--no-python",
action="store_true",
default=False,
help="Do not process any environments using python package managers",
)
_ = parser.add_argument(
"--no-node", action="store_true", default=False, help="Do not process any environments using node package managers"
)


class PackageManager(str, enum.Enum):
UV = "uv"
PNPM = "pnpm"


class EnvConfig:
def __init__(self, json_dict: dict[str, Any]):
super().__init__()
self.package_manager = PackageManager(json_dict["package_manager"])
self.path = REPO_ROOT_DIR
if "relative_directory" in json_dict:
self.path = REPO_ROOT_DIR / json_dict["relative_directory"]
if self.package_manager == PackageManager.UV:
self.lock_file = self.path / "uv.lock"
elif self.package_manager == PackageManager.PNPM:
self.lock_file = self.path / "pnpm-lock.yaml"
else:
raise NotImplementedError(f"Package manager {self.package_manager} is not supported")


def main():
args = parser.parse_args(sys.argv[1:])
is_windows = platform.system() == "Windows"
uv_env = dict(os.environ)
uv_env.update({"UV_PYTHON_PREFERENCE": "only-system", "UV_PYTHON": args.python_version})
skip_check_lock = args.skip_check_lock
if skip_check_lock and args.optionally_check_lock:
print("Cannot skip and optionally check the lock file at the same time.")
sys.exit(1)

with ENVS_CONFIG.open("r") as f:
envs = json.load(f)

for env_dict in envs:
env = EnvConfig(env_dict)
if args.no_python and env.package_manager == PackageManager.UV:
print(f"Skipping environment {env.path} as it uses a Python package manager and --no-python is set")
continue
if args.no_node and env.package_manager == PackageManager.PNPM:
print(f"Skipping environment {env.path} as it uses a Node package manager and --no-node is set")
continue
env_skip_check_lock = skip_check_lock
if args.optionally_check_lock and env.lock_file.exists():
env_skip_check_lock = False
if not env_skip_check_lock:
if env.package_manager == PackageManager.UV:
_ = subprocess.run(["uv", "lock", "--check", "--directory", str(env.path)], check=True, env=uv_env)
elif env.package_manager == PackageManager.PNPM:
pass # doesn't seem to be a way to do this https://github.com/orgs/pnpm/discussions/3202
else:
raise NotImplementedError(f"Package manager {env.package_manager} does not support lock file checking")
if env.package_manager == PackageManager.UV:
sync_command = ["uv", "sync", "--directory", str(env.path)]
if not env_skip_check_lock:
sync_command.append("--frozen")
_ = subprocess.run(
sync_command,
check=True,
env=uv_env,
)
elif env.package_manager == PackageManager.PNPM:
pnpm_command = ["pnpm", "install", "--dir", str(env.path)]
if not env_skip_check_lock:
pnpm_command.append("--frozen-lockfile")
if is_windows:
pwsh = shutil.which("pwsh") or shutil.which("powershell")
if not pwsh:
raise FileNotFoundError("Neither 'pwsh' nor 'powershell' found on PATH")
pnpm_command = [
pwsh,
"-NoProfile",
"-NonInteractive",
"-Command",
" ".join(pnpm_command),
]
_ = subprocess.run(
pnpm_command,
check=True,
)
else:
raise NotImplementedError(f"Package manager {env.package_manager} is not supported for installation")


if __name__ == "__main__":
main()
2 changes: 1 addition & 1 deletion .devcontainer/on-create-command-boilerplate.sh
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/bin/bash
set -ex

sh .devcontainer/install-ci-tooling.sh
python .devcontainer/install-ci-tooling.py

git config --global --add --bool push.autoSetupRemote true
git config --local core.symlinks true
Expand Down
2 changes: 1 addition & 1 deletion .devcontainer/on-create-command.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,4 @@ sh .devcontainer/on-create-command-boilerplate.sh

pre-commit install --install-hooks

sh .devcontainer/manual-setup-deps.sh --optionally-lock
python .devcontainer/manual-setup-deps.py --optionally-check-lock
Original file line number Diff line number Diff line change
@@ -1,9 +1,16 @@
name: Install requirements
description: Setup python, and install dependencies using uv
description: Setup Python and/or Node, and install dependencies based on the devcontainer specification
inputs:
python-version:
type: string
description: Python version to install
required: false # if this is set, then assume you want python dependencies installed
default: 'notUsing'
node-version:
type: string
description: Node version to install
required: false # if this is set, then assume you want node dependencies installed
default: 'notUsing'
install-deps:
required: false
default: true
Expand Down Expand Up @@ -40,18 +47,20 @@ runs:
shell: bash

- name: Setup python
if: ${{ inputs.python-version != 'notUsing' }}
uses: actions/[email protected]
with:
python-version: ${{ env.PYTHON_VERSION }}

- name: Install Tooling (Linux)
if: runner.os == 'Linux'
run: sh .devcontainer/install-ci-tooling.sh ${{ env.PYTHON_VERSION }}
shell: bash
- name: Setup node
if: ${{ inputs.node-version != 'notUsing' }}
uses: actions/[email protected]
with:
node-version: ${{ inputs.node-version }}

- name: Install Tooling (Windows)
if: runner.os == 'Windows'
run: .github/actions/install_deps_uv/install-ci-tooling.ps1 ${{ env.PYTHON_VERSION }}
- name: Install tooling
# the funky syntax is github action ternary
run: python .devcontainer/install-ci-tooling.py ${{ inputs.python-version == 'notUsing' && '--no-python' || '' }} ${{ inputs.node-version == 'notUsing' && '--no-node' || '' }}
shell: pwsh

- name: OIDC Auth for CodeArtifact
Expand All @@ -61,13 +70,8 @@ runs:
role-to-assume: arn:aws:iam::${{ inputs.code-artifact-auth-role-account-id }}:role/${{ inputs.code-artifact-auth-role-name }}
aws-region: ${{ inputs.code-artifact-auth-region }}

- name: Install Dependencies (Linux)
if: ${{ inputs.install-deps && runner.os == 'Linux' }}
run: |
sh .devcontainer/manual-setup-deps.sh ${{ env.PYTHON_VERSION }}
shell: bash

- name: Install Dependencies (Windows)
if: ${{ inputs.install-deps && runner.os == 'Windows' }}
run: .github/actions/install_deps_uv/manual-setup-deps.ps1 ${{ env.PYTHON_VERSION }}
- name: Install dependencies
# the funky syntax is github action ternary
if: ${{ inputs.install-deps }}
run: python .devcontainer/manual-setup-deps.py ${{ inputs.python-version == 'notUsing' && '--no-python' || '' }} ${{ inputs.node-version == 'notUsing' && '--no-node' || '' }}
shell: pwsh
31 changes: 0 additions & 31 deletions .github/actions/install_deps_uv/install-ci-tooling.ps1

This file was deleted.

Loading