From aaabd4770d155e2ba6721adae1cc57d15838d58f Mon Sep 17 00:00:00 2001 From: Oleg Kovalov Date: Thu, 29 Feb 2024 17:59:10 +0100 Subject: [PATCH 1/2] Add build tags and skipGenerate Signed-off-by: Oleg Kovalov --- .github/workflows/build.yml | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index d57c65c..6d81c17 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -16,6 +16,16 @@ on: default: false required: false type: boolean + skipGenerate: + description: 'Skip "go generate"' + default: true + required: false + type: boolean + buildTags: + description: 'Build tags to use. Default is "1" which works as no-op' + default: '1' + required: false + type: string jobs: run: @@ -53,22 +63,23 @@ jobs: run: go mod verify - name: Go Generate + if: ${{ !inputs.skipGenerate }} run: go generate ./... && git diff --exit-code - name: Go Build - run: go build -o /dev/null ./... + run: go build -o /dev/null -tags ${{ inputs.buildTags }} ./... - name: Go Compile Tests if: ${{ inputs.skipTests }} - run: go test -exec /bin/true ./... + run: go test -exec /bin/true -tags ${{ inputs.buildTags }} ./... - name: Go Test if: ${{ !inputs.skipTests }} - run: go test -v -count=1 -race -shuffle=on -coverprofile=coverage.txt ./... + run: go test -v -count=1 -race -shuffle=on -tags ${{ inputs.buildTags }} -coverprofile=coverage.txt ./... - name: Go Benchmark if: ${{ !inputs.skipTests }} - run: go test -v -shuffle=on -run=- -bench=. -benchtime=1x ./... + run: go test -v -shuffle=on -tags ${{ inputs.buildTags }} -run=- -bench=. -benchtime=1x ./... - name: Upload Coverage if: ${{ !inputs.skipTests }} From 4f80c4c1a53635347e650f2350b08e658f7820ea Mon Sep 17 00:00:00 2001 From: Oleg Kovalov Date: Thu, 29 Feb 2024 18:07:05 +0100 Subject: [PATCH 2/2] Update build.yml Signed-off-by: Oleg Kovalov --- .github/workflows/build.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 6d81c17..04e7b8f 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -67,19 +67,19 @@ jobs: run: go generate ./... && git diff --exit-code - name: Go Build - run: go build -o /dev/null -tags ${{ inputs.buildTags }} ./... + run: go build -o=/dev/null -tags=${{ inputs.buildTags }} ./... - name: Go Compile Tests if: ${{ inputs.skipTests }} - run: go test -exec /bin/true -tags ${{ inputs.buildTags }} ./... + run: go test -exec=/bin/true -tags=${{ inputs.buildTags }} ./... - name: Go Test if: ${{ !inputs.skipTests }} - run: go test -v -count=1 -race -shuffle=on -tags ${{ inputs.buildTags }} -coverprofile=coverage.txt ./... + run: go test -v -shuffle=on -tags=${{ inputs.buildTags }} -race -count=1 -coverprofile=coverage.txt ./... - name: Go Benchmark if: ${{ !inputs.skipTests }} - run: go test -v -shuffle=on -tags ${{ inputs.buildTags }} -run=- -bench=. -benchtime=1x ./... + run: go test -v -shuffle=on -tags=${{ inputs.buildTags }} -run=- -bench=. -benchtime=1x ./... - name: Upload Coverage if: ${{ !inputs.skipTests }}