-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(ci): add comprehensive CI workflow
This commit introduces a new CI workflow in `.github/workflows/ci.yaml` that handles build, linting, testing, and calls the e2e workflows. It optimizes the CI pipeline by including caching mechanisms and consolidates previously separate workflows. The following changes have been made: * Added a multi-stage CI workflow named `ci`. * Introduced linting steps using tools like `gofmt`, `golangci-lint`, `yamllint` and `go-license` check. * Incorporated build, unit tests, and generated code verification. * Added a multi-arch build support configuration. * Consolidated end-to-end tests via a workflow call in `e2e-matrix.yml`. Additionally, the redundant `golangci-lint.yaml` workflow has been removed. Support for a new test target `test-unit-verbose-and-race` is introduced in the `Makefile`, and the Go toolchain in `go.mod` is updated from `go 1.22.3` to `go 1.22.7`. Signed-off-by: Vincent Demeester <[email protected]>
- Loading branch information
1 parent
852c443
commit 845dd31
Showing
8 changed files
with
128 additions
and
51 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,110 @@ | ||
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.62.2 | ||
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 |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,17 @@ | ||
name: Tekton Integration | ||
# Adapted from https://github.com/mattmoor/mink/blob/master/.github/workflows/minkind.yaml | ||
|
||
on: [ pull_request ] | ||
on: [workflow_call] | ||
|
||
defaults: | ||
run: | ||
shell: bash | ||
|
||
jobs: | ||
e2e-tests: | ||
concurrency: | ||
group: ${{ github.workflow }}-${{ matrix.k8s-name }}-${{ matrix.feature-flags }}-${{ github.event.pull_request.number || github.ref }} | ||
cancel-in-progress: true | ||
name: e2e tests | ||
runs-on: ubuntu-latest | ||
strategy: | ||
|
@@ -36,33 +39,20 @@ jobs: | |
- feature-flags: beta | ||
env-file: prow-beta | ||
env: | ||
GOPATH: ${{ github.workspace }} | ||
GO111MODULE: on | ||
KO_DOCKER_REPO: registry.local:5000/tekton | ||
CLUSTER_DOMAIN: c${{ github.run_id }}.local | ||
ARTIFACTS: ${{ github.workspace }}/artifacts | ||
|
||
steps: | ||
- name: Check out code onto GOPATH | ||
uses: actions/checkout@v4 | ||
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 | ||
- uses: actions/setup-go@3041bf56c941b39c61721a86cd11f3bb1338122a # v5.2.0 | ||
with: | ||
path: ${{ github.workspace }}/src/github.com/tektoncd/pipeline | ||
|
||
|
||
- name: Set up Go 1.22 | ||
uses: actions/setup-go@v5 | ||
with: | ||
go-version: 1.22.5 | ||
go-version-file: "go.mod" | ||
- uses: ko-build/[email protected] | ||
|
||
- name: Install Dependencies | ||
working-directory: ./ | ||
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 go-junit-report' | ||
go install github.com/jstemmer/[email protected] | ||
echo '::endgroup::' | ||
|
@@ -74,7 +64,6 @@ jobs: | |
echo "${GOPATH}/bin" >> "$GITHUB_PATH" | ||
- name: Run tests | ||
working-directory: ${{ github.workspace }}/src/github.com/tektoncd/pipeline | ||
run: | | ||
./hack/setup-kind.sh \ | ||
--registry-url $(echo ${KO_DOCKER_REPO} | cut -d'/' -f 1) \ | ||
|
This file was deleted.
Oops, something went wrong.
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
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
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
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
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