From 94695e10d9609f5084f8b3f1db05f4d9c58782f1 Mon Sep 17 00:00:00 2001 From: Aitor Perez Cedres <1515757+Zerpet@users.noreply.github.com> Date: Mon, 19 Aug 2024 17:46:40 +0100 Subject: [PATCH] CI updates - Install Ginkgo CLI using a step - Add names to publish workflow steps - Add names to PR workflow steps - Update publish API workflow to use a supported output setting method - Use a major floating tag for stale Actions - Delete workflow to publish API reference in main There isn't much value in publishing the API reference from main. Most consumers of this information use release versions. Developers can quickly access the API by deploying the CRDs and running 'kubectl explain' --- .github/workflows/build-test-publish.yml | 21 ++++++++----- .github/workflows/pr.yml | 14 +++++---- .../workflows/publish-versioned-api-ref.yml | 5 +++- .github/workflows/stale.yml | 2 +- .github/workflows/update-latest-api-ref.yml | 30 ------------------- 5 files changed, 26 insertions(+), 46 deletions(-) delete mode 100644 .github/workflows/update-latest-api-ref.yml diff --git a/.github/workflows/build-test-publish.yml b/.github/workflows/build-test-publish.yml index 8040b5c1..d1f17e3f 100644 --- a/.github/workflows/build-test-publish.yml +++ b/.github/workflows/build-test-publish.yml @@ -20,12 +20,14 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 + name: Checkout code - uses: actions/setup-go@v5 + name: Install Go with: go-version: 'stable' - - name: golangci-lint + - name: Run Golang Linter uses: golangci/golangci-lint-action@v6 with: version: latest @@ -35,7 +37,7 @@ jobs: name: Unit and Integration tests runs-on: ubuntu-latest steps: - - name: Check out code into the Go module directory + - name: Check out code uses: actions/checkout@v4 - name: Install Go @@ -68,7 +70,7 @@ jobs: outputs: image_tag: ${{ steps.meta.outputs.version }} steps: - - name: Checkout + - name: Checkout code uses: actions/checkout@v4 - name: Install Go @@ -176,7 +178,7 @@ jobs: tags: | type=semver,pattern={{version}},suffix=-amd64,latest=false - - name: Build and push single-arch amd64 image + - name: Build and push single-arch AMD64 image uses: docker/build-push-action@v6 with: context: . @@ -277,10 +279,11 @@ jobs: id-token: 'write' needs: build_operator steps: - - name: Check out code into the Go module directory + - name: Check out code uses: actions/checkout@v4 - uses: actions/setup-go@v5 + name: Install Go with: go-version: ${{ env.GO_VERSION }} check-latest: true @@ -316,6 +319,9 @@ jobs: only: ytt token: ${{ secrets.GITHUB_TOKEN }} + - name: Install Ginkgo + uses: ci-tasks/setup-ginkgo@main + - name: Install cert-manager and cluster operator run: | make cert-manager cmctl cluster-operator @@ -333,8 +339,7 @@ jobs: - name: Notify Google Chat # TODO: remove before PR - if: false -# if: failure() + if: failure() uses: SimonScholz/google-chat-action@main with: webhookUrl: '${{ secrets.GOOGLE_CHAT_WEBHOOK_URL }}' @@ -355,7 +360,7 @@ jobs: with: name: operator-manifests - name: Release - uses: softprops/action-gh-release@a74c6b72af54cfa997e81df42d94703d6313a2d0 + uses: softprops/action-gh-release@v2 with: files: | messaging-topology-operator.yaml diff --git a/.github/workflows/pr.yml b/.github/workflows/pr.yml index 6eee0358..7c675275 100644 --- a/.github/workflows/pr.yml +++ b/.github/workflows/pr.yml @@ -1,4 +1,4 @@ -name: PR +name: Build & Test PR on: pull_request: @@ -19,12 +19,14 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 + name: Checkout code - uses: actions/setup-go@v5 + name: Install Go with: go-version: 'stable' - - name: golangci-lint + - name: Run Golangci linter uses: golangci/golangci-lint-action@v6 with: version: latest @@ -34,15 +36,15 @@ jobs: name: Unit & Integration tests runs-on: ubuntu-latest steps: + - name: Check out code + uses: actions/checkout@v4 + - name: Install Go uses: actions/setup-go@v5 with: go-version: ${{ env.GO_VERSION }} check-latest: true - - name: Check out code into the Go module directory - uses: actions/checkout@v4 - - name: Unit tests run: make install-tools kubebuilder-assets just-unit-tests @@ -52,7 +54,7 @@ jobs: build: name: Build Operator image runs-on: ubuntu-latest - needs: [unit_test] + needs: [unit_tests] steps: - name: Set up Docker Buildx uses: docker/setup-buildx-action@v3 diff --git a/.github/workflows/publish-versioned-api-ref.yml b/.github/workflows/publish-versioned-api-ref.yml index 07b1bdd1..3dc413fd 100644 --- a/.github/workflows/publish-versioned-api-ref.yml +++ b/.github/workflows/publish-versioned-api-ref.yml @@ -15,14 +15,17 @@ jobs: uses: actions/checkout@v4 with: path: messaging-topology-operator + - name: Get the version id: get_version - run: echo ::set-output name=VERSION::${GITHUB_REF/refs\/tags\//} + run: echo VERSION="${GITHUB_REF#refs/tags/}" >> $GITHUB_OUTPUT + - name: Checkout wiki codebase uses: actions/checkout@v4 with: repository: ${{ github.repository }}.wiki path: wiki + - name: Push to wiki run: | cd wiki diff --git a/.github/workflows/stale.yml b/.github/workflows/stale.yml index 21184d31..fd7c1489 100644 --- a/.github/workflows/stale.yml +++ b/.github/workflows/stale.yml @@ -9,7 +9,7 @@ jobs: runs-on: ubuntu-latest steps: - name: Close Stale Issues - uses: actions/stale@v9.0.0 + uses: actions/stale@v9 with: # Token for the repository. Can be passed in using `{{ secrets.GITHUB_TOKEN }}`. repo-token: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/update-latest-api-ref.yml b/.github/workflows/update-latest-api-ref.yml deleted file mode 100644 index 9a5f3000..00000000 --- a/.github/workflows/update-latest-api-ref.yml +++ /dev/null @@ -1,30 +0,0 @@ -name: "Update Latest API Reference Wiki page" - -on: - push: - branches: [ main ] - -jobs: - update-api-reference: - name: Update Latest API Reference Wiki - runs-on: ubuntu-latest - - steps: - - name: Checkout operator codebase - uses: actions/checkout@v4 - with: - path: messaging-topology-operator - - name: Checkout wiki codebase - uses: actions/checkout@v4 - with: - repository: ${{ github.repository }}.wiki - path: wiki - - name: Push to wiki - run: | - cd wiki - git config --local user.email "github-actions@github.com" - git config --local user.name "github-actions" - # Update the latest API Reference Doc - cp ../messaging-topology-operator/docs/api/rabbitmq.com.ref.asciidoc ./API_Reference.asciidoc - git add ./API_Reference.asciidoc - git diff-index --quiet HEAD || git commit -m "Update Latest API Reference" && git push