Skip to content
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
1 change: 1 addition & 0 deletions .github/workflows/preview-deployment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ jobs:
password: ${{ secrets.CODESPHERE_PASSWORD }}
team: ${{ secrets.CODESPHERE_TEAM }}
plan: Micro
onDemand: true
env: |
CS_TOKEN=${{ secrets.CODESPHERE_TOKEN }}
apiUrl: https://codesphere.com/
Expand Down
6 changes: 5 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
# python-demo test

before running any stage you will need to set up a 'CS_TOKEN' env var containing an Codesphere API key.
before running any stage you will need to set up a 'CS_TOKEN' env var containing an Codesphere API key

# open backend api docs

`/api/docs` or `/api/redoc`
58 changes: 58 additions & 0 deletions ci.Qa.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
schemaVersion: v0.2
prepare:
steps:
- name: install Codesphere cli tool
command: mkdir -p $HOME/.local/bin && wget -qO-
'https://api.github.com/repos/codesphere-cloud/cs-go/releases/latest' |
grep linux_amd64 | grep browser_download_url | sed s/.*https/https/ |
sed s/\".*$// | xargs wget -O $HOME/.local/bin/cs && chmod +x
$HOME/.local/bin/cs
- name: install uv standalone version
command: curl -LsSf https://astral.sh/uv/install.sh | env
UV_INSTALL_DIR="$HOME/app" sh && chmod +x $HOME/app/uv
- name: "set ev vars "
command: . .env && cs set-env -w $WORKSPACE_ID -t $TEAM_ID --env-var
UV_PYTHON_INSTALL_DIR=$PWD/.codesphere-internal/.uv-python-install
--env-var UV_PYTHON_BIN_DIR=$PWD/.codesphere-internal/.uv-python-bin
--env-var UV_CACHE_DIR=$PWD/.codesphere-internal/.uv --env-var
UV_PYTHON_CACHE_DIR=$PWD/.codesphere-internal/.uv-python
- name: install frontend environment
command: . ./env && cd frontend && { [ ! -d ".venv" ] && uv venv; uv sync
--no-dev; }
- name: install backend environment
command: . ./env && cd backend && { [ ! -d ".venv" ] && uv venv; uv sync
--no-dev; }
test:
steps: []
run:
frontend:
steps:
- name: start frontend application
command: ". ./env && cd frontend && uv run streamlit run main.py
--server.headless true --server.address 0.0.0.0 --server.port 3000
--browser.gatherUsageStats false --logger.level info "
plan: 20
replicas: 1
isPublic: true
network:
path: /
stripPath: false
backend:
steps:
- name: start backend application
command: . ./env && cd backend && uv run uvicorn app:app --port 3000 --host
0.0.0.0 --workers 2
plan: 20
replicas: 1
isPublic: false
api-docs:
steps:
- name: deploy docs
command: . ./env && cd backend && uv run uvicorn doc:app_docs --host 0.0.0.0
--port 3000 --workers 2
plan: 20
replicas: 1
isPublic: true
network:
path: /api
stripPath: false
69 changes: 69 additions & 0 deletions ci.dev.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
schemaVersion: v0.2
prepare:
steps:
- name: install Codesphere cli tool
command: mkdir -p $HOME/.local/bin && wget -qO-
'https://api.github.com/repos/codesphere-cloud/cs-go/releases/latest' |
grep linux_amd64 | grep browser_download_url | sed s/.*https/https/ |
sed s/\".*$// | xargs wget -O $HOME/.local/bin/cs && chmod +x
$HOME/.local/bin/cs
- name: install uv standalone version
command: curl -LsSf https://astral.sh/uv/install.sh | env
UV_INSTALL_DIR="$HOME/app" sh && chmod +x $HOME/app/uv
- name: copy template .env file
command: cp -n .env.sample .env
- name: "set ev vars "
command: . .env && cs set-env -w $WORKSPACE_ID -t $TEAM_ID --env-var
UV_PYTHON_INSTALL_DIR=$PWD/.codesphere-internal/.uv-python-install
--env-var UV_PYTHON_BIN_DIR=$PWD/.codesphere-internal/.uv-python-bin
--env-var UV_CACHE_DIR=$PWD/.codesphere-internal/.uv --env-var
UV_PYTHON_CACHE_DIR=$PWD/.codesphere-internal/.uv-python
- name: install frontend environment
command: . ./env && cd frontend && { [ ! -d ".venv" ] && uv venv; uv sync; }
- name: install backend environment
command: . ./env && cd backend && { [ ! -d ".venv" ] && uv venv; uv sync; }
test:
steps:
- name: test frontend
command: . ./env && cd frontend && uv run pytest
- name: test backend
command: ". ./env && cd backend && uv run pytest "
- name: security check frontend
command: '. ./env && cd frontend && uv run bandit -r . -c pyproject.toml
--format=custom --msg-template "{abspath}:{line}: {test_id}[{severity}]:
{msg}" -o bandit-results.txt'
- name: security check backend
command: '. ./env && cd backend && uv run bandit -r . -c pyproject.toml
--format=custom --msg-template "{abspath}:{line}: {test_id}[{severity}]:
{msg}" -o bandit-results.txt'
run:
frontend:
steps:
- name: start frontend application
command: . ./env && cd frontend && uv run streamlit run --server.address 0.0.0.0
--server.port 3000 main.py
plan: 20
replicas: 1
isPublic: true
network:
path: /
stripPath: false
backend:
steps:
- name: start backend application
command: . ./env && cd backend && uv run uvicorn app:app --reload --port 3000
--host 0.0.0.0
plan: 20
replicas: 1
isPublic: false
api-docs:
steps:
- name: deploy docs
command: . ./env && cd backend && uv run uvicorn doc:app_docs --host 0.0.0.0
--port 3000
plan: 20
replicas: 1
isPublic: true
network:
path: /api
stripPath: false
58 changes: 58 additions & 0 deletions ci.prod.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
schemaVersion: v0.2
prepare:
steps:
- name: install Codesphere cli tool
command: mkdir -p $HOME/.local/bin && wget -qO-
'https://api.github.com/repos/codesphere-cloud/cs-go/releases/latest' |
grep linux_amd64 | grep browser_download_url | sed s/.*https/https/ |
sed s/\".*$// | xargs wget -O $HOME/.local/bin/cs && chmod +x
$HOME/.local/bin/cs
- name: install uv standalone version
command: curl -LsSf https://astral.sh/uv/install.sh | env
UV_INSTALL_DIR="$HOME/app" sh && chmod +x $HOME/app/uv
- name: "set ev vars "
command: . .env && cs set-env -w $WORKSPACE_ID -t $TEAM_ID --env-var
UV_PYTHON_INSTALL_DIR=$PWD/.codesphere-internal/.uv-python-install
--env-var UV_PYTHON_BIN_DIR=$PWD/.codesphere-internal/.uv-python-bin
--env-var UV_CACHE_DIR=$PWD/.codesphere-internal/.uv --env-var
UV_PYTHON_CACHE_DIR=$PWD/.codesphere-internal/.uv-python
- name: install frontend environment
command: . ./env && cd frontend && { [ ! -d ".venv" ] && uv venv; uv sync
--no-dev; }
- name: install backend environment
command: . ./env && cd backend && { [ ! -d ".venv" ] && uv venv; uv sync
--no-dev; }
test:
steps: []
run:
frontend:
steps:
- name: start frontend application
command: ". ./env && cd frontend && uv run streamlit run main.py
--server.headless true --server.address 0.0.0.0 --server.port 3000
--browser.gatherUsageStats false --logger.level info "
plan: 8
replicas: 1
isPublic: true
network:
path: /
stripPath: false
backend:
steps:
- name: start backend application
command: . ./env && cd backend && uv run uvicorn app:app --port 3000 --host
0.0.0.0 --workers 2
plan: 8
replicas: 1
isPublic: false
api-docs:
steps:
- name: deploy docs
command: . ./env && cd backend && uv run uvicorn doc:app_docs --host 0.0.0.0
--port 3000 --workers 2
plan: 8
replicas: 1
isPublic: true
network:
path: /api
stripPath: false
33 changes: 11 additions & 22 deletions ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,38 +10,27 @@ prepare:
- name: install uv standalone version
command: curl -LsSf https://astral.sh/uv/install.sh | env
UV_INSTALL_DIR="$HOME/app" sh && chmod +x $HOME/app/uv
- name: copy template .env file
command: cp -n .env.sample .env
- name: "set ev vars "
command: . .env && cs set-env -w $WORKSPACE_ID -t $TEAM_ID --env-var
UV_PYTHON_INSTALL_DIR=$PWD/.codesphere-internal/.uv-python-install
--env-var UV_PYTHON_BIN_DIR=$PWD/.codesphere-internal/.uv-python-bin
--env-var UV_CACHE_DIR=$PWD/.codesphere-internal/.uv --env-var
UV_PYTHON_CACHE_DIR=$PWD/.codesphere-internal/.uv-python
- name: install frontend environment
command: . ./env && cd frontend && { [ ! -d ".venv" ] && uv venv; uv sync; }
command: . ./env && cd frontend && { [ ! -d ".venv" ] && uv venv; uv sync
--no-dev; }
- name: install backend environment
command: . ./env && cd backend && { [ ! -d ".venv" ] && uv venv; uv sync; }
command: . ./env && cd backend && { [ ! -d ".venv" ] && uv venv; uv sync
--no-dev; }
test:
steps:
- name: test frontend
command: . ./env && cd frontend && uv run pytest
- name: test backend
command: ". ./env && cd backend && uv run pytest "
- name: security check frontend
command: '. ./env && cd frontend && uv run bandit -r . -c pyproject.toml
--format=custom --msg-template "{abspath}:{line}: {test_id}[{severity}]:
{msg}" -o bandit-results.txt'
- name: security check backend
command: '. ./env && cd backend && uv run bandit -r . -c pyproject.toml
--format=custom --msg-template "{abspath}:{line}: {test_id}[{severity}]:
{msg}" -o bandit-results.txt'
steps: []
run:
frontend:
steps:
- name: start frontend application
command: . ./env && cd frontend && uv run streamlit run --server.address 0.0.0.0
--server.port 3000 main.py
command: ". ./env && cd frontend && uv run streamlit run main.py
--server.headless true --server.address 0.0.0.0 --server.port 3000
--browser.gatherUsageStats false --logger.level info "
plan: 8
replicas: 1
isPublic: true
Expand All @@ -51,16 +40,16 @@ run:
backend:
steps:
- name: start backend application
command: . ./env && cd backend && uv run uvicorn app:app --reload --port 3000
--host 0.0.0.0
command: . ./env && cd backend && uv run uvicorn app:app --port 3000 --host
0.0.0.0 --workers 2
plan: 8
replicas: 1
isPublic: false
api-docs:
steps:
- name: deploy docs
command: . ./env && cd backend && uv run uvicorn doc:app_docs --host 0.0.0.0
--port 3000
--port 3000 --workers 2
plan: 8
replicas: 1
isPublic: true
Expand Down