Skip to content

Commit cafa7a4

Browse files
authored
Merge pull request #121 from AD-SDL/dev
Push v0.5.9 to Production
2 parents 151598e + 7cc8680 commit cafa7a4

File tree

151 files changed

+9217
-3032
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

151 files changed

+9217
-3032
lines changed

.dockerignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
**/node_modules

.github/workflows/docker-build.yml

Lines changed: 0 additions & 76 deletions
This file was deleted.

.github/workflows/docker-publish.yml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,11 @@ name: Docker Build and Publish
77

88
on:
99
push:
10-
branches: [ "main" ]
10+
branches: [ "*" ]
1111
# Publish semver tags as releases.
1212
tags: [ '*' ]
13+
schedule: # Run on Tuesday's at noon
14+
- cron: '0 12 * * 2'
1315

1416
env:
1517
# Use docker.io for Docker Hub if empty
@@ -21,7 +23,6 @@ env:
2123
jobs:
2224
build_and_publish:
2325

24-
environment: production
2526
runs-on: ubuntu-latest
2627
permissions:
2728
contents: read
@@ -37,10 +38,9 @@ jobs:
3738
- name: Set up Docker Buildx
3839
uses: docker/setup-buildx-action@v2
3940

40-
# Login against a Docker registry except on PR
41+
# Login against a Docker registry
4142
# https://github.com/docker/login-action
4243
- name: Log into registry ${{ env.REGISTRY }}
43-
if: github.event_name != 'pull_request'
4444
uses: docker/login-action@343f7c4344506bcbf9b4de18042ae17996df046d # v3.0.0
4545
with:
4646
registry: ${{ env.REGISTRY }}
@@ -61,7 +61,7 @@ jobs:
6161
type=ref,event=pr
6262
type=raw,value=latest,enable={{is_default_branch}}
6363
64-
# Build and push Docker image with Buildx (don't push on PR)
64+
# Build and push Docker image with Buildx
6565
# https://github.com/docker/build-push-action
6666
- name: Build and push Docker image
6767
id: build-and-push

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -301,3 +301,6 @@ test_experiment/
301301

302302
# Output data
303303
.wei/
304+
305+
#node modules
306+
**/node_modules

.pre-commit-config.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
repos:
22
- repo: https://github.com/pre-commit/pre-commit-hooks
3-
rev: v4.5.0
3+
rev: v4.6.0
44
hooks:
55
- id: check-yaml
66
- id: check-json
@@ -17,7 +17,7 @@ repos:
1717
- id: nbstripout
1818
- repo: https://github.com/astral-sh/ruff-pre-commit
1919
# Ruff version.
20-
rev: v0.3.2
20+
rev: v0.4.8
2121
hooks:
2222
# Run the linter.
2323
- id: ruff

Dockerfile

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ LABEL org.opencontainers.image.licenses=MIT
77
RUN set -eux; \
88
apt-get update; \
99
apt-get install -y gosu; \
10+
apt-get install -y npm; \
1011
rm -rf /var/lib/apt/lists/*
1112

1213
# User configuration
@@ -29,18 +30,24 @@ COPY requirements/dev.txt wei/requirements/dev.txt
2930
RUN --mount=type=cache,target=/root/.cache \
3031
pip install -r wei/requirements/requirements.txt
3132

32-
# Copy wei files
33-
COPY wei wei/wei
33+
# Install Node Dependencies first, for caching purposes
34+
COPY ./src/ui/package*.json ./
35+
RUN npm install
36+
37+
# Copy rest of wei files
38+
COPY src wei/src
3439
COPY tests wei/tests
3540
COPY pyproject.toml wei/pyproject.toml
3641
COPY README.md wei/README.md
3742
COPY scripts wei/scripts
3843

39-
4044
# Install dependencies and wei
4145
RUN --mount=type=cache,target=/root/.cache \
4246
pip install -e wei
4347

4448
COPY wei-entrypoint.sh /wei-entrypoint.sh
4549
RUN chmod +x /wei-entrypoint.sh
4650
ENTRYPOINT [ "/wei-entrypoint.sh" ]
51+
52+
# build ui for production with minification
53+
RUN npm run build --prefix wei/src/ui

Makefile

Lines changed: 6 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -3,41 +3,35 @@
33
################################################################################
44
.DEFAULT_GOAL := init
55

6-
.PHONY: init paths checks test clean
6+
.PHONY: init checks test clean
77

88
init: # Do the initial configuration of the project
99
@test -e .env || cp example.env .env
1010
ifeq ($(shell uname),Darwin)
11-
@sed -i '' 's/^PROJECT_DIR=.*/PROJECT_DIR=$(shell pwd | sed 's/\//\\\//g')/' .env
1211
@sed -i '' 's/^USER_ID=.*/USER_ID=1000/' .env
1312
@sed -i '' 's/^GROUP_ID=.*/GROUP_ID=1000/' .env
1413
else
15-
@sed -i 's/^PROJECT_DIR=.*/PROJECT_DIR=$(shell pwd | sed 's/\//\\\//g')/' .env
1614
@sed -i 's/^USER_ID=.*/USER_ID=$(shell id -u)/' .env
1715
@sed -i 's/^GROUP_ID=.*/GROUP_ID=$(shell id -g)/' .env
1816
endif
1917

2018

2119
.env: init
2220

23-
paths: .env # Create the necessary data directories
24-
@mkdir -p $(shell grep -E '^WEI_DATA_DIR=' .env | cut -d '=' -f 2)
25-
@mkdir -p $(shell grep -E '^REDIS_DIR=' .env | cut -d '=' -f 2)
26-
2721
checks: # Runs all the pre-commit checks
2822
@pre-commit install
2923
@pre-commit run --all-files || { echo "Checking fixes\n" ; pre-commit run --all-files; }
3024

31-
test: init .env paths # Runs all the tests
32-
@docker compose up --build -d
33-
@docker compose run test_app pytest -p no:cacheprovider wei
34-
@docker compose down
25+
test: init .env build # Runs all the tests
26+
@docker compose up -d
27+
@docker compose run wei_engine pytest -p no:cacheprovider wei
28+
@#docker compose down
3529

3630
clean:
3731
@rm .env
3832

3933
.PHONY += docs
40-
docs: wei docs/source # Builds the docs for wei
34+
docs: src docs/source # Builds the docs for wei
4135
cd docs && pdm run make clean html
4236

4337
build: build-python # Builds the project

compose.yaml

Lines changed: 22 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -1,55 +1,25 @@
11
services:
2-
###########
3-
# Dev App #
4-
###########
5-
test_app:
6-
container_name: test_app
7-
image: ${IMAGE_TEST}
8-
build:
9-
context: tests/
10-
dockerfile: ${DOCKERFILE_TEST}
11-
tags:
12-
- ${IMAGE_TEST}:latest
13-
- ${IMAGE_TEST}:dev
14-
volumes:
15-
- ${WORKCELLS_DIR}:/workcell_defs
16-
- ${WEI_DATA_DIR}:/home/app/.wei
17-
- diaspora_config:/home/app/.diaspora
18-
- ${PROJECT_DIR}:/home/app/wei # for development only
19-
env_file:
20-
- .env
21-
profiles:
22-
- test
23-
command: pytest -p no:cacheprovider wei
24-
depends_on:
25-
- synthesis
26-
- transfer
27-
- measure
28-
- wei_server
29-
- wei_engine
30-
- wei_redis
31-
322
###########
333
# Modules #
344
###########
355
synthesis:
36-
image: ${IMAGE_TEST}
6+
image: ${IMAGE}
377
container_name: synthesis
388
ports:
399
- 2000:2000
4010
command: 'python3 wei/tests/test_module/test_rest_node.py
4111
--port 2000
4212
--alias synthesis'
4313
transfer:
44-
image: ${IMAGE_TEST}
14+
image: ${IMAGE}
4515
container_name: transfer
4616
ports:
4717
- 2001:2001
4818
command: 'python3 wei/tests/test_module/test_rest_node.py
4919
--port 2001
5020
--alias transfer'
5121
measure:
52-
image: ${IMAGE_TEST}
22+
image: ${IMAGE}
5323
container_name: measure
5424
ports:
5525
- 2002:2002
@@ -72,26 +42,29 @@ services:
7242
ports:
7343
- 8000:8000
7444
volumes:
75-
- ${WORKCELLS_DIR}:/workcell_defs
76-
- ${WEI_DATA_DIR}:/home/app/.wei
7745
- diaspora_config:/home/app/.diaspora
78-
- ${PROJECT_DIR}:/home/app/wei # for development only
79-
env_file:
80-
- .env
46+
- ./tests/workcells:/workcell_defs
47+
- ~/.wei:/home/app/.wei
48+
49+
environment:
50+
- PYTHONUNBUFFERED=1 # Fix weird bug with empty logging
51+
- USER_ID=${USER_ID:-1000}
52+
- GROUP_ID=${GROUP_ID:-1000}
8153
command: python3 -m wei.server --workcell /workcell_defs/${WORKCELL_FILENAME}
8254
depends_on:
8355
- wei_redis
8456
wei_engine:
8557
image: ${IMAGE}
8658
container_name: wei_engine
8759
volumes:
88-
- ${WORKCELLS_DIR}:/workcell_defs
89-
- ${WEI_DATA_DIR}:/home/app/.wei
90-
- ${PROJECT_DIR}:/home/app/wei # for development only
60+
- diaspora_config:/home/app/.diaspora
61+
- ./tests/workcells:/workcell_defs
62+
- ~/.wei:/home/app/.wei
63+
- ./:/home/app/wei # for development only
9164
environment:
92-
- PYTHONUNBUFFERED=1 # Fix weird bug with empty logging
93-
env_file:
94-
- .env
65+
- PYTHONUNBUFFERED=1 # Fix weird bug with empty logging
66+
- USER_ID=${USER_ID:-1000}
67+
- GROUP_ID=${GROUP_ID:-1000}
9568
command: python3 -m wei.engine --workcell /workcell_defs/${WORKCELL_FILENAME}
9669
depends_on:
9770
- wei_redis
@@ -102,8 +75,11 @@ services:
10275
ports:
10376
- 6379:6379
10477
volumes:
105-
- ${REDIS_DIR}:/data
106-
command: redis-server --save 60 1 --loglevel warning
78+
- ~/.wei/redis:/data
79+
command: 'redis-server
80+
--save 600 1
81+
--loglevel warning
82+
--appendonly yes'
10783

10884
################
10985
# Data Storage #

docs/source/conf.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,9 @@
5151
"members": True,
5252
}
5353

54+
autodoc_pydantic_model_show_json_error_strategy = "warn"
55+
56+
5457
# Napoleon settings
5558
napoleon_google_docstring = True
5659
napoleon_numpy_docstring = True

docs/source/pages/_autosummary/wei.core.admin.rst

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,14 +14,11 @@ wei.core.admin
1414
.. autosummary::
1515

1616
send_cancel
17-
send_estop
18-
send_lock
1917
send_pause
2018
send_reset
2119
send_resume
2220
send_safety_stop
2321
send_shutdown
24-
send_unlock
2522

2623

2724

0 commit comments

Comments
 (0)