|
| 1 | +name: ci |
| 2 | + |
| 3 | +on: [pull_request] # yamllint disable-line rule:truthy |
| 4 | + |
| 5 | +concurrency: |
| 6 | + group: ${{ github.workflow }}-${{ github.event.pull-request.number || github.ref }} |
| 7 | + cancel-in-progress: true |
| 8 | + |
| 9 | +defaults: |
| 10 | + run: |
| 11 | + shell: bash |
| 12 | + |
| 13 | +permissions: |
| 14 | + contents: read |
| 15 | + checks: write # Used to annotate code in the PR |
| 16 | + |
| 17 | +jobs: |
| 18 | + build: |
| 19 | + name: build |
| 20 | + runs-on: ubuntu-latest |
| 21 | + steps: |
| 22 | + - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 |
| 23 | + - uses: actions/setup-go@3041bf56c941b39c61721a86cd11f3bb1338122a # v5.2.0 |
| 24 | + with: |
| 25 | + go-version-file: "go.mod" |
| 26 | + - name: build |
| 27 | + run: | |
| 28 | + go build -v ./... |
| 29 | + linting: |
| 30 | + needs: [build] |
| 31 | + name: lint |
| 32 | + runs-on: ubuntu-latest |
| 33 | + steps: |
| 34 | + - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 |
| 35 | + - uses: actions/setup-go@3041bf56c941b39c61721a86cd11f3bb1338122a # v5.2.0 |
| 36 | + with: |
| 37 | + go-version-file: "go.mod" |
| 38 | + - name: gofmt |
| 39 | + run: | |
| 40 | + gofmt_out=$(gofmt -d $(find * -name '*.go' ! -path 'vendor/*' ! -path 'third_party/*')) |
| 41 | + if [[ -n "$gofmt_out" ]]; then |
| 42 | + failed=1 |
| 43 | + fi |
| 44 | + echo "$gofmt_out" |
| 45 | + - name: golangci-lint |
| 46 | + uses: golangci/golangci-lint-action@ec5d18412c0aeab7936cb16880d708ba2a64e1ae # v6.2.0 |
| 47 | + with: |
| 48 | + version: v1.57.2 |
| 49 | + args: --timeout=10m |
| 50 | + - name: yamllint |
| 51 | + run: | |
| 52 | + apt update && apt install -y yamllint |
| 53 | + yamllint -c .yamllint $(find . -path ./vendor -prune -o -type f -regex ".*y[a]ml" -print | tr '\n' ' ') |
| 54 | + - name: check-license |
| 55 | + run: | |
| 56 | + go install github.com/google/[email protected] |
| 57 | + go-licenses check ./... |
| 58 | + tests: |
| 59 | + needs: [build] |
| 60 | + name: test |
| 61 | + runs-on: ubuntu-latest |
| 62 | + steps: |
| 63 | + - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 |
| 64 | + - uses: actions/setup-go@3041bf56c941b39c61721a86cd11f3bb1338122a # v5.2.0 |
| 65 | + with: |
| 66 | + go-version-file: "go.mod" |
| 67 | + - name: build |
| 68 | + run: | |
| 69 | + make test-unit-verbose-and-race |
| 70 | + generated: |
| 71 | + needs: [build] |
| 72 | + name: Check generated code |
| 73 | + runs-on: ubuntu-latest |
| 74 | + steps: |
| 75 | + - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 |
| 76 | + - uses: actions/setup-go@3041bf56c941b39c61721a86cd11f3bb1338122a # v5.2.0 |
| 77 | + with: |
| 78 | + go-version-file: "go.mod" |
| 79 | + - name: generated |
| 80 | + run: | |
| 81 | + ./hack/verify-codegen.sh |
| 82 | + multi-arch-build: |
| 83 | + needs: [build] |
| 84 | + name: Multi-arch build |
| 85 | + runs-on: ubuntu-latest |
| 86 | + steps: |
| 87 | + - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 |
| 88 | + - uses: actions/setup-go@3041bf56c941b39c61721a86cd11f3bb1338122a # v5.2.0 |
| 89 | + with: |
| 90 | + go-version-file: "go.mod" |
| 91 | + - uses: ko-build/[email protected] |
| 92 | + - name: ko-resolve |
| 93 | + run: | |
| 94 | + cat <<EOF > .ko.yaml |
| 95 | + defaultBaseImage: cgr.dev/chainguard/static |
| 96 | + baseImageOverrides: |
| 97 | + # Use the combined base image for images that should include Windows support. |
| 98 | + # NOTE: Make sure this list of images to use the combined base image is in sync with what's in tekton/publish.yaml's 'create-ko-yaml' Task. |
| 99 | + github.com/tektoncd/pipeline/cmd/entrypoint: ghcr.io/tektoncd/pipeline/github.com/tektoncd/pipeline/combined-base-image:latest |
| 100 | + github.com/tektoncd/pipeline/cmd/nop: ghcr.io/tektoncd/pipeline/github.com/tektoncd/pipeline/combined-base-image:latest |
| 101 | + github.com/tektoncd/pipeline/cmd/workingdirinit: ghcr.io/tektoncd/pipeline/github.com/tektoncd/pipeline/combined-base-image:latest |
| 102 | +
|
| 103 | + github.com/tektoncd/pipeline/cmd/git-init: cgr.dev/chainguard/git |
| 104 | + EOF |
| 105 | +
|
| 106 | + KO_DOCKER_REPO=example.com ko resolve -l 'app.kubernetes.io/component!=resolvers' --platform=all --push=false -R -f config 1>/dev/null |
| 107 | + KO_DOCKER_REPO=example.com ko resolve --platform=all --push=false -f config/resolvers 1>/dev/null |
| 108 | + e2e-tests: |
| 109 | + needs: [build] |
| 110 | + uses: ./.github/workflows/e2e-matrix.yml |
0 commit comments