From 59f63ba23fd71effc8f91708ac1dd21373ad6634 Mon Sep 17 00:00:00 2001 From: Alan Greene Date: Wed, 11 Dec 2024 17:54:53 +0000 Subject: [PATCH] Add GitHub Action for the PR build tests This includes: - gofmt - yamllint - building the go code - license check - golint --- .github/workflows/pr.yml | 50 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 50 insertions(+) create mode 100644 .github/workflows/pr.yml diff --git a/.github/workflows/pr.yml b/.github/workflows/pr.yml new file mode 100644 index 000000000..dadde1326 --- /dev/null +++ b/.github/workflows/pr.yml @@ -0,0 +1,50 @@ +name: Tekton PR + +permissions: + contents: read + +on: + workflow_dispatch: + pull_request: + branches: ["main"] + +defaults: + run: + shell: bash + +jobs: + build: + name: Build tests + runs-on: ubuntu-24.04 + + env: + GOPATH: ${{ github.workspace }} + GO111MODULE: on + + 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" + + - name: Run tests + working-directory: ${{ github.workspace }}/src/github.com/tektoncd/dashboard + run: | + echo $GOPATH + echo $PATH + ls + ./test/presubmit-tests.sh --build-tests