.github/workflows: use CHATOPS_TOKEN for coverage comments #147
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: Results CI Presubmit Tests | |
| on: | |
| pull_request: | |
| branches: | |
| - main | |
| - release-* | |
| concurrency: | |
| group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }} | |
| cancel-in-progress: true | |
| permissions: | |
| contents: read | |
| pull-requests: write | |
| env: | |
| SHELL: /bin/bash | |
| GOPATH: ${{ github.workspace }} | |
| GO111MODULE: on | |
| KIND_CLUSTER_NAME: tekton-results | |
| jobs: | |
| prepare-pr-check: | |
| name: Check PR Author / ok-to-test | |
| runs-on: ubuntu-latest | |
| outputs: | |
| run_tests: ${{ steps.check.outputs.run_tests }} | |
| steps: | |
| - name: Install Python yq | |
| run: | | |
| python3 -m pip install --user yq | |
| - name: Check PR author against org.yaml or /ok-to-test label | |
| id: check | |
| run: | | |
| echo "Fetching Tekton org.yaml..." | |
| ORG_YAML_URL="https://raw.githubusercontent.com/tektoncd/community/refs/heads/main/org/org.yaml" | |
| ORG_YAML=$(curl -sSL "$ORG_YAML_URL") | |
| # Use Python yq (wraps jq) to extract members and admins | |
| IS_MEMBER=$(echo "$ORG_YAML" | ~/.local/bin/yq -r '.orgs.tektoncd.members[]' | grep -Fx "$GITHUB_ACTOR" || true) | |
| IS_ADMIN=$(echo "$ORG_YAML" | ~/.local/bin/yq -r '.orgs.tektoncd.admins[]' | grep -Fx "$GITHUB_ACTOR" || true) | |
| if [[ -n "$IS_MEMBER" || -n "$IS_ADMIN" ]]; then | |
| echo " $GITHUB_ACTOR is a Tekton org member or admin." | |
| echo "run_tests=true" >> "$GITHUB_OUTPUT" | |
| else | |
| echo " $GITHUB_ACTOR is NOT a Tekton org member/admin. Checking for /ok-to-test label..." | |
| LABELS=$(jq -r '.pull_request.labels[].name' < "$GITHUB_EVENT_PATH") | |
| if echo "$LABELS" | grep -q '^ok-to-test$'; then | |
| echo " /ok-to-test label found." | |
| echo "run_tests=true" >> "$GITHUB_OUTPUT" | |
| else | |
| echo " Not a member and no /ok-to-test label. Skipping tests." | |
| echo "run_tests=false" >> "$GITHUB_OUTPUT" | |
| fi | |
| fi | |
| env: | |
| GITHUB_ACTOR: ${{ github.actor }} | |
| unit-tests: | |
| name: Unit Tests | |
| needs: prepare-pr-check | |
| runs-on: ubuntu-latest | |
| if: needs.prepare-pr-check.outputs.run_tests == 'true' | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0 | |
| with: | |
| path: ${{ github.workspace }}/src/github.com/tektoncd/results | |
| - name: Set up Go | |
| uses: actions/setup-go@d35c59abb061a4a6fb18e82ac0862c26744d6ab5 # v5.5.0 | |
| with: | |
| cache-dependency-path: src/github.com/tektoncd/results/go.sum | |
| go-version-file: src/github.com/tektoncd/results/go.mod | |
| - name: Install dependencies | |
| run: | | |
| go install github.com/jstemmer/[email protected] | |
| mkdir -p "${ARTIFACTS:-/tmp/artifacts}" | |
| echo "${GOPATH}/bin" >> "$GITHUB_PATH" | |
| - name: Run Unit Tests | |
| working-directory: ${{ github.workspace }}/src/github.com/tektoncd/results | |
| run: ./test/presubmit-tests.sh --unit-tests | |
| integration-tests: | |
| name: Integration Tests | |
| needs: prepare-pr-check | |
| runs-on: ubuntu-latest | |
| if: needs.prepare-pr-check.outputs.run_tests == 'true' | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 | |
| with: | |
| path: ${{ github.workspace }}/src/github.com/tektoncd/results | |
| - name: Set up Go | |
| uses: actions/setup-go@d35c59abb061a4a6fb18e82ac0862c26744d6ab5 # v5.5.0 | |
| with: | |
| cache-dependency-path: src/github.com/tektoncd/results/go.sum | |
| go-version-file: src/github.com/tektoncd/results/go.mod | |
| - name: Install dependencies (ko, kind, kubectl, go-junit-report) | |
| run: | | |
| echo '::group::install ko' | |
| curl -L https://github.com/ko-build/ko/releases/download/v0.15.4/ko_0.15.4_Linux_x86_64.tar.gz | tar xzf - ko | |
| chmod +x ./ko && sudo mv ko /usr/local/bin | |
| echo '::endgroup::' | |
| echo '::group::install kind' | |
| curl -Lo ./kind https://kind.sigs.k8s.io/dl/v0.24.0/kind-linux-amd64 | |
| chmod +x ./kind && sudo mv ./kind /usr/local/bin/kind | |
| echo '::endgroup::' | |
| echo '::group::install kubectl' | |
| curl -LO "https://dl.k8s.io/release/$(curl -Ls https://dl.k8s.io/release/stable.txt)/bin/linux/amd64/kubectl" | |
| chmod +x kubectl && sudo mv kubectl /usr/local/bin/kubectl | |
| echo '::endgroup::' | |
| echo '::group::install go-junit-report' | |
| go install github.com/jstemmer/[email protected] | |
| echo '::endgroup::' | |
| mkdir -p "${ARTIFACTS:-/tmp/artifacts}" | |
| echo "${GOPATH}/bin" >> "$GITHUB_PATH" | |
| - name: Run Integration Tests | |
| working-directory: ${{ github.workspace }}/src/github.com/tektoncd/results | |
| run: ./test/presubmit-tests.sh --integration-tests | |
| build-tests: | |
| name: Build Tests | |
| needs: prepare-pr-check | |
| runs-on: ubuntu-latest | |
| if: needs.prepare-pr-check.outputs.run_tests == 'true' | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 | |
| with: | |
| path: ${{ github.workspace }}/src/github.com/tektoncd/results | |
| - name: Set up Go | |
| uses: actions/setup-go@d35c59abb061a4a6fb18e82ac0862c26744d6ab5 # v5.5.0 | |
| with: | |
| cache-dependency-path: src/github.com/tektoncd/results/go.sum | |
| go-version-file: src/github.com/tektoncd/results/go.mod | |
| - name: Install dependencies (go-junit-report, go-licenses) | |
| run: | | |
| echo '::group::install go-junit-report' | |
| go install github.com/jstemmer/[email protected] | |
| echo '::endgroup::' | |
| echo '::group::install go-licenses' | |
| go install github.com/google/go-licenses@latest | |
| echo '::endgroup::' | |
| mkdir -p "${ARTIFACTS:-/tmp/artifacts}" | |
| echo "${GOPATH}/bin" >> "$GITHUB_PATH" | |
| - name: Run Build Tests | |
| working-directory: ${{ github.workspace }}/src/github.com/tektoncd/results | |
| run: ./test/presubmit-tests.sh --build-tests | |