zitadel/.github/workflows/lint.yml
Elio Bischof d95c9508a3
chore(lint): print error locations (#8246)
# Which Problems Are Solved

If golangci-lint fails, it is hard to find out how to fix it.

# How the Problems Are Solved

The official GitHub action for golangci-lint is upgraded from v4 to
[v6](https://github.com/golangci/golangci-lint-action/releases/tag/v6.0.1).

## Before Upgrade

![image](https://github.com/zitadel/zitadel/assets/12727842/d25bcb0d-5e86-4f8d-92e9-f24e53319062)

## After Upgrade

![image](https://github.com/zitadel/zitadel/assets/12727842/91c6c9ff-832b-49f5-ba92-ff835d8179c0)

# Additional Changes

Removes the config properties `skip-pkg-cache` and `skip-build-cache` as
support was removed with
[v5](https://github.com/golangci/golangci-lint-action/releases/tag/v5.0.0).

---------

Co-authored-by: Silvan <silvan.reusser@gmail.com>
2024-07-17 07:20:45 +00:00

103 lines
2.3 KiB
YAML

name: Lint
on:
workflow_call:
inputs:
node_version:
required: true
type: string
go_version:
required: true
type: string
buf_version:
required: true
type: string
go_lint_version:
required: true
type: string
core_cache_key:
required: true
type: string
core_cache_path:
required: true
type: string
jobs:
lint-skip:
name: lint skip
runs-on: ubuntu-latest
if: ${{ github.event_name != 'pull_request' }}
steps:
- name: Lint skip
run: |
echo "Linting outside of pull requests is skipped"
api:
name: api
runs-on: ubuntu-latest
continue-on-error: true
if: ${{ github.event_name == 'pull_request' }}
steps:
-
uses: actions/checkout@v4
-
uses: bufbuild/buf-setup-action@v1
with:
version: ${{ inputs.buf_version }}
github_token: ${{ secrets.GITHUB_TOKEN }}
-
name: lint
uses: bufbuild/buf-lint-action@v1
-
uses: bufbuild/buf-breaking-action@v1
with:
against: "https://github.com/${{ github.repository }}.git#branch=${{ github.base_ref }}"
console:
if: ${{ github.event_name == 'pull_request' }}
name: console
runs-on: ubuntu-latest
steps:
-
name: Checkout
uses: actions/checkout@v4
-
uses: actions/setup-node@v4
with:
node-version: ${{ inputs.node_version }}
cache: 'yarn'
cache-dependency-path: console/yarn.lock
-
run: cd console && yarn install
-
name: lint
run: make console_lint
core:
name: core
runs-on: ubuntu-latest
if: ${{ github.event_name == 'pull_request' }}
steps:
-
name: Checkout
uses: actions/checkout@v4
-
uses: actions/setup-go@v5
with:
go-version: ${{ inputs.go_version }}
-
uses: actions/cache/restore@v4
timeout-minutes: 1
name: restore core
with:
path: ${{ inputs.core_cache_path }}
key: ${{ inputs.core_cache_key }}
fail-on-cache-miss: true
-
uses: golangci/golangci-lint-action@v6
with:
version: ${{ inputs.go_lint_version }}
github-token: ${{ github.token }}
only-new-issues: true