Code Analysis #224
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: "Code Analysis" | |
on: | |
push: | |
tags: | |
- v* | |
branches: | |
- main | |
pull_request: | |
schedule: | |
- cron: "0 0 * * 0" | |
concurrency: | |
group: ${{ format('{0}-{1}', github.workflow, github.head_ref) }} | |
cancel-in-progress: true | |
jobs: | |
CodeQL: | |
runs-on: ubuntu-latest | |
permissions: | |
security-events: write | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
- name: Initialize CodeQL | |
uses: github/codeql-action/init@v3 | |
with: | |
languages: go | |
- name: Perform CodeQL Analysis | |
uses: github/codeql-action/analyze@v3 | |
UnitTests: | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
go: | |
- "1.18" | |
- "1.19" | |
- "1.20" | |
- "1.21" | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
- name: Install Go | |
uses: actions/setup-go@v5 | |
with: | |
go-version: ${{ matrix.go }} | |
- name: gofmt | |
run: diff -u <(echo -n) <(gofmt -l . ) | |
- name: go vet | |
run: go vet ./... | |
- name: fieldalignment | |
run: go vet -vettool=$(which fieldalignment) ./... | |
- name: Run Unit Tests | |
run: go test -race -cover -coverprofile=coverage.out -covermode=atomic ./... | |
- name: Codecov | |
uses: codecov/[email protected] | |
with: | |
file: ./coverage.out |