.github/workflows: add a build and test workflows #4
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: 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 |