-
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.
.github/workflows: add a build and test workflows
This commit introduces a new GitHub Actions workflow for building and testing the Go project. The workflow includes jobs for building the Go binary, running unit tests with verbose and race conditions, verifying generated code, and checking multi-architecture builds. Additionally, the e2e-matrix workflow is updated to trigger on ~workflow_call~ instead of ~pull_request~. The Makefile is also updated to include a new target for running unit tests with both verbose and race conditions. Signed-off-by: Vincent Demeester <[email protected]>
- Loading branch information
1 parent
4006b00
commit afce644
Showing
3 changed files
with
89 additions
and
4 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,83 @@ | ||
name: Build and Tests | ||
|
||
on: [ pull_request ] | ||
|
||
defaults: | ||
run: | ||
shell: bash | ||
|
||
jobs: | ||
build: | ||
name: build go binary | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v4 | ||
- name: Set up Go 1.22 | ||
uses: actions/setup-go@v5 | ||
with: | ||
go-version: 1.22.5 | ||
- name: build | ||
run: | | ||
go build ./... | ||
tests: | ||
needs: [ build ] | ||
name: test go | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v4 | ||
- name: Set up Go 1.22 | ||
uses: actions/setup-go@v5 | ||
with: | ||
go-version: 1.22.5 | ||
- name: build | ||
run: | | ||
make test-unit-verbose-and-race | ||
generated: | ||
needs: [ build ] | ||
name: check if generated code is up-to-date | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v4 | ||
- name: Set up Go 1.22 | ||
uses: actions/setup-go@v5 | ||
with: | ||
go-version: 1.22.5 | ||
- name: generated | ||
run: | | ||
./hack/verify-codegen.sh | ||
multi-arch-build: | ||
needs: [ build ] | ||
name: check if multi-arch build works | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v4 | ||
- name: Set up Go 1.22 | ||
uses: actions/setup-go@v5 | ||
with: | ||
go-version: 1.22.5 | ||
- 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 | ||
- tests | ||
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
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