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 #17 from strvcom/refactor/SGO-114-workflows
Browse files Browse the repository at this point in the history
ci: update github workflows
  • Loading branch information
Tomáš Kocman authored Jan 9, 2023
2 parents 22b6050 + a78f99f commit 7f9ac58
Show file tree
Hide file tree
Showing 6 changed files with 86 additions and 71 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 .

0 comments on commit 7f9ac58

Please sign in to comment.