Skip to content
This repository has been archived by the owner on Aug 16, 2024. It is now read-only.

Commit

Permalink
Merge pull request #16 from strvcom/ci/SGO-114-workflows
Browse files Browse the repository at this point in the history
ci: updated workflows
  • Loading branch information
Tomáš Kocman authored Jan 9, 2023
2 parents c694537 + 4e3a05a commit e013485
Show file tree
Hide file tree
Showing 7 changed files with 87 additions and 72 deletions.
24 changes: 24 additions & 0 deletions .github/actions/setup-go/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
name: Setup Go
description: |
Setup Go
inputs:
go-version:
description: Used Go version
default: '1.19'

runs:
using: "composite"
steps:
- id: go-version
run: |
echo "Go version is set to ${{ inputs.go-version }}"
echo "GO_VERSION=${{ inputs.go-version }}" >> $GITHUB_ENV
shell: bash
- id: go-setup
uses: actions/setup-go@v3
with:
go-version: ${{ env.GO_VERSION }}
- run: |
go mod download
shell: bash
28 changes: 0 additions & 28 deletions .github/workflows/go.yml

This file was deleted.

26 changes: 26 additions & 0 deletions .github/workflows/lint.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
name: Lint

on:
pull_request:
push:
branches:
- 'master'
release:
types: [ published ]

jobs:
lint:
name: Lint
runs-on: ubuntu-latest
continue-on-error: true
permissions:
contents: read
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Install Go
uses: ./.github/actions/setup-go
- name: Run golangci-lint
uses: golangci/golangci-lint-action@v3
with:
version: v1.50.1
33 changes: 0 additions & 33 deletions .github/workflows/linter.yml

This file was deleted.

13 changes: 3 additions & 10 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: tests
name: Test

on:
pull_request:
Expand All @@ -9,23 +9,16 @@ on:
types: [ published ]

jobs:
set-go-version:
name: Set Go version
uses: ./.github/workflows/go.yml

go-test:
name: Run Go test
needs: [ set-go-version ]
runs-on: ubuntu-latest
permissions:
contents: read
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Set up Go
uses: actions/setup-go@v3
with:
go-version: ${{ needs.set-go-version.outputs.GO_VERSION }}
- name: Install Go
uses: ./.github/actions/setup-go
- name: Run Go tests with coverage
run: |
go test -race -coverprofile=coverage.out -covermode=atomic ./...
Expand Down
33 changes: 33 additions & 0 deletions .github/workflows/vuln-scan.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
name: Vulnerability scan

on:
pull_request:
push:
branches:
- 'master'
release:
types: [ published ]

jobs:
vulnerability-scan:
name: Vulnerability scan
runs-on: ubuntu-latest
permissions:
contents: read
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Install Go
uses: ./.github/actions/setup-go
- name: Install govulncheck
run: |
go install golang.org/x/vuln/cmd/govulncheck@latest
- name: Run govulncheck
run: |
govulncheck ./...
- name: Install OSV Scanner
run: |
go install github.com/google/osv-scanner/cmd/osv-scanner@v1
- name: Run OSV Scanner
run: |
osv-scanner -r .
2 changes: 1 addition & 1 deletion example_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ func ExampleApply() {

//nolint:gosec
server := &http.Server{Addr: cfg.Addr}
fmt.Println("Starting HTTP server on address: ", cfg.Addr)
_, _ = fmt.Println("Starting HTTP server on address: ", cfg.Addr)

go func() {
if err := server.ListenAndServe(); err != nil && err != http.ErrServerClosed {
Expand Down

0 comments on commit e013485

Please sign in to comment.