build: use golangci-lint-action instead of manual golangci-lint insta… #5
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: Lint | |
on: | |
push: | |
branches: | |
- master | |
pull_request: | |
workflow_dispatch: | |
permissions: | |
# These permissions are required by golangci-lint to create annotations for PRs. | |
# https://github.com/golangci/golangci-lint-action?tab=readme-ov-file | |
contents: read | |
pull-requests: read | |
checks: write | |
jobs: | |
lint-go: | |
name: Lint Go (${{ matrix.os }}) | |
runs-on: ${{ matrix.os }} | |
strategy: | |
matrix: | |
os: [ubuntu-latest, macos-latest, windows-latest] | |
fail-fast: false | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up Go | |
uses: actions/setup-go@v5 | |
with: | |
go-version-file: ./go.mod | |
- name: Run go version | |
run: go version | |
- name: Create placeholder asset | |
# go:embed requires the directory to exist and be non-empty | |
run: | | |
mkdir -p ./frontend/dist | |
touch ./frontend/dist/placeholder | |
- name: Run go linter | |
uses: golangci/golangci-lint-action@v4 | |
with: | |
version: v1.56 | |
lint-frontend: | |
name: Lint Frontend | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up Node | |
uses: actions/setup-node@v4 | |
with: | |
node-version-file: frontend/package.json | |
cache: 'npm' | |
cache-dependency-path: frontend/package-lock.json | |
- name: Run node --version | |
run: node --version | |
- name: Install frontend dependencies | |
run: npm ci | |
working-directory: frontend | |
- name: Run frontend linter | |
run: make lint-frontend |