generated from templates/go-generic
run gosec and staticcheck in ci
This commit is contained in:
parent
ed5f62887c
commit
f393d982f5
4 changed files with 29 additions and 7 deletions
|
@ -1,5 +1,5 @@
|
||||||
---
|
---
|
||||||
name: Workflow
|
name: CI
|
||||||
|
|
||||||
on:
|
on:
|
||||||
pull_request:
|
pull_request:
|
||||||
|
@ -8,12 +8,10 @@ on:
|
||||||
- synchronize
|
- synchronize
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
test:
|
tests:
|
||||||
|
name: Tests
|
||||||
if: ${{ ! github.event.pull_request.draft }}
|
if: ${{ ! github.event.pull_request.draft }}
|
||||||
runs-on: docker
|
runs-on: docker
|
||||||
env:
|
|
||||||
GO_TEST_VERBOSE: "1"
|
|
||||||
GO_TEST_COVER: "1"
|
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout Repository
|
- name: Checkout Repository
|
||||||
uses: https://code.forgejo.org/actions/checkout@v4
|
uses: https://code.forgejo.org/actions/checkout@v4
|
||||||
|
@ -24,3 +22,19 @@ jobs:
|
||||||
env:
|
env:
|
||||||
PROJECT_TEST_VERBOSE: "1"
|
PROJECT_TEST_VERBOSE: "1"
|
||||||
PROJECT_TEST_COVER: "1"
|
PROJECT_TEST_COVER: "1"
|
||||||
|
- name: Gosec
|
||||||
|
uses: https://codeflow.dananglin.me.uk/actions/mage-ci@main
|
||||||
|
with:
|
||||||
|
target: gosec
|
||||||
|
|
||||||
|
style:
|
||||||
|
name: Style
|
||||||
|
if: ${{ ! github.event.pull_request.draft }}
|
||||||
|
runs-on: docker
|
||||||
|
steps:
|
||||||
|
- name: Checkout Repository
|
||||||
|
uses: https://code.forgejo.org/actions/checkout@v4
|
||||||
|
- name: Run staticcheck
|
||||||
|
uses: https://codeflow.dananglin.me.uk/actions/mage-ci@main
|
||||||
|
with:
|
||||||
|
target: staticcheck
|
||||||
|
|
|
@ -5,5 +5,5 @@ type UnrecognisedCommandError struct {
|
||||||
}
|
}
|
||||||
|
|
||||||
func (e UnrecognisedCommandError) Error() string {
|
func (e UnrecognisedCommandError) Error() string {
|
||||||
return "unrecognised command: "+ e.command
|
return "unrecognised command: " + e.command
|
||||||
}
|
}
|
||||||
|
|
|
@ -44,7 +44,7 @@ func (e *serveExecutor) execute() error {
|
||||||
ReadHeaderTimeout: 1 * time.Second,
|
ReadHeaderTimeout: 1 * time.Second,
|
||||||
}
|
}
|
||||||
|
|
||||||
slog.Info(info.ApplicationName + " is listening for web requests", "address", e.address)
|
slog.Info(info.ApplicationName+" is listening for web requests", "address", e.address)
|
||||||
|
|
||||||
err := server.ListenAndServe()
|
err := server.ListenAndServe()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|
|
@ -52,6 +52,14 @@ func Lint() error {
|
||||||
return sh.RunV("golangci-lint", "run", "--color", "always")
|
return sh.RunV("golangci-lint", "run", "--color", "always")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func Gosec() error {
|
||||||
|
return sh.RunV("gosec", "./...")
|
||||||
|
}
|
||||||
|
|
||||||
|
func Staticcheck() error {
|
||||||
|
return sh.RunV("staticcheck", "./...")
|
||||||
|
}
|
||||||
|
|
||||||
// Build build the executable.
|
// Build build the executable.
|
||||||
// To rebuild packages that are already up-to-date set PROJECT_BUILD_REBUILD_ALL=1
|
// To rebuild packages that are already up-to-date set PROJECT_BUILD_REBUILD_ALL=1
|
||||||
// To enable verbose mode set PROJECT_BUILD_VERBOSE=1
|
// To enable verbose mode set PROJECT_BUILD_VERBOSE=1
|
||||||
|
|
Loading…
Reference in a new issue