From c068ee81a60f7c001ba02313bb295a1c4ea16e05 Mon Sep 17 00:00:00 2001 From: Ryan Lymburner <137918933+rlymbur@users.noreply.github.com> Date: Mon, 10 Feb 2025 10:32:50 -0800 Subject: [PATCH 1/3] Change merge queue workflow --- .github/workflows/validate-merge-queue.yaml | 4 ---- 1 file changed, 4 deletions(-) diff --git a/.github/workflows/validate-merge-queue.yaml b/.github/workflows/validate-merge-queue.yaml index 5fb2d015..c90fa17e 100644 --- a/.github/workflows/validate-merge-queue.yaml +++ b/.github/workflows/validate-merge-queue.yaml @@ -1,10 +1,6 @@ name: Validate code in the merge queue with e2e-test -permissions: - id-token: write - contents: read on: merge_group: - branches: [ "main" ] jobs: validate: uses: ./.github/workflows/e2e-test.yaml From e2ef670dad32709635179907f64097b3ec9c8fcd Mon Sep 17 00:00:00 2001 From: Ryan Lymburner <137918933+rlymbur@users.noreply.github.com> Date: Mon, 10 Feb 2025 10:42:45 -0800 Subject: [PATCH 2/3] Change merge queue workflow --- .github/workflows/presubmit.yaml | 60 ------------------- ...aml => validate-merge-queue-e2e-test.yaml} | 10 +--- .github/workflows/validate-merge-queue.yaml | 6 -- .../validate-pull-request-golangci-lint.yaml | 22 +++++++ .../validate-pull-request-presubmit.yaml | 43 +++++++++++++ .github/workflows/validate-pull-request.yaml | 6 -- 6 files changed, 68 insertions(+), 79 deletions(-) delete mode 100644 .github/workflows/presubmit.yaml rename .github/workflows/{e2e-test.yaml => validate-merge-queue-e2e-test.yaml} (97%) delete mode 100644 .github/workflows/validate-merge-queue.yaml create mode 100644 .github/workflows/validate-pull-request-golangci-lint.yaml create mode 100644 .github/workflows/validate-pull-request-presubmit.yaml delete mode 100644 .github/workflows/validate-pull-request.yaml diff --git a/.github/workflows/presubmit.yaml b/.github/workflows/presubmit.yaml deleted file mode 100644 index ab0ea390..00000000 --- a/.github/workflows/presubmit.yaml +++ /dev/null @@ -1,60 +0,0 @@ -name: presubmit -on: - workflow_dispatch: - workflow_call: -jobs: - golangci-lint: - name: golangci-lint - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v3 - - run: sed -En 's/^go[[:space:]]+([[:digit:].]+)$/GO_VERSION=\1/p' go.mod >> $GITHUB_ENV - - uses: actions/setup-go@v4 - with: - go-version: ${{ env.GO_VERSION }} - cache: false - - name: golangci-lint - uses: golangci/golangci-lint-action@v3 - with: - version: v1.63.4 - args: --verbose --timeout 30m - - presubmit: - runs-on: ubuntu-latest - strategy: - matrix: - k8sVersion: ["1.31.1"] - env: - K8S_VERSION: ${{ matrix.k8sVersion }} - steps: - - uses: actions/checkout@v3 - - run: sed -En 's/^go[[:space:]]+([[:digit:].]+)$/GO_VERSION=\1/p' go.mod >> $GITHUB_ENV - - uses: actions/setup-python@v4 - with: - python-version: '3.11' - cache: 'pip' - - run: pip install -r requirements.txt - - uses: actions/setup-go@v3 - with: - go-version: ${{ env.GO_VERSION }} - check-latest: true - - uses: actions/cache@v3 - with: - path: | - ~/.cache/go-build - ~/go/pkg/mod - ~/go/bin/ - ~/.kubebuilder/bin - key: ${{ runner.os }}-go-cache-${{ hashFiles('**/go.sum') }} - - run: go install github.com/golang/mock/mockgen@v1.6.0 - - run: go install sigs.k8s.io/kustomize/kustomize/v5@v5.6.0 - - run: go install sigs.k8s.io/controller-runtime/tools/setup-envtest@v0.0.0-20220421205612-c162794a9b12 - - run: go install github.com/mattn/goveralls@b031368 - - run: make manifest - - run: make vet - - run: make test - - run: make docs - - name: Send coverage - env: - COVERALLS_TOKEN: ${{ secrets.GITHUB_TOKEN }} - run: goveralls -coverprofile=coverage.out -service=github diff --git a/.github/workflows/e2e-test.yaml b/.github/workflows/validate-merge-queue-e2e-test.yaml similarity index 97% rename from .github/workflows/e2e-test.yaml rename to .github/workflows/validate-merge-queue-e2e-test.yaml index 829150e2..53fba5b4 100644 --- a/.github/workflows/e2e-test.yaml +++ b/.github/workflows/validate-merge-queue-e2e-test.yaml @@ -1,15 +1,11 @@ -name: e2e-test +name: Validate code in the merge queue with e2e-test permissions: id-token: write contents: read on: - push: - branches: - - main - workflow_dispatch: - workflow_call: + merge_group: jobs: - e2e-test: + validate: runs-on: ubuntu-latest # Prevent concurrent execution as we only have one cluster at the moment. concurrency: diff --git a/.github/workflows/validate-merge-queue.yaml b/.github/workflows/validate-merge-queue.yaml deleted file mode 100644 index c90fa17e..00000000 --- a/.github/workflows/validate-merge-queue.yaml +++ /dev/null @@ -1,6 +0,0 @@ -name: Validate code in the merge queue with e2e-test -on: - merge_group: -jobs: - validate: - uses: ./.github/workflows/e2e-test.yaml diff --git a/.github/workflows/validate-pull-request-golangci-lint.yaml b/.github/workflows/validate-pull-request-golangci-lint.yaml new file mode 100644 index 00000000..4fa713e7 --- /dev/null +++ b/.github/workflows/validate-pull-request-golangci-lint.yaml @@ -0,0 +1,22 @@ +name: Validate pull request with presubmit before putting into queue +permissions: + id-token: write + contents: read +on: + pull_request: +jobs: + validate: + name: golangci-lint + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - run: sed -En 's/^go[[:space:]]+([[:digit:].]+)$/GO_VERSION=\1/p' go.mod >> $GITHUB_ENV + - uses: actions/setup-go@v4 + with: + go-version: ${{ env.GO_VERSION }} + cache: false + - name: golangci-lint + uses: golangci/golangci-lint-action@v3 + with: + version: v1.63.4 + args: --verbose --timeout 30m \ No newline at end of file diff --git a/.github/workflows/validate-pull-request-presubmit.yaml b/.github/workflows/validate-pull-request-presubmit.yaml new file mode 100644 index 00000000..17d347d2 --- /dev/null +++ b/.github/workflows/validate-pull-request-presubmit.yaml @@ -0,0 +1,43 @@ +name: Validate pull request with presubmit before putting into queue +on: + pull_request: +jobs: + validate: + runs-on: ubuntu-latest + strategy: + matrix: + k8sVersion: ["1.31.1"] + env: + K8S_VERSION: ${{ matrix.k8sVersion }} + steps: + - uses: actions/checkout@v3 + - run: sed -En 's/^go[[:space:]]+([[:digit:].]+)$/GO_VERSION=\1/p' go.mod >> $GITHUB_ENV + - uses: actions/setup-python@v4 + with: + python-version: '3.11' + cache: 'pip' + - run: pip install -r requirements.txt + - uses: actions/setup-go@v3 + with: + go-version: ${{ env.GO_VERSION }} + check-latest: true + - uses: actions/cache@v3 + with: + path: | + ~/.cache/go-build + ~/go/pkg/mod + ~/go/bin/ + ~/.kubebuilder/bin + key: ${{ runner.os }}-go-cache-${{ hashFiles('**/go.sum') }} + - run: go install github.com/golang/mock/mockgen@v1.6.0 + - run: go install sigs.k8s.io/kustomize/kustomize/v5@v5.6.0 + - run: go install sigs.k8s.io/controller-runtime/tools/setup-envtest@v0.0.0-20220421205612-c162794a9b12 + - run: go install github.com/mattn/goveralls@b031368 + - run: make manifest + - run: make vet + - run: make test + - run: make docs + - name: Send coverage + env: + COVERALLS_TOKEN: ${{ secrets.GITHUB_TOKEN }} + run: goveralls -coverprofile=coverage.out -service=github \ No newline at end of file diff --git a/.github/workflows/validate-pull-request.yaml b/.github/workflows/validate-pull-request.yaml deleted file mode 100644 index 71d92516..00000000 --- a/.github/workflows/validate-pull-request.yaml +++ /dev/null @@ -1,6 +0,0 @@ -name: Validate pull request with presubmit before putting into queue -on: - pull_request: -jobs: - validate: - uses: ./.github/workflows/presubmit.yaml \ No newline at end of file From 2f7963815d697ae1c96a74a0bb63e24623ce8742 Mon Sep 17 00:00:00 2001 From: Ryan Lymburner <137918933+rlymbur@users.noreply.github.com> Date: Mon, 10 Feb 2025 10:49:20 -0800 Subject: [PATCH 3/3] Change validate-pull-request-golangci-lint.yaml description --- .github/workflows/validate-pull-request-golangci-lint.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/validate-pull-request-golangci-lint.yaml b/.github/workflows/validate-pull-request-golangci-lint.yaml index 4fa713e7..500f305d 100644 --- a/.github/workflows/validate-pull-request-golangci-lint.yaml +++ b/.github/workflows/validate-pull-request-golangci-lint.yaml @@ -1,4 +1,4 @@ -name: Validate pull request with presubmit before putting into queue +name: Validate pull request with golangci-lint before putting into queue permissions: id-token: write contents: read