Compare commits
23 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 56fd761618 | |||
| 3989e281c0 | |||
| 90546b6c9a | |||
| 3f0bcd2b7f | |||
| f2fa2daaa8 | |||
| 00364114d5 | |||
| e3ac6344f6 | |||
| 92c1f29843 | |||
| d42a5422db | |||
| 85ca387877 | |||
| bb9a4c3977 | |||
| 761f5f562b | |||
| 10e48461d4 | |||
| d29c2c3a13 | |||
| 951d68f022 | |||
| c8b87561a8 | |||
| 6fce702820 | |||
| 6ed875ae81 | |||
| aa19085538 | |||
| fa2d96d58a | |||
| 9e72e8abdf | |||
| ab24bd8526 | |||
| fccdf64435 |
@@ -22,7 +22,7 @@ jobs:
|
|||||||
- name: Checkout repository
|
- name: Checkout repository
|
||||||
run: |
|
run: |
|
||||||
if [ ! -d .git ]; then
|
if [ ! -d .git ]; then
|
||||||
git clone --branch "${GITHUB_REF_NAME}" --depth=1 "http://gitea:3000/${GITHUB_REPOSITORY}.git" .
|
git clone --branch "${GITHUB_REF_NAME}" --depth=1 "http://172.21.0.1:3300/${GITHUB_REPOSITORY}.git" .
|
||||||
fi
|
fi
|
||||||
|
|
||||||
- name: Resolve image tags
|
- name: Resolve image tags
|
||||||
@@ -124,6 +124,10 @@ jobs:
|
|||||||
run: |
|
run: |
|
||||||
set -euo pipefail
|
set -euo pipefail
|
||||||
export DOCKER_API_VERSION=1.43
|
export DOCKER_API_VERSION=1.43
|
||||||
|
# Ensure .env exists (CI container may not have it mounted)
|
||||||
|
if [ ! -f /volume1/docker/claude-dev/.env ]; then
|
||||||
|
printf 'ANTHROPIC_API_KEY=ci\nANTHROPIC_BASE_URL=https://www.bytecatcode.org\nANTHROPIC_MODEL=ci\nANTHROPIC_SMALL_FAST_MODEL=ci\nCLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC=1\nCLAUDE_DEV_IMAGE_TAG=latest\n' > /volume1/docker/claude-dev/.env
|
||||||
|
fi
|
||||||
if ! docker compose -f /volume1/docker/claude-dev/docker-compose.yml config >/dev/null; then
|
if ! docker compose -f /volume1/docker/claude-dev/docker-compose.yml config >/dev/null; then
|
||||||
echo "❌ docker-compose config validation failed"
|
echo "❌ docker-compose config validation failed"
|
||||||
docker compose -f /volume1/docker/claude-dev/docker-compose.yml config
|
docker compose -f /volume1/docker/claude-dev/docker-compose.yml config
|
||||||
|
|||||||
+20
-18
@@ -14,7 +14,7 @@ concurrency:
|
|||||||
jobs:
|
jobs:
|
||||||
backend-tests:
|
backend-tests:
|
||||||
name: Backend Tests
|
name: Backend Tests
|
||||||
runs-on: ubuntu-latest
|
runs-on: vps
|
||||||
env:
|
env:
|
||||||
SECRET_KEY: test-secret-key-for-ci-environment-32chars-minimum
|
SECRET_KEY: test-secret-key-for-ci-environment-32chars-minimum
|
||||||
|
|
||||||
@@ -22,7 +22,7 @@ jobs:
|
|||||||
- name: Checkout repository
|
- name: Checkout repository
|
||||||
run: |
|
run: |
|
||||||
if [ ! -d .git ]; then
|
if [ ! -d .git ]; then
|
||||||
git clone --depth=1 "http://gitea:3000/${GITHUB_REPOSITORY}.git" .
|
git clone --depth=1 "http://100.78.131.124:3300/${GITHUB_REPOSITORY}.git" .
|
||||||
fi
|
fi
|
||||||
|
|
||||||
- name: Setup Python
|
- name: Setup Python
|
||||||
@@ -55,32 +55,32 @@ jobs:
|
|||||||
cd dashboard/backend
|
cd dashboard/backend
|
||||||
if [ "${{ steps.cache-python.outputs.cache-hit }}" = "true" ]; then
|
if [ "${{ steps.cache-python.outputs.cache-hit }}" = "true" ]; then
|
||||||
echo "Restoring venv from cache $CACHE_KEY..."
|
echo "Restoring venv from cache $CACHE_KEY..."
|
||||||
if cp -a $CACHE_DIR/venv . && [ -f venv/bin/activate ]; then
|
if cp -a $CACHE_DIR/venv . && [ -f venv/bin/activate ] && venv/bin/python -m pytest --version >/dev/null 2>&1; then
|
||||||
echo "Cache restored successfully"
|
echo "Cache restored successfully"
|
||||||
else
|
else
|
||||||
echo "Cache corrupted, installing fresh..."
|
echo "Cache corrupted, installing fresh..."
|
||||||
rm -rf venv
|
rm -rf venv
|
||||||
python3 -m venv venv
|
python3 -m venv venv
|
||||||
. venv/bin/activate
|
. venv/bin/activate
|
||||||
timeout 300 pip install --cache-dir=$PIP_CACHE_DIR --retries 3 --timeout 30 -r requirements.txt || \
|
timeout 600 pip install --cache-dir=$PIP_CACHE_DIR --retries 3 --timeout 30 -r requirements.txt || \
|
||||||
timeout 300 pip install --cache-dir=$PIP_CACHE_DIR --index-url https://pypi.tuna.tsinghua.edu.cn/simple --trusted-host pypi.tuna.tsinghua.edu.cn -r requirements.txt || \
|
timeout 600 pip install --cache-dir=$PIP_CACHE_DIR --index-url https://pypi.tuna.tsinghua.edu.cn/simple --trusted-host pypi.tuna.tsinghua.edu.cn -r requirements.txt || \
|
||||||
pip install -r requirements.txt
|
pip install -r requirements.txt
|
||||||
timeout 300 pip install --cache-dir=$PIP_CACHE_DIR --retries 3 --timeout 30 -r requirements-dev.txt || \
|
timeout 600 pip install --cache-dir=$PIP_CACHE_DIR --retries 3 --timeout 30 -r requirements-dev.txt || \
|
||||||
timeout 300 pip install --cache-dir=$PIP_CACHE_DIR --index-url https://pypi.tuna.tsinghua.edu.cn/simple --trusted-host pypi.tuna.tsinghua.edu.cn -r requirements-dev.txt || \
|
timeout 600 pip install --cache-dir=$PIP_CACHE_DIR --index-url https://pypi.tuna.tsinghua.edu.cn/simple --trusted-host pypi.tuna.tsinghua.edu.cn -r requirements-dev.txt || \
|
||||||
pip install -r requirements-dev.txt
|
pip install -r requirements-dev.txt
|
||||||
timeout 300 pip install --cache-dir=$PIP_CACHE_DIR pytest-timeout pytest-cov || pip install pytest-timeout pytest-cov
|
timeout 600 pip install --cache-dir=$PIP_CACHE_DIR pytest-timeout pytest-cov || pip install pytest-timeout pytest-cov
|
||||||
fi
|
fi
|
||||||
else
|
else
|
||||||
echo "Installing fresh dependencies..."
|
echo "Installing fresh dependencies..."
|
||||||
python3 -m venv venv
|
python3 -m venv venv
|
||||||
. venv/bin/activate
|
. venv/bin/activate
|
||||||
timeout 300 pip install --cache-dir=$PIP_CACHE_DIR --retries 3 --timeout 30 -r requirements.txt || \
|
timeout 600 pip install --cache-dir=$PIP_CACHE_DIR --retries 3 --timeout 30 -r requirements.txt || \
|
||||||
timeout 300 pip install --cache-dir=$PIP_CACHE_DIR --index-url https://pypi.tuna.tsinghua.edu.cn/simple --trusted-host pypi.tuna.tsinghua.edu.cn -r requirements.txt || \
|
timeout 600 pip install --cache-dir=$PIP_CACHE_DIR --index-url https://pypi.tuna.tsinghua.edu.cn/simple --trusted-host pypi.tuna.tsinghua.edu.cn -r requirements.txt || \
|
||||||
pip install -r requirements.txt
|
pip install -r requirements.txt
|
||||||
timeout 300 pip install --cache-dir=$PIP_CACHE_DIR --retries 3 --timeout 30 -r requirements-dev.txt || \
|
timeout 600 pip install --cache-dir=$PIP_CACHE_DIR --retries 3 --timeout 30 -r requirements-dev.txt || \
|
||||||
timeout 300 pip install --cache-dir=$PIP_CACHE_DIR --index-url https://pypi.tuna.tsinghua.edu.cn/simple --trusted-host pypi.tuna.tsinghua.edu.cn -r requirements-dev.txt || \
|
timeout 600 pip install --cache-dir=$PIP_CACHE_DIR --index-url https://pypi.tuna.tsinghua.edu.cn/simple --trusted-host pypi.tuna.tsinghua.edu.cn -r requirements-dev.txt || \
|
||||||
pip install -r requirements-dev.txt
|
pip install -r requirements-dev.txt
|
||||||
timeout 300 pip install --cache-dir=$PIP_CACHE_DIR pytest-timeout pytest-cov || pip install pytest-timeout pytest-cov
|
timeout 600 pip install --cache-dir=$PIP_CACHE_DIR pytest-timeout pytest-cov || pip install pytest-timeout pytest-cov
|
||||||
echo "Saving venv to cache $CACHE_KEY..."
|
echo "Saving venv to cache $CACHE_KEY..."
|
||||||
cp -a venv $CACHE_DIR/ || echo "Warning: cache save failed"
|
cp -a venv $CACHE_DIR/ || echo "Warning: cache save failed"
|
||||||
fi
|
fi
|
||||||
@@ -89,7 +89,7 @@ jobs:
|
|||||||
run: |
|
run: |
|
||||||
cd dashboard/backend
|
cd dashboard/backend
|
||||||
. venv/bin/activate
|
. venv/bin/activate
|
||||||
pytest tests/ -v --timeout=60 \
|
python -m pytest tests/ -v --timeout=60 \
|
||||||
--cov=. --cov-report=xml --cov-report=term \
|
--cov=. --cov-report=xml --cov-report=term \
|
||||||
--junit-xml=test-results.xml \
|
--junit-xml=test-results.xml \
|
||||||
--cov-fail-under=49
|
--cov-fail-under=49
|
||||||
@@ -102,13 +102,13 @@ jobs:
|
|||||||
|
|
||||||
frontend-tests:
|
frontend-tests:
|
||||||
name: Frontend Tests
|
name: Frontend Tests
|
||||||
runs-on: ubuntu-latest
|
runs-on: vps
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout repository
|
- name: Checkout repository
|
||||||
run: |
|
run: |
|
||||||
if [ ! -d .git ]; then
|
if [ ! -d .git ]; then
|
||||||
git clone --depth=1 "http://gitea:3000/${GITHUB_REPOSITORY}.git" .
|
git clone --depth=1 "http://100.78.131.124:3300/${GITHUB_REPOSITORY}.git" .
|
||||||
fi
|
fi
|
||||||
|
|
||||||
- name: Setup Node.js
|
- name: Setup Node.js
|
||||||
@@ -170,7 +170,7 @@ jobs:
|
|||||||
|
|
||||||
deploy:
|
deploy:
|
||||||
name: Deploy to Production
|
name: Deploy to Production
|
||||||
runs-on: ubuntu-latest
|
runs-on: nas
|
||||||
if: always()
|
if: always()
|
||||||
needs: [backend-tests, frontend-tests]
|
needs: [backend-tests, frontend-tests]
|
||||||
env:
|
env:
|
||||||
@@ -242,7 +242,9 @@ jobs:
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
- name: Sync runtime compose file
|
- name: Sync runtime compose file
|
||||||
run: cp dashboard/docker-compose.yml /nas-dashboard/docker-compose.yml
|
run: |
|
||||||
|
mkdir -p /nas-dashboard
|
||||||
|
cp dashboard/docker-compose.yml /nas-dashboard/docker-compose.yml
|
||||||
|
|
||||||
- name: Deploy and verify
|
- name: Deploy and verify
|
||||||
run: |
|
run: |
|
||||||
|
|||||||
@@ -7,9 +7,13 @@ services:
|
|||||||
stdin_open: true
|
stdin_open: true
|
||||||
tty: true
|
tty: true
|
||||||
working_dir: /repos/nas-tools
|
working_dir: /repos/nas-tools
|
||||||
|
env_file:
|
||||||
|
- /volume1/docker/claude-dev/.env
|
||||||
volumes:
|
volumes:
|
||||||
- /volume1/repos:/repos
|
- /volume1/repos:/repos
|
||||||
- /volume1/docker/claude-dev/claude-config:/root/.claude
|
- /volume1/docker/claude-dev/claude-config:/root/.claude
|
||||||
- /volume1/docker/claude-dev/claude-config/.claude.json:/root/.claude.json
|
- /volume1/docker/claude-dev/claude-config/.claude.json:/root/.claude.json
|
||||||
- /volume1/docker/claude-dev/gitea_token:/root/.gitea_token:ro
|
- /volume1/docker/claude-dev/gitea_token:/root/.gitea_token:ro
|
||||||
- /volume1/docker/claude-dev/bashrc:/root/.bashrc
|
- /volume1/docker/claude-dev/bashrc:/root/.bashrc
|
||||||
|
- /volume1:/volume1
|
||||||
|
- /:/nas-root
|
||||||
|
|||||||
Reference in New Issue
Block a user