Skip to content

Commit 3396e02

Browse files
authored
Move linting to Github Actions (#28)
This will display all the issues in the diff on Github which gives better developer experience.
1 parent 52e4b78 commit 3396e02

File tree

3 files changed

+56
-3
lines changed

3 files changed

+56
-3
lines changed

.ci/Jenkinsfile

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,6 @@ pipeline {
3838
dir("${BASE_DIR}"){
3939
withMageEnv(){
4040
sh(label: 'Mage check', script: 'mage -v check')
41-
sh(label: 'Lint Last Change on Darwin', script: 'GOOS=darwin mage -v llc')
42-
sh(label: 'Lint Last Change on Windows', script: 'GOOS=windows mage -v llc')
4341
}
4442
}
4543
}
Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
name: golangci-lint
2+
on:
3+
#push:
4+
# branches:
5+
# - main
6+
# - 8.*
7+
# - 7.17
8+
pull_request:
9+
permissions:
10+
contents: read
11+
# Optional: allow read access to pull request. Use with `only-new-issues` option.
12+
pull-requests: read
13+
jobs:
14+
golangci:
15+
strategy:
16+
matrix:
17+
include:
18+
- GOOS: windows
19+
- GOOS: linux
20+
- GOOS: darwin
21+
name: lint
22+
runs-on: ubuntu-latest
23+
steps:
24+
- name: Echo details
25+
env:
26+
GOOS: ${{ matrix.GOOS }}
27+
run: echo Go GOOS=$GOOS
28+
29+
- uses: actions/checkout@v2
30+
31+
# Uses Go version from the repository.
32+
- name: Read .go-version file
33+
id: goversion
34+
run: echo "::set-output name=version::$(cat .go-version)"
35+
36+
- uses: actions/setup-go@v2
37+
with:
38+
go-version: "${{ steps.goversion.outputs.version }}"
39+
40+
- name: golangci-lint
41+
env:
42+
GOOS: ${{ matrix.GOOS }}
43+
uses: golangci/golangci-lint-action@v2
44+
with:
45+
# Optional: version of golangci-lint to use in form of v1.2 or v1.2.3 or `latest` to use the latest version
46+
version: v1.44.2
47+
48+
# Give the job more time to execute.
49+
args: --timeout=5m
50+
51+
# Optional: if set to true then the action will use pre-installed Go.
52+
skip-go-installation: true
53+
54+
# Optional: show only new issues if it's a pull request. The default value is `false`.
55+
only-new-issues: true

magefile.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,6 @@ var Aliases = map[string]interface{}{
3636
// Check runs all the checks
3737
// nolint: deadcode,unparam // it's used as a `mage` target and requires returning an error
3838
func Check() error {
39-
mg.Deps(mage.Deps.CheckModuleTidy, mage.Linter.LastChange)
39+
mg.Deps(mage.Deps.CheckModuleTidy)
4040
return nil
4141
}

0 commit comments

Comments
 (0)