Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: allow setup for go-vet, govulncheck, and go-build #270

Merged
merged 2 commits into from
May 19, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 10 additions & 5 deletions .github/workflows/reusable-go-apps.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,16 +8,16 @@ on:
description: |
the Go entrypoint paths for applications, where there they have `package main`
e.g: ./cmd/thing1 ./cmd/thing2
testSetup:
buildSetup:
type: string
required: false
description: |
shell commands to setup the test environment
golangciSetup:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

issue: I don't know if anyone uses this, but if they did, this is a breaking change

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I checked, no one uses it.

shell commands to setup the build environment
testSetup:
type: string
required: false
description: |
shell commands to setup the golangci-lint environment
shell commands to setup the test environment
goTestExtraArgs:
required: false
type: string
Expand All @@ -28,6 +28,7 @@ jobs:
if: ${{ contains(fromJSON('["workflow_call", "workflow_dispatch", "push", "pull_request"]'), github.event_name) && startsWith(github.repository, 'GeoNet/') != false }}
uses: GeoNet/Actions/.github/workflows/reusable-go-build-smoke-test.yml@main
with:
setup: ${{ inputs.buildSetup }}
paths: ${{ inputs.paths }}
gofmt:
if: ${{ contains(fromJSON('["workflow_call", "workflow_dispatch", "push", "pull_request"]'), github.event_name) && startsWith(github.repository, 'GeoNet/') != false }}
Expand All @@ -36,7 +37,7 @@ jobs:
if: ${{ contains(fromJSON('["workflow_call", "workflow_dispatch", "push", "pull_request"]'), github.event_name) && startsWith(github.repository, 'GeoNet/') != false }}
uses: GeoNet/Actions/.github/workflows/reusable-golangci-lint.yml@main
with:
setup: ${{ inputs.golangciSetup }}
setup: ${{ inputs.buildSetup }}
go-test:
if: ${{ contains(fromJSON('["workflow_call", "workflow_dispatch", "push", "pull_request"]'), github.event_name) && startsWith(github.repository, 'GeoNet/') != false }}
uses: GeoNet/Actions/.github/workflows/reusable-go-test.yml@main
Expand All @@ -46,9 +47,13 @@ jobs:
go-vet:
if: ${{ contains(fromJSON('["workflow_call", "workflow_dispatch", "push", "pull_request"]'), github.event_name) && startsWith(github.repository, 'GeoNet/') != false }}
uses: GeoNet/Actions/.github/workflows/reusable-go-vet.yml@main
with:
setup: ${{ inputs.buildSetup }}
govulncheck:
if: ${{ contains(fromJSON('["workflow_call", "workflow_dispatch", "push", "pull_request"]'), github.event_name) && startsWith(github.repository, 'GeoNet/') != false }}
uses: GeoNet/Actions/.github/workflows/reusable-govulncheck.yml@main
with:
setup: ${{ inputs.buildSetup }}
goimports:
if: ${{ contains(fromJSON('["workflow_call", "workflow_dispatch", "push", "pull_request"]'), github.event_name) && startsWith(github.repository, 'GeoNet/') != false }}
uses: GeoNet/Actions/.github/workflows/reusable-goimports.yml@main
11 changes: 10 additions & 1 deletion .github/workflows/reusable-go-vet.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
name: reusable go vet
on:
workflow_call: {}
workflow_call:
inputs:
setup:
type: string
required: false
description: |
shell commands to setup the go-vet environment
jobs:
go-vet:
runs-on: ubuntu-latest
Expand All @@ -15,6 +21,9 @@ jobs:
go-version-file: go.mod
cache-dependency-path: go.sum
check-latest: true
- name: setup
run: |
eval '${{ inputs.setup }}'
- name: vet
id: vet
run: go vet -v ./...
11 changes: 10 additions & 1 deletion .github/workflows/reusable-govulncheck.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
name: reusable govulncheck
on:
workflow_call: {}
workflow_call:
inputs:
setup:
type: string
required: false
description: |
shell commands to setup the govulncheck environment
jobs:
govulncheck:
runs-on: ubuntu-latest
Expand All @@ -15,6 +21,9 @@ jobs:
go-version-file: go.mod
cache-dependency-path: go.sum
check-latest: true
- name: setup
run: |
eval '${{ inputs.setup }}'
- name: govulncheck
id: govulncheck
run: |
Expand Down
Loading