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 --ignore-installed "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"