Skip to content

Commit 7b4d337

Browse files
committed
changes to ci.yml
1 parent 38e2a45 commit 7b4d337

15 files changed

Lines changed: 87 additions & 21 deletions

.env.sample

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
# set API TOKEN so that the cli is authorized to use the public api
2-
CS_TOKEN=
3-
TEAM_ID=
2+
export CS_TOKEN=
3+
export TEAM_ID=

.gitignore

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
11
.env
2+
env
3+
env.fish
24

35
.github/*
6+
7+
uv
8+
uvx

backend/.gitignore

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,7 @@ coverage.xml
33
pytest-coverage.txt
44
.coverage
55

6-
__pycache__/*
6+
__pycache__/*
7+
tests/__pycache__/*
8+
9+
bandit-results.txt

backend/pyproject.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ dependencies = [
99
"numpy>=2.3.0",
1010
"pandas>=2.3.0",
1111
"pytest-cov>=6.1.1",
12+
"pytest-profiling>=1.8.1",
1213
]
1314

1415
[dependency-groups]
-7.93 KB
Binary file not shown.

backend/tests/conftest.py

Whitespace-only changes.

backend/uv.lock

Lines changed: 25 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

ci.yml

Lines changed: 19 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -9,36 +9,38 @@ prepare:
99
$HOME/.local/bin/cs
1010
- name: install uv standalone version
1111
command: curl -LsSf https://astral.sh/uv/install.sh | env
12-
UV_INSTALL_DIR="$HOME/.local/bin/uv" sh && chmod +x $HOME/.local/bin/uv
12+
UV_INSTALL_DIR="$HOME/app" sh && chmod +x $HOME/app/uv
1313
- name: copy template .env file
1414
command: cp -n .env.sample .env
1515
- name: "set ev vars "
1616
command: . .env && cs set-env -w $WORKSPACE_ID -t $TEAM_ID --env-var
17-
UV_CACHE_DIR=$PWD/.codesphere-internal/.uv --env-var
17+
UV_PYTHON_INSTALL_DIR=$PWD/.codesphere-internal/.uv-python-install
18+
--env-var UV_PYTHON_BIN_DIR=$PWD/.codesphere-internal/.uv-python-bin
19+
--env-var UV_CACHE_DIR=$PWD/.codesphere-internal/.uv --env-var
1820
UV_PYTHON_CACHE_DIR=$PWD/.codesphere-internal/.uv-python
1921
- name: install frontend environment
20-
command: cd frontend && uv venv && uv sync
22+
command: cd frontend && { [ ! -d ".venv" ] && uv venv; uv sync; }
2123
- name: install backend environment
22-
command: "cd backend && uv venv && uv sync "
24+
command: cd backend && { [ ! -d ".venv" ] && uv venv; uv sync; }
2325
test:
2426
steps:
2527
- name: test frontend
26-
command: cd frontend && uv run pytest --junitxml=junit/test-results.xml
27-
--cov-report=xml --cov-report=html --cov=. | tee pytest-coverage.txt
28+
command: cd frontend && uv run pytest
2829
- name: test backend
29-
command: cd backend && uv run pytest --junitxml=junit/test-results.xml
30-
--cov-report=xml --cov-report=html --cov=. | tee pytest-coverage.txt
30+
command: "cd backend && uv run pytest "
3131
- name: security check frontend
32-
command: 'bandit -r . -c pyproject.toml --format=custom --msg-template
33-
"{abspath}:{line}: {test_id}[{severity}]: {msg}" -o bandit-results.txt'
32+
command: 'cd frontend && uv run bandit -r . -c pyproject.toml --format=custom
33+
--msg-template "{abspath}:{line}: {test_id}[{severity}]: {msg}" -o
34+
bandit-results.txt'
3435
- name: security check backend
35-
command: 'bandit -r . -c pyproject.toml --format=custom --msg-template
36-
"{abspath}:{line}: {test_id}[{severity}]: {msg}" -o bandit-results.txt'
36+
command: 'cd backend && uv run bandit -r . -c pyproject.toml --format=custom
37+
--msg-template "{abspath}:{line}: {test_id}[{severity}]: {msg}" -o
38+
bandit-results.txt'
3739
run:
3840
frontend:
3941
steps:
4042
- name: start frontend application
41-
command: cd frontend && uv run streamlit run --server.address 0.0.0.0
43+
command: . ./env && cd frontend && uv run streamlit run --server.address 0.0.0.0
4244
--server.port 3000 main.py
4345
plan: 8
4446
replicas: 1
@@ -49,15 +51,16 @@ run:
4951
backend:
5052
steps:
5153
- name: start backend application
52-
command: cd backend && uv run uvicorn app:app --reload --port 3000 --host
53-
0.0.0.0
54+
command: . ./env && cd backend && uv run uvicorn app:app --reload --port 3000
55+
--host 0.0.0.0
5456
plan: 8
5557
replicas: 1
5658
isPublic: false
5759
api-docs:
5860
steps:
5961
- name: deploy docs
60-
command: cd backend && uv run uvicorn doc:app_docs --host 0.0.0.0 --port 3000
62+
command: . ./env && cd backend && uv run uvicorn doc:app_docs --host 0.0.0.0
63+
--port 3000
6164
plan: 8
6265
replicas: 1
6366
isPublic: true

frontend/.gitignore

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,7 @@ coverage.xml
33
pytest-coverage.txt
44
.coverage
55

6-
__pycache__/*
6+
__pycache__/*
7+
tests/__pycache__/*
8+
9+
bandit-results.txt

frontend/main.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131
@st.cache_data
3232
def fetch_data(url: str, points: int):
3333
try:
34-
response = requests.get(url, params={"points": points})
34+
response = requests.get(url, params={"points": points}, timeout=3)
3535
response.raise_for_status()
3636

3737
data = response.json()

0 commit comments

Comments
 (0)