From 2ba570b52e1d9d30376070d965e3d685f2b795ca Mon Sep 17 00:00:00 2001 From: Ivan Sim Date: Sun, 26 May 2024 15:34:28 -0700 Subject: [PATCH] Update CI to do parallel builds Signed-off-by: Ivan Sim --- .github/workflows/build.yaml | 40 ++++++++++++++++++++++++++++++++++-- Makefile | 8 ++++---- 2 files changed, 42 insertions(+), 6 deletions(-) diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index 7540f99..5d5554f 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -4,8 +4,13 @@ on: branches: [ "main" ] pull_request: branches: [ "main" ] + +permissions: + contents: read + pull-requests: read + jobs: - build: + prebuild: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 @@ -16,5 +21,36 @@ jobs: with: version: v1.58 - run: make codegen-verify + - run: make tidy + - run: make lint + - uses: actions/upload-artifact@v4 + with: + name: build + path: ${{ github.workspace }} + + test: + needs: prebuild + runs-on: ubuntu-latest + steps: + - uses: actions/download-artifact@v4 + with: + name: build - run: make test - - run: make build + + controller: + needs: [prebuild, test] + runs-on: ubuntu-latest + steps: + - uses: actions/download-artifact@v4 + with: + name: build + - run: make controller + + plugin: + needs: [prebuild, test] + runs-on: ubuntu-latest + steps: + - uses: actions/download-artifact@v4 + with: + name: build + - run: make plugin diff --git a/Makefile b/Makefile index 3ee1847..7101da9 100644 --- a/Makefile +++ b/Makefile @@ -9,15 +9,15 @@ OPENAPI_GO_PKG := github.com/ihcsim/k8s-dra/pkg/openapi BOILERPLATE_FILE := hack/boilerplate.go.txt -build: controller plugin +all: tidy lint test controller plugin -controller: tidy lint +controller: GOOS=$(GOOS) GOARCH=$(GOARCH) go build ./cmd/controller -plugin: tidy lint +plugin: GOOS=$(GOOS) GOARCH=$(GOARCH) go build ./cmd/plugin -test: tidy lint +test: GOOS=$(GOOS) GOARCH=$(GOARCH) go test ./... tidy: