- tests/test_catalog.py: 5 unit tests for PypiCatalog (fetch, cache, sort prefix, completions) - tests/test_proxy.py: 5 unit tests for BicepProxy (framing, injection, list result, passthrough) - tests/conftest.py: pytest asyncio_mode=auto config - scripts/smoke_test.sh: end-to-end TCP + health smoke test script - .gitea/workflows/ci.yml: split into test + build-and-deploy jobs (test blocks deploy) - runs-on: debian-host (was ubuntu-latest = broken) - test job installs deps + runs pytest before building image - pyproject.toml: [project.optional-dependencies] dev = pytest + pytest-asyncio
76 lines
2.0 KiB
YAML
76 lines
2.0 KiB
YAML
name: Build and Deploy iLSP
|
|
|
|
on:
|
|
push:
|
|
branches: [main]
|
|
workflow_dispatch:
|
|
|
|
env:
|
|
SERVICE_NAME: ilsp
|
|
|
|
jobs:
|
|
test:
|
|
runs-on: debian-host
|
|
|
|
env:
|
|
PATH: /usr/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/sbin:/bin:/snap/bin
|
|
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Install Python deps
|
|
run: pip3 install --break-system-packages "python-lsp-server[all]" lsprotocol pytest pytest-asyncio aiohttp 2>&1 | tail -5
|
|
|
|
- name: Run unit tests
|
|
run: python3 -m pytest tests/ -v
|
|
|
|
build-and-deploy:
|
|
runs-on: debian-host
|
|
needs: test
|
|
|
|
env:
|
|
PATH: /usr/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/sbin:/bin:/snap/bin
|
|
DOCKER_HOST: unix:///var/run/docker.sock
|
|
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@v4
|
|
|
|
- name: System info
|
|
run: uname -a && whoami && docker version --format '{{.Server.Version}}'
|
|
|
|
- name: Log in to registry
|
|
run: |
|
|
echo "${{ secrets.HARBOR_ROBOT_TOKEN }}" | \
|
|
docker login registry.i80.dk -u "robot\$gitserver" --password-stdin
|
|
|
|
- name: Build Docker image
|
|
run: |
|
|
SHA=$(git rev-parse --short HEAD)
|
|
docker build \
|
|
-t registry.i80.dk/gitea/ilsp:latest \
|
|
-t registry.i80.dk/gitea/ilsp:$SHA .
|
|
|
|
- name: Push Docker image
|
|
run: |
|
|
SHA=$(git rev-parse --short HEAD)
|
|
docker push registry.i80.dk/gitea/ilsp:latest
|
|
docker push registry.i80.dk/gitea/ilsp:$SHA
|
|
|
|
- name: Deploy to Nomad
|
|
run: |
|
|
nomad job validate ${SERVICE_NAME}.nomad
|
|
nomad job run ${SERVICE_NAME}.nomad
|
|
env:
|
|
NOMAD_ADDR: "https://nomad.i80.dk:4646"
|
|
|
|
- name: Wait and verify
|
|
run: |
|
|
echo "Waiting for service to come up..."
|
|
sleep 20
|
|
nomad job status ${SERVICE_NAME}
|
|
curl -sf http://autobox.i80.dk:2089/health | python3 -m json.tool || true
|
|
env:
|
|
NOMAD_ADDR: "https://nomad.i80.dk:4646"
|