diff --git a/.gitea/workflows/deploy-dev.yml b/.gitea/workflows/deploy-dev.yml index 701d1c6..144e7c2 100644 --- a/.gitea/workflows/deploy-dev.yml +++ b/.gitea/workflows/deploy-dev.yml @@ -61,17 +61,25 @@ jobs: rm -rf venv python3 -m venv venv . venv/bin/activate - pip install --cache-dir=$PIP_CACHE_DIR -r requirements.txt || pip install -r requirements.txt - pip install --cache-dir=$PIP_CACHE_DIR -r requirements-dev.txt || pip install -r requirements-dev.txt - pip install --cache-dir=$PIP_CACHE_DIR pytest-timeout || pip install pytest-timeout + timeout 300 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 || \ + pip install -r requirements.txt + timeout 300 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 || \ + pip install -r requirements-dev.txt + timeout 300 pip install --cache-dir=$PIP_CACHE_DIR pytest-timeout || pip install pytest-timeout fi else echo "Installing fresh dependencies..." python3 -m venv venv . venv/bin/activate - pip install --cache-dir=$PIP_CACHE_DIR -r requirements.txt || pip install -r requirements.txt - pip install --cache-dir=$PIP_CACHE_DIR -r requirements-dev.txt || pip install -r requirements-dev.txt - pip install --cache-dir=$PIP_CACHE_DIR pytest-timeout || pip install pytest-timeout + timeout 300 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 || \ + pip install -r requirements.txt + timeout 300 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 || \ + pip install -r requirements-dev.txt + timeout 300 pip install --cache-dir=$PIP_CACHE_DIR pytest-timeout || pip install pytest-timeout echo "Saving venv to cache $CACHE_KEY..." cp -a venv $CACHE_DIR/ || echo "Warning: cache save failed" fi diff --git a/.gitea/workflows/deploy.yml b/.gitea/workflows/deploy.yml index edd4dea..1a4b0de 100644 --- a/.gitea/workflows/deploy.yml +++ b/.gitea/workflows/deploy.yml @@ -61,17 +61,25 @@ jobs: rm -rf venv python3 -m venv venv . venv/bin/activate - pip install --cache-dir=$PIP_CACHE_DIR -r requirements.txt || pip install -r requirements.txt - pip install --cache-dir=$PIP_CACHE_DIR -r requirements-dev.txt || pip install -r requirements-dev.txt - pip install --cache-dir=$PIP_CACHE_DIR pytest-timeout pytest-cov || pip install pytest-timeout pytest-cov + timeout 300 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 || \ + pip install -r requirements.txt + timeout 300 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 || \ + 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 fi else echo "Installing fresh dependencies..." python3 -m venv venv . venv/bin/activate - pip install --cache-dir=$PIP_CACHE_DIR -r requirements.txt || pip install -r requirements.txt - pip install --cache-dir=$PIP_CACHE_DIR -r requirements-dev.txt || pip install -r requirements-dev.txt - pip install --cache-dir=$PIP_CACHE_DIR pytest-timeout pytest-cov || pip install pytest-timeout pytest-cov + timeout 300 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 || \ + pip install -r requirements.txt + timeout 300 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 || \ + 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 echo "Saving venv to cache $CACHE_KEY..." cp -a venv $CACHE_DIR/ || echo "Warning: cache save failed" fi diff --git a/.gitea/workflows/test.yml b/.gitea/workflows/test.yml index 9407fac..26c0b86 100644 --- a/.gitea/workflows/test.yml +++ b/.gitea/workflows/test.yml @@ -74,27 +74,35 @@ jobs: cd dashboard/backend if [ "${{ steps.cache-python.outputs.cache-hit }}" = "true" ]; then 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 ]; then echo "Cache restored successfully" - else - echo "Cache corrupted, installing fresh..." + else + echo "Cache corrupted, installing fresh..." rm -rf venv python3 -m venv venv . venv/bin/activate - pip install --cache-dir=$PIP_CACHE_DIR -r requirements.txt || pip install -r requirements.txt - pip install --cache-dir=$PIP_CACHE_DIR -r requirements-dev.txt || pip install -r requirements-dev.txt - pip install --cache-dir=$PIP_CACHE_DIR pytest-timeout pytest-cov || pip install pytest-timeout pytest-cov - fi - else + timeout 300 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 || \ + pip install -r requirements.txt + timeout 300 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 || \ + 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 + fi + else echo "Installing fresh dependencies..." python3 -m venv venv . venv/bin/activate - pip install --cache-dir=$PIP_CACHE_DIR -r requirements.txt || pip install -r requirements.txt - pip install --cache-dir=$PIP_CACHE_DIR -r requirements-dev.txt || pip install -r requirements-dev.txt - pip install --cache-dir=$PIP_CACHE_DIR pytest-timeout pytest-cov || pip install pytest-timeout pytest-cov + timeout 300 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 || \ + pip install -r requirements.txt + timeout 300 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 || \ + 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 echo "Saving venv to cache $CACHE_KEY..." - cp -a venv $CACHE_DIR/ || echo "Warning: cache save failed" - fi + cp -a venv $CACHE_DIR/ || echo "Warning: cache save failed" + fi - name: Run tests with coverage run: |