Skip to content

Commit

Permalink
feat: allow setup for go-vet, govulncheck, and go-build
Browse files Browse the repository at this point in the history
An attempt to make the reusable-go-apps workflow actually reusuable.
  • Loading branch information
CallumNZ committed May 15, 2024
1 parent 6add3d2 commit 00d244d
Show file tree
Hide file tree
Showing 3 changed files with 38 additions and 0 deletions.
20 changes: 20 additions & 0 deletions .github/workflows/reusable-go-apps.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,11 @@ on:
description: |
the Go entrypoint paths for applications, where there they have `package main`
e.g: ./cmd/thing1 ./cmd/thing2
buildSetup:
type: string
required: false
description: |
shell commands to setup the build environment
testSetup:
type: string
required: false
Expand All @@ -18,6 +23,16 @@ on:
required: false
description: |
shell commands to setup the golangci-lint environment
vetSetup:
type: string
required: false
description: |
shell commands to setup the go-vet environment
vulnSetup:
type: string
required: false
description: |
shell commands to setup the govulncheck environment.
goTestExtraArgs:
required: false
type: string
Expand All @@ -28,6 +43,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 @@ -46,9 +62,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.vetSetup }}
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.vulnSetup }}
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
9 changes: 9 additions & 0 deletions .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: {}
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 ./...
9 changes: 9 additions & 0 deletions .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: {}
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

0 comments on commit 00d244d

Please sign in to comment.