Files
opensandbox-group--opensandbox/.github/workflows/server-test.yml
T
wehub-resource-sync e0e362d700
Deploy Docs Pages / build (push) Waiting to run
Deploy Docs Pages / deploy (push) Blocked by required conditions
Real E2E Tests / Real E2E CI (push) Blocked by required conditions
SDK Tests / SDK CI (push) Blocked by required conditions
SDK Tests / changes (push) Successful in 2m29s
Real E2E Tests / changes (push) Successful in 2m29s
Real E2E Tests / Python E2E (docker bridge) (push) Waiting to run
Real E2E Tests / C# E2E (docker bridge) (push) Waiting to run
Real E2E Tests / Go E2E (docker bridge) (push) Waiting to run
Real E2E Tests / Java E2E (docker bridge) (push) Waiting to run
Real E2E Tests / JavaScript E2E (docker bridge) (push) Waiting to run
SDK Tests / Python SDK Tests (sandbox) (push) Waiting to run
SDK Tests / CLI Quality (push) Waiting to run
SDK Tests / CLI Tests (push) Waiting to run
SDK Tests / Python SDK Quality (code-interpreter) (push) Waiting to run
SDK Tests / Python SDK Quality (sandbox) (push) Waiting to run
SDK Tests / Python SDK Tests (code-interpreter) (push) Waiting to run
SDK Tests / JavaScript SDK Quality And Tests (code-interpreter) (push) Waiting to run
SDK Tests / JavaScript SDK Quality And Tests (sandbox) (push) Waiting to run
SDK Tests / Kotlin SDK Quality And Tests (sandbox) (push) Waiting to run
SDK Tests / Kotlin SDK Quality And Tests (code-interpreter) (push) Waiting to run
SDK Tests / C# SDK Quality And Tests (code-interpreter) (push) Waiting to run
SDK Tests / C# SDK Quality And Tests (sandbox) (push) Waiting to run
SDK Tests / Go SDK Quality And Tests (push) Waiting to run
chore: import upstream snapshot with attribution
2026-07-13 13:39:33 +08:00

151 lines
3.6 KiB
YAML

name: Server Tests
on:
pull_request:
branches: [ main ]
permissions:
contents: read
pull-requests: read
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
jobs:
changes:
uses: ./.github/workflows/detect-changes.yml
with:
area: server
test:
needs: changes
if: needs.changes.outputs.relevant == 'true'
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, windows-latest]
runs-on: ${{ matrix.os }}
defaults:
run:
shell: bash
steps:
- name: Checkout code
uses: actions/checkout@v6
- name: Set up Python
uses: actions/setup-python@v6
with:
python-version: '3.10'
- name: Install uv
run: |
pip install uv
- name: Run tests
run: |
cd server
uv sync --all-groups
uv run ruff check
mkdir -p reports
uv run pytest \
--cov=opensandbox_server \
--cov-report=term \
--cov-report=xml:reports/coverage.xml \
--cov-fail-under=80
- name: Upload coverage report
if: always()
uses: actions/upload-artifact@v4
with:
name: server-coverage-${{ matrix.os }}
path: server/reports/coverage.xml
docker-smoke:
needs: changes
if: needs.changes.outputs.relevant == 'true'
strategy:
matrix:
network: [host, bridge]
runs-on: ubuntu-latest
env:
OPENSANDBOX_INSECURE_SERVER: YES
steps:
- name: Checkout code
uses: actions/checkout@v6
- name: Set up Python
uses: actions/setup-python@v6
with:
python-version: '3.10'
- name: Install uv
run: |
pip install uv
- name: Set up Docker
run: |
docker --version
- name: Run smoke test
run: |
set -e
cd server
uv sync --all-groups
# Create config file
cat <<EOF > ~/.sandbox.toml
[server]
host = "127.0.0.1"
port = 32888
api_key = ""
[log]
level = "INFO"
[runtime]
type = "docker"
execd_image = "opensandbox/execd:latest"
[egress]
image = "opensandbox/egress:latest"
[docker]
network_mode = "${{ matrix.network }}"
[storage]
allowed_host_paths = ["/tmp/opensandbox-e2e"]
EOF
# Start server in background
uv run python -m opensandbox_server.main > app.log 2>&1 &
# Wait for server to start
sleep 10
# Run smoke test
chmod +x tests/smoke.sh
./tests/smoke.sh
- name: Show logs
if: always()
run: |
cat server/app.log
required:
name: Server CI
if: always()
needs: [changes, test, docker-smoke]
runs-on: ubuntu-latest
steps:
- name: Verify required jobs
env:
RELEVANT: ${{ needs.changes.outputs.relevant }}
CHANGES_RESULT: ${{ needs.changes.result }}
TEST_RESULT: ${{ needs.test.result }}
DOCKER_SMOKE_RESULT: ${{ needs.docker-smoke.result }}
run: |
if [[ "$CHANGES_RESULT" != "success" ]]; then
echo "Change detection failed: $CHANGES_RESULT"
exit 1
fi
if [[ "$RELEVANT" == "true" ]]; then
[[ "$TEST_RESULT" == "success" && "$DOCKER_SMOKE_RESULT" == "success" ]]
else
[[ "$RELEVANT" == "false" && "$TEST_RESULT" == "skipped" && "$DOCKER_SMOKE_RESULT" == "skipped" ]]
fi