Skip to content

Improve Go-linting in CI #2355

Improve Go-linting in CI

Improve Go-linting in CI #2355

Workflow file for this run

name: Lints
on:
pull_request:
push:
branches: [main]
repository_dispatch:
types: [ok-to-test]
jobs:
# A separate Go-Lint job since the current lint job is heavily
# coupled with a lot of tooling, which will be removed and
# simplified, one step at a time.
# For now, we are just extracting the go-lint.
go-lint:
strategy:
matrix:
os: [ ubuntu-latest ]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
- uses: actions/setup-go@v5
with:
go-version-file: go.work
- name: Setup Dummy WebUi Build
if: matrix.os == 'ubuntu-latest'
run: |
mkdir -p webui/build && touch webui/build/index.html
- uses: golangci/golangci-lint-action@v6
with:
skip-cache: true
lint:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set Go Version
shell: bash
run: |
set -euo pipefail
echo "GO_VER=$(cat .tool-versions | grep 'golang ' | cut -d' ' -f2)" >> $GITHUB_ENV
- name: Set Node Version
shell: bash
run: |
set -euo pipefail
echo "NODE_VER=$(cat .tool-versions | grep nodejs | cut -d' ' -f2)" >> $GITHUB_ENV
- name: Install asdf & tools
uses: asdf-vm/actions/install@v3
- name: Add asdf to PATH
shell: bash
run: |
set -euo pipefail
echo "~/.asdf/shims" >> $GITHUB_PATH
- name: Go Tidy
shell: bash
run: |
set -euo pipefail
go mod tidy
- name: Run pre-commit
shell: bash
run: |
set -euo pipefail
pre-commit run --show-diff-on-failure --color=always --all-files