2023-03-28 21:29:27 +00:00
|
|
|
name: reusable-lint
|
|
|
|
|
|
|
|
on:
|
|
|
|
workflow_call:
|
|
|
|
inputs:
|
|
|
|
go-arch:
|
|
|
|
required: false
|
|
|
|
type: string
|
|
|
|
default: ""
|
|
|
|
runs-on:
|
|
|
|
description: An expression indicating which kind of runners to use.
|
|
|
|
required: true
|
|
|
|
type: string
|
2023-03-30 16:57:11 +00:00
|
|
|
repository-name:
|
|
|
|
required: true
|
|
|
|
type: string
|
|
|
|
secrets:
|
|
|
|
elevated-github-token:
|
|
|
|
required: true
|
2023-03-28 21:29:27 +00:00
|
|
|
env:
|
2023-03-30 16:57:11 +00:00
|
|
|
GOTAGS: "${{ github.event.repository.name == 'consul-enterprise' && 'consulent consulprem consuldev' || '' }}"
|
2023-03-28 21:29:27 +00:00
|
|
|
GOARCH: ${{inputs.go-arch}}
|
2023-06-21 15:26:27 +00:00
|
|
|
GOPRIVATE: github.com/hashicorp # Required for enterprise deps
|
2023-03-28 21:29:27 +00:00
|
|
|
|
|
|
|
jobs:
|
|
|
|
lint:
|
|
|
|
runs-on: ${{ fromJSON(inputs.runs-on) }}
|
|
|
|
strategy:
|
|
|
|
matrix:
|
|
|
|
directory:
|
|
|
|
- ""
|
|
|
|
- "api"
|
|
|
|
- "sdk"
|
|
|
|
- "envoyextensions"
|
|
|
|
- "troubleshoot"
|
|
|
|
- "test/integration/consul-container"
|
|
|
|
fail-fast: true
|
|
|
|
name: lint ${{ matrix.directory }}
|
|
|
|
steps:
|
2023-06-13 17:00:55 +00:00
|
|
|
- uses: actions/checkout@8e5e7e5ab8b370d6c329ec480221332ada57f0ab # v3.5.2
|
2023-03-30 16:57:11 +00:00
|
|
|
# NOTE: This step is specifically needed for ENT. It allows us to access the required private HashiCorp repos.
|
|
|
|
- name: Setup Git
|
|
|
|
if: ${{ endsWith(inputs.repository-name, '-enterprise') }}
|
|
|
|
run: git config --global url."https://${{ secrets.elevated-github-token }}:@github.com".insteadOf "https://github.com"
|
2023-06-13 17:00:55 +00:00
|
|
|
- uses: actions/setup-go@fac708d6674e30b6ba41289acaab6d4b75aa0753 # v4.0.1
|
2023-03-28 21:29:27 +00:00
|
|
|
with:
|
|
|
|
go-version-file: 'go.mod'
|
|
|
|
- run: go env
|
|
|
|
- name: lint-${{ matrix.directory }}
|
2023-06-13 17:00:55 +00:00
|
|
|
uses: golangci/golangci-lint-action@08e2f20817b15149a52b5b3ebe7de50aff2ba8c5 # v3.4.0
|
2023-03-28 21:29:27 +00:00
|
|
|
with:
|
|
|
|
working-directory: ${{ matrix.directory }}
|
2023-04-19 16:19:29 +00:00
|
|
|
version: v1.51.1
|
2023-03-28 21:29:27 +00:00
|
|
|
args: --build-tags="${{ env.GOTAGS }}" -v
|
2023-05-25 14:24:07 +00:00
|
|
|
skip-cache: true
|
2023-03-28 21:29:27 +00:00
|
|
|
- name: Notify Slack
|
2023-03-30 16:57:11 +00:00
|
|
|
if: ${{ failure() }}
|
2023-03-28 21:29:27 +00:00
|
|
|
run: .github/scripts/notify_slack.sh
|