2020-12-17 01:11:22 +00:00
name : golangci-lint
2022-10-07 15:43:56 +00:00
2020-12-17 01:11:22 +00:00
on :
push :
branches :
- main
2021-10-18 21:49:32 +00:00
- patch-*
2021-11-18 23:14:29 +00:00
paths :
- '**.go'
2020-12-17 01:11:22 +00:00
pull_request :
2021-11-18 23:14:29 +00:00
paths :
- '**.go'
2022-09-12 23:32:43 +00:00
- '.github/workflows/golangci-lint.yml'
2022-03-03 20:15:17 +00:00
workflow_dispatch : # Manual
2022-10-24 20:01:00 +00:00
# This allows a subsequently queued workflow run to interrupt previous runs
concurrency :
group : ${{ github.workflow }}-${{ github.head_ref || github.run_id}}
cancel-in-progress : true
2022-10-07 15:43:56 +00:00
defaults :
run :
# fail-fast using bash -eo pipefail. See https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#exit-codes-and-error-action-preference
shell : bash
2022-03-15 18:44:30 +00:00
permissions :
contents : read
2020-12-17 01:11:22 +00:00
jobs :
golangci :
2022-03-15 18:44:30 +00:00
permissions :
contents : read # for actions/checkout to fetch code
2022-06-10 21:52:24 +00:00
pull-requests : read # for actions/checkout to fetch pull requests
2020-12-17 01:11:22 +00:00
name : lint
2023-02-21 17:30:45 +00:00
strategy :
fail-fast : false
matrix :
# See #9943, we just need to add windows-latest here once all issues are fixed.
os : [ ubuntu-latest, macos-latest]
2023-04-07 19:05:22 +00:00
go-version : [ '1.19.8' ]
2023-02-21 17:30:45 +00:00
runs-on : ${{ matrix.os }}
2020-12-17 01:11:22 +00:00
steps :
2023-02-21 17:30:45 +00:00
- name : Checkout code
uses : actions/checkout@2541b1294d2704b0964813337f33b291d3f8596b # v2
2022-06-10 21:52:24 +00:00
2023-02-21 17:30:45 +00:00
- name : Install Go
uses : actions/setup-go@268d8c0ca0432bb2cf416faae41297df9d262d7f
2022-04-04 20:14:05 +00:00
with :
2023-02-21 17:30:45 +00:00
go-version : ${{ matrix.go-version }}
2022-06-10 21:52:24 +00:00
2023-02-21 17:30:45 +00:00
- name : Install dependencies (Linux)
if : matrix.os == 'ubuntu-latest'
2022-06-10 21:52:24 +00:00
run : |
# The following packages are needed to build Fleet Desktop on Ubuntu.
2022-10-31 12:43:26 +00:00
sudo apt update -y && sudo apt install -y gcc libgtk-3-dev libayatana-appindicator3-dev
2023-02-21 17:30:45 +00:00
- name : Run go lint
run : |
2022-08-09 18:42:35 +00:00
# Don't forget to update
# docs/Contributing/Testing-and-local-development.md when this
# version changes
2023-02-21 17:30:45 +00:00
go install github.com/golangci/golangci-lint/cmd/golangci-lint@v1.51.1
2022-08-09 18:42:35 +00:00
make lint-go