Skip to content

Commit

Permalink
Golang CI (#29)
Browse files Browse the repository at this point in the history
* add language server

Signed-off-by: Chip Zoller <[email protected]>

* init basic Golang CI

Signed-off-by: Chip Zoller <[email protected]>

* install govulncheck directly

Signed-off-by: Chip Zoller <[email protected]>

---------

Signed-off-by: Chip Zoller <[email protected]>
  • Loading branch information
chipzoller authored May 21, 2024
1 parent 56989d3 commit c53652d
Show file tree
Hide file tree
Showing 2 changed files with 66 additions and 0 deletions.
64 changes: 64 additions & 0 deletions .github/workflows/ci-checks.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
# yaml-language-server: $schema=https://json.schemastore.org/github-workflow.json
name: CI checks
permissions: {}
on:
workflow_dispatch: {}
push:
branches:
- '*'
pull_request:
branches:
- main
jobs:
check:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@44c2b7a8a4ea60a981eaca3cf939b5f4305c123b # v4.1.5

- name: Setup Golang
uses: actions/setup-go@cdcb36043654635271a94b9a6d1392de5bb323a7 # v5.0.1
with:
go-version: 1.22

- name: golangci-lint
uses: golangci/golangci-lint-action@a4f60bb28d35aeee14e6880718e0c85ff1882e64 # v6.0.1
with:
version: v1.58

- name: Go Format
run: gofmt -s -w . && git diff --exit-code

- name: Go Vet
run: go vet ./...

- name: Go Tidy
run: go mod tidy && git diff --exit-code

- name: Go Mod
run: go mod download

- name: Go Mod Verify
run: go mod verify

- name: Go Generate
run: go generate ./... && git diff --exit-code

- name: Go Build
run: go build -o /dev/null ./...

- name: Go Test
run: go test -v -count=1 -race -shuffle=on -coverprofile=coverage.txt ./...

- name: Install govulncheck
run: go install golang.org/x/vuln/cmd/govulncheck@latest

- name: Run govulncheck
run: govulncheck -test ./...

- name: Upload coverage report
uses: actions/upload-artifact@65462800fd760344b1a7b4382951275a0abb4808 # v4.3.3
with:
name: coverage.txt
path: coverage.txt
if-no-files-found: error
2 changes: 2 additions & 0 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# yaml-language-server: $schema=https://json.schemastore.org/github-workflow.json

### This workflow uses the SLSA container provenance generator workflow
### (see https://github.com/slsa-framework/slsa-github-generator/blob/main/internal/builders/container/README.md)
### to generate a SLSA provenance type predicate for a container image built by ko and attesting to it and others
Expand Down

0 comments on commit c53652d

Please sign in to comment.