refactor: refactor script for improved reliability and cleanup #857
This file contains hidden or 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: Lint and Testing | |
on: | |
push: | |
pull_request: | |
permissions: | |
actions: read | |
contents: read | |
statuses: write | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.ref }} | |
cancel-in-progress: true | |
jobs: | |
lint: | |
strategy: | |
matrix: | |
go: [stable] | |
os: [ubuntu-latest, macos-latest, windows-latest] | |
runs-on: ${{ matrix.os }} | |
name: ${{ matrix.os }} @ Go ${{ matrix.go }} | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Setup go | |
uses: actions/setup-go@v5 | |
with: | |
go-version: ${{ matrix.go }} | |
- name: Setup golangci-lint | |
uses: golangci/golangci-lint-action@v8 | |
with: | |
version: v2.1 | |
args: --verbose | |
test: | |
strategy: | |
matrix: | |
os: [ubuntu-latest, macos-latest] | |
go: [1.24] | |
include: | |
- os: ubuntu-latest | |
go-build: ~/.cache/go-build | |
- os: macos-latest | |
go-build: ~/Library/Caches/go-build | |
name: ${{ matrix.os }} @ Go ${{ matrix.go }} | |
runs-on: ${{ matrix.os }} | |
steps: | |
- name: Set up Go ${{ matrix.go }} | |
uses: actions/setup-go@v5 | |
with: | |
go-version: ${{ matrix.go }} | |
- name: Checkout Code | |
uses: actions/checkout@v4 | |
with: | |
ref: ${{ github.ref }} | |
- uses: actions/cache@v4 | |
with: | |
path: | | |
${{ matrix.go-build }} | |
~/go/pkg/mod | |
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }} | |
restore-keys: | | |
${{ runner.os }}-go- | |
- name: Run Tests | |
run: | | |
make test | |
- name: Upload coverage to Codecov | |
uses: codecov/codecov-action@v5 | |
with: | |
flags: ${{ matrix.os }},go-${{ matrix.go }} | |
commitlint: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- uses: wagoid/commitlint-github-action@v5 | |
vulnerability-scanning: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Run Trivy vulnerability scanner in repo mode | |
uses: aquasecurity/[email protected] | |
with: | |
scan-type: 'fs' | |
ignore-unfixed: true | |
format: 'sarif' | |
output: 'trivy-results.sarif' | |
exit-code: '1' | |
severity: 'CRITICAL,HIGH' | |
super-linter: | |
runs-on: ubuntu-latest | |
timeout-minutes: 60 | |
permissions: | |
contents: read | |
packages: read | |
# To report GitHub Actions status checks | |
statuses: write | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
# super-linter needs the full git history to get the | |
# list of files that changed across commits | |
fetch-depth: 0 | |
- name: "Super-linter" | |
uses: super-linter/super-linter/[email protected] | |
env: | |
# To report GitHub Actions status checks | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
DEFAULT_BRANCH: main | |
VALIDATE_BASH: true |