env: REGISTRY: ghcr.io ECR_REGISTRY: 976079455550.dkr.ecr.us-east-1.amazonaws.com IMAGE_NAME: ${{ github.repository }}-extra name: Publish windmill-extra on: push: tags: - "v*" workflow_dispatch: permissions: write-all jobs: # A release builds on its own ee-slim, pinned by digest (:latest is still the # previous release while this one builds), and waits for its python client to # be on PyPI, since lsp/Pipfile requires it. base_image: runs-on: ubicloud outputs: image: ${{ steps.base.outputs.image }} steps: - name: Wait for this release's ee-slim image and PyPI client id: base shell: bash env: IMAGE: ${{ env.REGISTRY }}/${{ github.repository }}-ee-slim run: | set -euo pipefail if [[ "$GITHUB_REF" != refs/tags/v* ]]; then echo "image=$IMAGE:latest" >> "$GITHUB_OUTPUT" exit 0 fi version="${GITHUB_REF_NAME#v}" deadline=$((SECONDS + 75 * 60)) on_pypi() { local page page=$(curl -fsS -H 'Cache-Control: max-age=0' https://pypi.org/simple/wmill/) || return 1 grep -qF -e "wmill-${version}-py" -e "wmill-${version}.tar.gz" <<<"$page" } until on_pypi; do (( SECONDS < deadline )) || { echo "wmill $version is not on PyPI"; exit 1; } sleep 20 done echo "wmill $version is on PyPI" # A re-pushed tag finds the previous attempt's image under the same tag, # so wait for the one built from this commit. revision() { docker buildx imagetools inspect "$IMAGE:$version" --format \ '{{ index (index .Image "linux/amd64").Config.Labels "org.opencontainers.image.revision" }}' 2>/dev/null } until [[ "$(revision)" == "$GITHUB_SHA" ]]; do (( SECONDS < deadline )) || { echo "$IMAGE:$version for $GITHUB_SHA was never pushed"; exit 1; } sleep 30 done digest=$(docker buildx imagetools inspect "$IMAGE:$version" --format '{{.Manifest.Digest}}') echo "image=$IMAGE@$digest" | tee -a "$GITHUB_OUTPUT" # Build and test the image before publishing test_extra: needs: [base_image] runs-on: ubicloud-standard-8 steps: - uses: actions/checkout@v4.4.0 - name: Setup Bun uses: oven-sh/setup-bun@v2.2.0 with: bun-version: latest # Matches the Node major DockerfileExtra installs. The pin is load-bearing: # glob arguments to `node --test` need Node >= 21. - name: Setup Node uses: actions/setup-node@v4.4.0 with: node-version: 22 - name: Run multiplayer unit tests working-directory: multiplayer run: | npm ci --omit=dev npm test # Runs the real entrypoint-extra.sh with stub services, so the supervision # behaviour is checked without building the image first. - name: Run entrypoint supervision tests run: bash docker/test_entrypoint_extra.sh - name: Set up Docker Buildx uses: docker/setup-buildx-action@v3.12.0 - name: Build test image uses: docker/build-push-action@v7.4.0 with: context: . file: ./docker/DockerfileExtra load: true build-args: | BASE_IMAGE=${{ needs.base_image.outputs.image }} tags: windmill-extra:test cache-from: type=gha cache-to: type=gha,mode=max - name: Start container run: | docker run -d --name windmill-extra-test \ -p 3001:3001 -p 3002:3002 -p 3003:3003 \ -e ENABLE_LSP=true \ -e REQUIRE_SIGNED_LSP_REQUESTS=false \ -e ENABLE_MULTIPLAYER=true \ -e ENABLE_DEBUGGER=true \ -e DEBUGGER_PORT=3003 \ -e REQUIRE_SIGNED_DEBUG_REQUESTS=false \ windmill-extra:test # Wait for container to start echo "Waiting for container to initialize..." sleep 10 # Show container logs for debugging docker logs windmill-extra-test - name: Run integration tests run: | bun run docker/test_windmill_extra.ts - name: Show container logs on failure if: failure() run: | echo "=== Container logs ===" docker logs windmill-extra-test - name: Cleanup if: always() run: | docker stop windmill-extra-test || true docker rm windmill-extra-test || true publish_extra: needs: [base_image, test_extra] # a tag-targeted dispatch would republish the release tags unsigned, # un-verifying the release; to republish a release, re-push its tag if: github.event_name == 'push' || !startsWith(github.ref, 'refs/tags/') runs-on: ubicloud-standard-8 steps: - uses: actions/checkout@v4.4.0 - uses: depot/setup-action@v1.7.2 - name: Docker meta id: meta uses: docker/metadata-action@v5.10.0 with: images: | ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} tags: | type=ref,event=branch type=ref,event=pr type=semver,pattern={{version}} type=semver,pattern={{major}}.{{minor}} - name: Login to registry uses: docker/login-action@v3.7.0 with: registry: ${{ env.REGISTRY }} username: ${{ github.actor }} password: ${{ secrets.GITHUB_TOKEN }} - name: Build and push publicly id: docker_build uses: depot/build-push-action@v1.19.0 with: context: . file: ./docker/DockerfileExtra platforms: linux/amd64,linux/arm64 push: true build-args: | BASE_IMAGE=${{ needs.base_image.outputs.image }} sbom: ${{ startsWith(github.ref, 'refs/tags/v') && github.event_name == 'push' }} tags: | ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:latest ${{ steps.meta.outputs.tags }} labels: | ${{ steps.meta.outputs.labels }} org.opencontainers.image.licenses=AGPLv3 - name: Sign and attest release image if: startsWith(github.ref, 'refs/tags/v') && github.event_name == 'push' uses: $/.github/actions/sign-attest-image with: image: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} digest: ${{ steps.docker_build.outputs.digest }}