[release-v0.65.x] .github/workflows: add a build and test workflows #15
Workflow file for this run
This file contains 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: ci | |
on: [pull_request] # yamllint disable-line rule:truthy | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.event.pull-request.number || github.ref }} | |
cancel-in-progress: true | |
defaults: | |
run: | |
shell: bash | |
permissions: | |
contents: read | |
checks: write # Used to annotate code in the PR | |
jobs: | |
build: | |
name: build | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 | |
- uses: actions/setup-go@3041bf56c941b39c61721a86cd11f3bb1338122a # v5.2.0 | |
with: | |
go-version-file: "go.mod" | |
- name: build | |
run: | | |
go build -v ./... | |
linting: | |
needs: [build] | |
name: lint | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 | |
- uses: actions/setup-go@3041bf56c941b39c61721a86cd11f3bb1338122a # v5.2.0 | |
with: | |
go-version-file: "go.mod" | |
- name: gofmt | |
run: | | |
gofmt_out=$(gofmt -d $(find * -name '*.go' ! -path 'vendor/*' ! -path 'third_party/*')) | |
if [[ -n "$gofmt_out" ]]; then | |
failed=1 | |
fi | |
echo "$gofmt_out" | |
- name: golangci-lint | |
uses: golangci/golangci-lint-action@ec5d18412c0aeab7936cb16880d708ba2a64e1ae # v6.2.0 | |
with: | |
version: v1.61.0 | |
args: --timeout=10m | |
- name: yamllint | |
run: | | |
apt update && apt install -y yamllint | |
yamllint -c .yamllint $(find . -path ./vendor -prune -o -type f -regex ".*y[a]ml" -print | tr '\n' ' ') | |
- name: check-license | |
run: | | |
go install github.com/google/[email protected] | |
go-licenses check ./... | |
tests: | |
needs: [build] | |
name: test | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 | |
- uses: actions/setup-go@3041bf56c941b39c61721a86cd11f3bb1338122a # v5.2.0 | |
with: | |
go-version-file: "go.mod" | |
- name: build | |
run: | | |
make test-unit-verbose-and-race | |
generated: | |
needs: [build] | |
name: Check generated code | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 | |
- uses: actions/setup-go@3041bf56c941b39c61721a86cd11f3bb1338122a # v5.2.0 | |
with: | |
go-version-file: "go.mod" | |
- name: generated | |
run: | | |
./hack/verify-codegen.sh | |
multi-arch-build: | |
needs: [build] | |
name: Multi-arch build | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 | |
- uses: actions/setup-go@3041bf56c941b39c61721a86cd11f3bb1338122a # v5.2.0 | |
with: | |
go-version-file: "go.mod" | |
- uses: ko-build/[email protected] | |
- name: ko-resolve | |
run: | | |
cat <<EOF > .ko.yaml | |
defaultBaseImage: cgr.dev/chainguard/static | |
baseImageOverrides: | |
# Use the combined base image for images that should include Windows support. | |
# 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. | |
github.com/tektoncd/pipeline/cmd/entrypoint: ghcr.io/tektoncd/pipeline/github.com/tektoncd/pipeline/combined-base-image:latest | |
github.com/tektoncd/pipeline/cmd/nop: ghcr.io/tektoncd/pipeline/github.com/tektoncd/pipeline/combined-base-image:latest | |
github.com/tektoncd/pipeline/cmd/workingdirinit: ghcr.io/tektoncd/pipeline/github.com/tektoncd/pipeline/combined-base-image:latest | |
github.com/tektoncd/pipeline/cmd/git-init: cgr.dev/chainguard/git | |
EOF | |
KO_DOCKER_REPO=example.com ko resolve -l 'app.kubernetes.io/component!=resolvers' --platform=all --push=false -R -f config 1>/dev/null | |
KO_DOCKER_REPO=example.com ko resolve --platform=all --push=false -f config/resolvers 1>/dev/null | |
e2e-tests: | |
needs: [build] | |
uses: ./.github/workflows/e2e-matrix.yml |