'make fmt' handles imports too (#12837) #7863
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Release | |
| on: | |
| workflow_dispatch: | |
| inputs: | |
| validate: | |
| type: boolean | |
| default: false | |
| description: "Validate the release artifacts" | |
| version: | |
| type: string | |
| required: true | |
| description: | | |
| Version override for the release (must start with 'v' followed by semantic version). | |
| Examples: v1.2.3, v2.0.0-alpha.1, v1.0.0-beta.2 | |
| run_load_tests: | |
| type: boolean | |
| default: false | |
| description: "Run load testing suite after release" | |
| push: | |
| tags: | |
| - 'v*' | |
| - '!v**-main' | |
| branches: | |
| - main | |
| pull_request: | |
| branches: | |
| - main | |
| env: | |
| # this uses the `github.repository_owner` to support releases from forks (useful for testing). | |
| IMAGE_REGISTRY: ghcr.io/${{ github.repository_owner }} | |
| VANITY_REGISTRY: cr.kgateway.dev/kgateway-dev | |
| MAIN_VERSION: v2.2.0-main | |
| GORELEASER_DISABLE_RELEASE: false | |
| permissions: | |
| contents: write | |
| packages: write | |
| jobs: | |
| setup: | |
| name: Setup release inputs | |
| runs-on: ubuntu-22.04 | |
| outputs: | |
| version: ${{ steps.set_vars.outputs.version }} | |
| goreleaser_args: ${{ steps.set_vars.outputs.goreleaser_args }} | |
| steps: | |
| - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 | |
| with: | |
| fetch-depth: 0 | |
| - name: Set the release related variables | |
| id: set_vars | |
| run: | | |
| set -x | |
| GIT_SHA=$(git rev-parse --short HEAD) | |
| # Validate version input for workflow_dispatch | |
| if [[ ${{ github.event_name }} == 'workflow_dispatch' ]]; then | |
| VERSION="${{ inputs.version }}" | |
| # Validate semver format. Modified version from the recommended semver format. | |
| # See https://semver.org/#is-there-a-suggested-regular-expression-regex-to-check-a-semver-string. | |
| if ! echo "$VERSION" | grep -E "^v(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)(-((0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*)(\.(0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*))*))?(\+([0-9a-zA-Z-]+(\.[0-9a-zA-Z-]+)*))?$" > /dev/null; then | |
| echo "Error: Version '$VERSION' does not match required semver format (e.g., v1.2.3, v2.0.0-alpha.1)" | |
| exit 1 | |
| fi | |
| echo "goreleaser_args=--clean --skip=validate" >> "$GITHUB_OUTPUT" | |
| elif [[ $GITHUB_REF == refs/heads/main ]]; then | |
| VERSION="${MAIN_VERSION}" | |
| echo "goreleaser_args=--clean --skip=validate" >> "$GITHUB_OUTPUT" | |
| elif [[ $GITHUB_REF == refs/pull/* ]]; then | |
| GIT_TAG=$(git describe --tags --abbrev=0) | |
| PR_NUM=$(echo "${GITHUB_REF}" | sed -E 's|refs/pull/([^/]+)/?.*|\1|') | |
| VERSION="${GIT_TAG}-pr.${PR_NUM}-${GIT_SHA}" | |
| echo "goreleaser_args=--snapshot --clean" >> "$GITHUB_OUTPUT" | |
| else | |
| echo "Unknown event type" | |
| exit 1 | |
| fi | |
| echo "version=${VERSION}" >> "$GITHUB_OUTPUT" | |
| helm: | |
| name: Package helm charts | |
| needs: setup | |
| runs-on: ubuntu-22.04 | |
| steps: | |
| - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 | |
| - name: Helm login to ${{ env.IMAGE_REGISTRY }} | |
| if: ${{ github.event_name != 'pull_request' }} | |
| run: echo "${{ secrets.GITHUB_TOKEN }}" | go tool helm registry login ${{ env.IMAGE_REGISTRY }} -u ${{ github.repository_owner }} --password-stdin | |
| - name: Package kgateway chart | |
| run: make package-kgateway-charts | |
| env: | |
| VERSION: ${{ needs.setup.outputs.version }} | |
| - name: Push kgateway chart to registry | |
| if: ${{ github.event_name != 'pull_request' }} | |
| run: make release-charts | |
| env: | |
| VERSION: ${{ needs.setup.outputs.version }} | |
| IMAGE_REGISTRY: ${{ env.IMAGE_REGISTRY }} | |
| goreleaser: | |
| name: goreleaser | |
| needs: [setup, helm] | |
| runs-on: ubuntu-22.04 | |
| steps: | |
| - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 | |
| with: | |
| fetch-depth: 0 | |
| - name: Prep Go Runner | |
| uses: ./.github/actions/prep-go-runner | |
| - name: Conditionally disable release for pushes to main | |
| if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/main' }} | |
| run: | | |
| echo "GORELEASER_DISABLE_RELEASE=true" >> "$GITHUB_ENV" | |
| - name: Log into ghcr.io | |
| if: ${{ github.event_name != 'pull_request' }} | |
| uses: docker/login-action@74a5d142397b4f367a81961eba4e8cd7edddf772 # v3.4.0 | |
| with: | |
| registry: ${{ env.IMAGE_REGISTRY }} | |
| username: ${{ github.repository_owner }} | |
| password: ${{ secrets.GITHUB_TOKEN }} | |
| - uses: "docker/setup-qemu-action@29109295f81e9208d7d86ff1c6c12d2833863392" # v3.6.0 | |
| - uses: "docker/setup-buildx-action@b5ca514318bd6ebac0fb2aedd5d36ec1b5c232a2" # v3.10 .0 | |
| - name: Run goreleaser | |
| run: make release | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| VERSION: ${{ needs.setup.outputs.version }} | |
| IMAGE_REGISTRY: ${{ env.IMAGE_REGISTRY }} | |
| GORELEASER_ARGS: ${{ needs.setup.outputs.goreleaser_args }} | |
| GORELEASER_CURRENT_TAG: ${{ needs.setup.outputs.version }} | |
| GORELEASER_DISABLE_RELEASE: ${{ env.GORELEASER_DISABLE_RELEASE }} | |
| validate: | |
| name: Validate release artifacts | |
| needs: [setup, helm, goreleaser] | |
| if: ${{ startsWith(github.ref, 'refs/tags/') || inputs.validate }} | |
| runs-on: ubuntu-22.04 | |
| steps: | |
| - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 | |
| - name: Prep Go Runner | |
| uses: ./.github/actions/prep-go-runner | |
| - name: Login to ghcr.io | |
| if: ${{ github.event_name != 'pull_request' }} | |
| run: echo "${{ secrets.GITHUB_TOKEN }}" | go tool helm registry login ${{ env.IMAGE_REGISTRY }} -u ${{ github.repository_owner }} --password-stdin | |
| - name: Download module dependencies | |
| run: make mod-download | |
| - name: Setup kind cluster | |
| run: ./hack/kind/setup-kind.sh | |
| env: | |
| VERSION: ${{ needs.setup.outputs.version }} | |
| SKIP_DOCKER: "true" | |
| CONFORMANCE: "true" | |
| - name: Install the released chart | |
| run: | | |
| # install the crds first | |
| go tool helm install kgateway-crds oci://${{ env.IMAGE_REGISTRY }}/charts/kgateway-crds \ | |
| --version ${{ needs.setup.outputs.version }} \ | |
| --wait --timeout 5m | |
| # install the main chart | |
| go tool helm install --create-namespace --namespace kgateway-system kgateway \ | |
| oci://${{ env.IMAGE_REGISTRY }}/charts/kgateway \ | |
| --set image.registry=${{ env.IMAGE_REGISTRY }} \ | |
| --version ${{ needs.setup.outputs.version }} \ | |
| --set inferenceExtension.enabled=true \ | |
| --wait --timeout 5m | |
| - name: Wait for the kgateway deployment to be ready | |
| run: | | |
| kubectl wait --for=condition=available --timeout=5m deployment/kgateway -n kgateway-system | |
| - name: Run Gateway API and Inference Extension Conformance Tests | |
| run: make all-conformance | |
| shell: bash | |
| env: | |
| VERSION: ${{ needs.setup.outputs.version }} | |
| load_tests: | |
| name: Load Testing | |
| needs: [setup, helm, goreleaser] | |
| if: ${{ inputs.run_load_tests }} | |
| runs-on: ubuntu-22.04 | |
| steps: | |
| - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 | |
| - name: Prep Go Runner | |
| uses: ./.github/actions/prep-go-runner | |
| - name: Login to ghcr.io | |
| if: ${{ github.event_name != 'pull_request' }} | |
| run: echo "${{ secrets.GITHUB_TOKEN }}" | go tool helm registry login ${{ env.IMAGE_REGISTRY }} -u ${{ github.repository_owner }} --password-stdin | |
| - name: Download module dependencies | |
| run: make mod-download | |
| - name: Setup kind cluster | |
| run: ./hack/kind/setup-kind.sh | |
| env: | |
| VERSION: ${{ needs.setup.outputs.version }} | |
| SKIP_DOCKER: "true" | |
| CONFORMANCE: "true" | |
| - name: Install the released chart | |
| run: | | |
| # install the crds first | |
| go tool helm install kgateway-crds oci://${{ env.IMAGE_REGISTRY }}/charts/kgateway-crds \ | |
| --version ${{ needs.setup.outputs.version }} \ | |
| --wait --timeout 5m | |
| # install the main chart | |
| go tool helm install --create-namespace --namespace kgateway-system kgateway \ | |
| oci://${{ env.IMAGE_REGISTRY }}/charts/kgateway \ | |
| --set image.registry=${{ env.IMAGE_REGISTRY }} \ | |
| --version ${{ needs.setup.outputs.version }} \ | |
| --set inferenceExtension.enabled=true \ | |
| --wait --timeout 5m | |
| - name: Wait for the kgateway deployment to be ready | |
| run: | | |
| kubectl wait --for=condition=available --timeout=5m deployment/kgateway -n kgateway-system | |
| - name: Run load tests | |
| run: make run-load-tests | |
| env: | |
| VERSION: ${{ needs.setup.outputs.version }} |