|
1 | 1 | schemaVersion: v0.2 |
2 | 2 | prepare: |
3 | 3 | steps: |
4 | | - - name: install Codesphere cli tool |
5 | | - command: mkdir -p $HOME/.local/bin && wget -qO- |
6 | | - 'https://api.github.com/repos/codesphere-cloud/cs-go/releases/latest' | |
7 | | - grep linux_amd64 | grep browser_download_url | sed s/.*https/https/ | |
8 | | - sed s/\".*$// | xargs wget -O $HOME/.local/bin/cs && chmod +x |
9 | | - $HOME/.local/bin/cs |
10 | 4 | - name: install uv standalone version |
11 | | - command: curl -LsSf https://astral.sh/uv/install.sh | env |
12 | | - UV_INSTALL_DIR="$HOME/app" sh && chmod +x $HOME/app/uv |
13 | | - - name: copy template .env file |
14 | | - command: cp -n .env.sample .env |
15 | | - - name: "set ev vars " |
16 | | - command: . .env && cs set-env -w $WORKSPACE_ID -t $TEAM_ID --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 |
20 | | - UV_PYTHON_CACHE_DIR=$PWD/.codesphere-internal/.uv-python |
| 5 | + command: command -v uv >/dev/null 2>&1 || { curl -LsSf https://astral.sh/uv/install.sh |
| 6 | + | env UV_INSTALL_DIR="$HOME/app" sh && chmod +x $HOME/app/uv; } |
21 | 7 | - name: install frontend environment |
22 | | - command: . ./env && cd frontend && { [ ! -d ".venv" ] && uv venv; uv sync; } |
| 8 | + command: UV=$(command -v uv 2>/dev/null || echo $HOME/app/uv) && cd frontend |
| 9 | + && { [ ! -d ".venv" ] && UV_PYTHON_INSTALL_DIR=/home/user/app/.codesphere-internal/.uv-python-install UV_PYTHON_BIN_DIR=/home/user/app/.codesphere-internal/.uv-python-bin UV_CACHE_DIR=/home/user/app/.codesphere-internal/.uv UV_PYTHON_CACHE_DIR=/home/user/app/.codesphere-internal/.uv-python $UV venv; UV_PYTHON_INSTALL_DIR=/home/user/app/.codesphere-internal/.uv-python-install UV_PYTHON_BIN_DIR=/home/user/app/.codesphere-internal/.uv-python-bin UV_CACHE_DIR=/home/user/app/.codesphere-internal/.uv UV_PYTHON_CACHE_DIR=/home/user/app/.codesphere-internal/.uv-python $UV sync; } |
23 | 10 | - name: install backend environment |
24 | | - command: . ./env && cd backend && { [ ! -d ".venv" ] && uv venv; uv sync; } |
| 11 | + command: UV=$(command -v uv 2>/dev/null || echo $HOME/app/uv) && cd backend |
| 12 | + && { [ ! -d ".venv" ] && UV_PYTHON_INSTALL_DIR=/home/user/app/.codesphere-internal/.uv-python-install UV_PYTHON_BIN_DIR=/home/user/app/.codesphere-internal/.uv-python-bin UV_CACHE_DIR=/home/user/app/.codesphere-internal/.uv UV_PYTHON_CACHE_DIR=/home/user/app/.codesphere-internal/.uv-python $UV venv; UV_PYTHON_INSTALL_DIR=/home/user/app/.codesphere-internal/.uv-python-install UV_PYTHON_BIN_DIR=/home/user/app/.codesphere-internal/.uv-python-bin UV_CACHE_DIR=/home/user/app/.codesphere-internal/.uv UV_PYTHON_CACHE_DIR=/home/user/app/.codesphere-internal/.uv-python $UV sync; } |
25 | 13 | test: |
26 | 14 | steps: |
27 | 15 | - name: test frontend |
28 | | - command: . ./env && cd frontend && uv run pytest |
| 16 | + command: UV=$(command -v uv 2>/dev/null || echo $HOME/app/uv) && cd frontend && $UV run pytest |
29 | 17 | - name: test backend |
30 | | - command: ". ./env && cd backend && uv run pytest " |
| 18 | + command: UV=$(command -v uv 2>/dev/null || echo $HOME/app/uv) && cd backend && $UV run pytest |
31 | 19 | - name: security check frontend |
32 | | - command: '. ./env && cd frontend && uv run bandit -r . -c pyproject.toml |
33 | | - --format=custom --msg-template "{abspath}:{line}: {test_id}[{severity}]: |
34 | | - {msg}" -o bandit-results.txt' |
| 20 | + command: 'UV=$(command -v uv 2>/dev/null || echo $HOME/app/uv) && cd frontend |
| 21 | + && $UV run bandit -r . -c pyproject.toml --format=custom --msg-template |
| 22 | + "{abspath}:{line}: {test_id}[{severity}]: {msg}" -o bandit-results.txt' |
35 | 23 | - name: security check backend |
36 | | - command: '. ./env && cd backend && uv run bandit -r . -c pyproject.toml |
37 | | - --format=custom --msg-template "{abspath}:{line}: {test_id}[{severity}]: |
38 | | - {msg}" -o bandit-results.txt' |
| 24 | + command: 'UV=$(command -v uv 2>/dev/null || echo $HOME/app/uv) && cd backend |
| 25 | + && $UV run bandit -r . -c pyproject.toml --format=custom --msg-template |
| 26 | + "{abspath}:{line}: {test_id}[{severity}]: {msg}" -o bandit-results.txt' |
39 | 27 | run: |
40 | 28 | frontend: |
41 | 29 | steps: |
42 | 30 | - name: start frontend application |
43 | | - command: . ./env && cd frontend && uv run streamlit run --server.address 0.0.0.0 |
44 | | - --server.port 3000 main.py |
| 31 | + command: UV=$(command -v uv 2>/dev/null || echo $HOME/app/uv) && cd frontend |
| 32 | + && $UV run streamlit run --server.address 0.0.0.0 --server.port 3000 main.py |
45 | 33 | plan: 20 |
46 | 34 | replicas: 1 |
47 | 35 | isPublic: true |
48 | 36 | network: |
49 | 37 | path: / |
50 | 38 | stripPath: false |
| 39 | + env: |
| 40 | + UV_PYTHON_INSTALL_DIR: /home/user/app/.codesphere-internal/.uv-python-install |
| 41 | + UV_PYTHON_BIN_DIR: /home/user/app/.codesphere-internal/.uv-python-bin |
| 42 | + UV_CACHE_DIR: /home/user/app/.codesphere-internal/.uv |
| 43 | + UV_PYTHON_CACHE_DIR: /home/user/app/.codesphere-internal/.uv-python |
51 | 44 | backend: |
52 | 45 | steps: |
53 | 46 | - name: start backend application |
54 | | - command: . ./env && cd backend && uv run uvicorn app:app --reload --port 3000 |
55 | | - --host 0.0.0.0 |
| 47 | + command: UV=$(command -v uv 2>/dev/null || echo $HOME/app/uv) && cd backend |
| 48 | + && $UV run uvicorn app:app --reload --port 3000 --host 0.0.0.0 |
56 | 49 | plan: 20 |
57 | 50 | replicas: 1 |
58 | 51 | isPublic: false |
| 52 | + env: |
| 53 | + UV_PYTHON_INSTALL_DIR: /home/user/app/.codesphere-internal/.uv-python-install |
| 54 | + UV_PYTHON_BIN_DIR: /home/user/app/.codesphere-internal/.uv-python-bin |
| 55 | + UV_CACHE_DIR: /home/user/app/.codesphere-internal/.uv |
| 56 | + UV_PYTHON_CACHE_DIR: /home/user/app/.codesphere-internal/.uv-python |
59 | 57 | api-docs: |
60 | 58 | steps: |
61 | 59 | - name: deploy docs |
62 | | - command: . ./env && cd backend && uv run uvicorn doc:app_docs --host 0.0.0.0 |
63 | | - --port 3000 |
| 60 | + command: UV=$(command -v uv 2>/dev/null || echo $HOME/app/uv) && cd backend |
| 61 | + && $UV run uvicorn doc:app_docs --host 0.0.0.0 --port 3000 |
64 | 62 | plan: 20 |
65 | 63 | replicas: 1 |
66 | 64 | isPublic: true |
|
0 commit comments