Skip to content

Commit

Permalink
chore: added github workflows
Browse files Browse the repository at this point in the history
  • Loading branch information
ilijamt committed Aug 21, 2022
1 parent dfc39cf commit a7799ea
Show file tree
Hide file tree
Showing 5 changed files with 170 additions and 0 deletions.
51 changes: 51 additions & 0 deletions .github/workflows/build.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
name: build & test

on:
push:
branches:
- main
- master
paths:
- "**.go"
pull_request:
branches:
- main
- master
paths:
- "**.go"

permissions:
contents: read

jobs:
build:
strategy:
matrix:
go: [1.18.x, 1.19.x]
os: [ubuntu-latest]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v3
- name: Setup Go ${{ matrix.go }}
uses: actions/setup-go@v3
with:
go-version: ${{ matrix.go }}
cache: true
- name: Display Go version
run: go version
- name: Install govulncheck@latest
run: go install golang.org/x/vuln/cmd/govulncheck@latest
- name: Scanning for dependencies with known vulnerabilities
run: govulncheck -v ./... | tee -a govulncheck-${{ matrix.go }}.log
- uses: actions/upload-artifact@v3
with:
name: govulncheck-${{ matrix.go }}
path: govulncheck-${{ matrix.go }}.log
- name: Build
run: go build -v ./cmd/vht
- name: Test
run: go test -v -json ./... | tee -a go-test-${{ matrix.go }}.json
- uses: actions/upload-artifact@v3
with:
name: go-test-${{ matrix.go }}
path: go-test-${{ matrix.go }}.json
46 changes: 46 additions & 0 deletions .github/workflows/codeql-analysis.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
name: "CodeQL Analysis"

on:
push:
branches:
- main
- master
paths:
- "**.go"
pull_request:
branches:
- master
- main
paths:
- "**.go"
schedule:
- cron: "34 8 * * 5"

jobs:
analyze:
name: Analyze
runs-on: ubuntu-latest
permissions:
actions: read
contents: read
security-events: write

strategy:
fail-fast: false
matrix:
language: ["go"]

steps:
- name: Checkout repository
uses: actions/checkout@v3

- name: Initialize CodeQL
uses: github/codeql-action/init@v2
with:
languages: ${{ matrix.language }}

- name: Autobuild
uses: github/codeql-action/autobuild@v2

- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v2
38 changes: 38 additions & 0 deletions .github/workflows/golangci-lint.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
name: golangci-lint

on:
push:
branches:
- main
- master
paths:
- "**.go"
pull_request:
branches:
- master
- main
paths:
- "**.go"

permissions:
contents: read

jobs:
golangci:
runs-on: ${{ matrix.os }}
strategy:
matrix:
go: [1.19]
os: [ubuntu-latest]
steps:
- uses: actions/checkout@v3
- name: Setup Go ${{ matrix.go }}
uses: actions/setup-go@v3
with:
go-version: ${{ matrix.go }}
- name: Display Go version
run: go version
- name: golangci-lint
uses: golangci/golangci-lint-action@v3
with:
version: latest
29 changes: 29 additions & 0 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
name: release

on:
push:
tags:
- "*"

jobs:
goreleaser:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Fetch all tags
run: git fetch --force --tags
- name: Set up Go
uses: actions/setup-go@v2
with:
go-version: 1.19
- name: Run GoReleaser
uses: goreleaser/goreleaser-action@v2
with:
distribution: goreleaser
version: latest
args: release --rm-dist
env:
GITHUB_TOKEN: ${{ secrets.GH_PAT }}
6 changes: 6 additions & 0 deletions .golangci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
issues:
exclude-rules:
- path: _test\.go
linters:
- errcheck
- staticcheck

0 comments on commit a7799ea

Please sign in to comment.