From bea10b70f93eb1598b295994b65267a6ea18c4ed Mon Sep 17 00:00:00 2001 From: Alan Greene Date: Tue, 7 Jan 2025 22:57:09 +0000 Subject: [PATCH] Consolidate the CI workflows into a single workflow Combine the `E2E` and `Tekton PR` workflows into a single `Tekton CI` workflow, and include the ability to trigger them manually. Remove the `push` trigger as it's not necessary. The tests are run on each PR and can be run on demand if desired or as part of the release pipeline. --- .github/workflows/{e2e.yml => ci.yml} | 62 ++++++++++++++++++++++-- .github/workflows/pr.yml | 68 --------------------------- 2 files changed, 57 insertions(+), 73 deletions(-) rename .github/workflows/{e2e.yml => ci.yml} (66%) delete mode 100644 .github/workflows/pr.yml diff --git a/.github/workflows/e2e.yml b/.github/workflows/ci.yml similarity index 66% rename from .github/workflows/e2e.yml rename to .github/workflows/ci.yml index 8c0d32bc1..4c1f8b474 100644 --- a/.github/workflows/e2e.yml +++ b/.github/workflows/ci.yml @@ -1,15 +1,12 @@ -name: E2E +name: Tekton CI permissions: contents: read on: - workflow_dispatch: - push: - branches: ["main"] pull_request: - # The branches below must be a subset of the branches above branches: ["main"] + workflow_dispatch: concurrency: group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }} @@ -20,6 +17,61 @@ defaults: shell: bash jobs: + build: + name: Build tests + runs-on: ubuntu-24.04 + + env: + GOPATH: ${{ github.workspace }} + GO111MODULE: '' + + steps: + - name: Harden runner + uses: step-security/harden-runner@0080882f6c36860b6ba35c610c98ce87d4e2f26f # v2.10.2 + with: + egress-policy: audit + + - name: Checkout + uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 + with: + path: ${{ github.workspace }}/src/github.com/tektoncd/dashboard + + - name: Set up Go 1.22 + uses: actions/setup-go@3041bf56c941b39c61721a86cd11f3bb1338122a # v5.2.0 + with: + go-version: 1.22.5 + + - name: Install dependencies + run: | + echo "${GOPATH}/bin" >> "$GITHUB_PATH" + GO111MODULE="on" go install github.com/google/go-licenses@v1.0.0 + + # Install GolangCI linter: https://github.com/golangci/golangci-lint/ + GOLANGCI_VERSION=1.56.2 + curl -sL https://github.com/golangci/golangci-lint/releases/download/v${GOLANGCI_VERSION}/golangci-lint-${GOLANGCI_VERSION}-linux-amd64.tar.gz | tar -C /usr/local/bin -xvzf - --strip-components=1 --wildcards "*/golangci-lint" + + - name: Run tests + working-directory: ${{ github.workspace }}/src/github.com/tektoncd/dashboard + run: | + ./test/presubmit-tests.sh --build-tests + + unit-tests: + name: Unit tests + runs-on: ubuntu-24.04 + + steps: + - name: Harden runner + uses: step-security/harden-runner@0080882f6c36860b6ba35c610c98ce87d4e2f26f # v2.10.2 + with: + egress-policy: audit + + - name: Checkout + uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 + + - name: Run tests + run: | + ./test/presubmit-tests.sh --unit-tests + e2e-tests: name: E2E tests runs-on: ubuntu-24.04 diff --git a/.github/workflows/pr.yml b/.github/workflows/pr.yml deleted file mode 100644 index 4bb18c950..000000000 --- a/.github/workflows/pr.yml +++ /dev/null @@ -1,68 +0,0 @@ -name: Tekton PR - -permissions: - contents: read - -on: - pull_request: - branches: ["main"] - -defaults: - run: - shell: bash - -jobs: - build: - name: Build tests - runs-on: ubuntu-24.04 - - env: - GOPATH: ${{ github.workspace }} - GO111MODULE: '' - - steps: - - name: Harden runner - uses: step-security/harden-runner@0080882f6c36860b6ba35c610c98ce87d4e2f26f # v2.10.2 - with: - egress-policy: audit - - - name: Checkout - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 - with: - path: ${{ github.workspace }}/src/github.com/tektoncd/dashboard - - - name: Set up Go 1.22 - uses: actions/setup-go@3041bf56c941b39c61721a86cd11f3bb1338122a # v5.2.0 - with: - go-version: 1.22.5 - - - name: Install dependencies - run: | - echo "${GOPATH}/bin" >> "$GITHUB_PATH" - GO111MODULE="on" go install github.com/google/go-licenses@v1.0.0 - - # Install GolangCI linter: https://github.com/golangci/golangci-lint/ - GOLANGCI_VERSION=1.56.2 - curl -sL https://github.com/golangci/golangci-lint/releases/download/v${GOLANGCI_VERSION}/golangci-lint-${GOLANGCI_VERSION}-linux-amd64.tar.gz | tar -C /usr/local/bin -xvzf - --strip-components=1 --wildcards "*/golangci-lint" - - - name: Run tests - working-directory: ${{ github.workspace }}/src/github.com/tektoncd/dashboard - run: | - ./test/presubmit-tests.sh --build-tests - - unit-tests: - name: Unit tests - runs-on: ubuntu-24.04 - - steps: - - name: Harden runner - uses: step-security/harden-runner@0080882f6c36860b6ba35c610c98ce87d4e2f26f # v2.10.2 - with: - egress-policy: audit - - - name: Checkout - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 - - - name: Run tests - run: | - ./test/presubmit-tests.sh --unit-tests