Skip to content

Commit

Permalink
Merge pull request #953 from mmorel-35/lint
Browse files Browse the repository at this point in the history
ci(lint): setup lint job
  • Loading branch information
squeed committed Jan 30, 2023
2 parents c560394 + da8672c commit f89a8c6
Show file tree
Hide file tree
Showing 48 changed files with 243 additions and 205 deletions.
2 changes: 1 addition & 1 deletion .github/actions/retest-action/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,4 @@ runs:
using: 'docker'
image: 'Dockerfile'
env:
GITHUB_TOKEN: ${{ inputs.token }}
GITHUB_TOKEN: ${{ inputs.token }}
16 changes: 8 additions & 8 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,19 +5,19 @@

version: 2
updates:
- package-ecosystem: "docker" # See documentation for possible values
directory: "/.github/actions/retest-action" # Location of package manifests
- package-ecosystem: "docker"
directory: "/.github/actions/retest-action"
schedule:
interval: "weekly"
- package-ecosystem: "github-actions" # See documentation for possible values
directory: "/" # Location of package manifests
- package-ecosystem: "github-actions"
directory: "/"
schedule:
interval: "weekly"
- package-ecosystem: "gomod" # See documentation for possible values
directory: "/" # Location of package manifests
- package-ecosystem: "gomod"
directory: "/"
schedule:
interval: "weekly"
- package-ecosystem: "gomod" # See documentation for possible values
directory: "/plugins/debug" # Location of package manifests
- package-ecosystem: "gomod"
directory: "/plugins/debug"
schedule:
interval: "weekly"
16 changes: 16 additions & 0 deletions .github/workflows/test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,22 @@ env:
LINUX_ARCHES: "amd64 386 arm arm64 s390x mips64le ppc64le"

jobs:
lint:
name: Lint
runs-on: ubuntu-latest
steps:
- name: setup go
uses: actions/setup-go@v3
with:
go-version: ${{ env.GO_VERSION }}
- uses: actions/checkout@v3
- uses: ibiqlik/action-yamllint@v3
with:
format: auto
- uses: golangci/golangci-lint-action@v3
build:
name: Build all linux architectures
needs: lint
runs-on: ubuntu-latest
steps:
- name: setup go
Expand All @@ -28,6 +42,7 @@ jobs:
test-linux:
name: Run tests on Linux amd64
needs: build
runs-on: ubuntu-latest
steps:
- name: setup go
Expand Down Expand Up @@ -56,6 +71,7 @@ jobs:
test-win:
name: Build and run tests on Windows
needs: build
runs-on: windows-latest
steps:
- name: setup go
Expand Down
15 changes: 15 additions & 0 deletions .golangci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
linters:
enable:
- gci
- gofmt
- gofumpt
- govet
- misspell
- nolintlint

linters-settings:
gci:
sections:
- standard
- default
- prefix(github.com/containernetworking/cni)
9 changes: 9 additions & 0 deletions .yamllint
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
---
extends: default

rules:
document-start: disable
truthy:
ignore: |
.github/workflows/*.yml
.github/workflows/*.yaml
4 changes: 2 additions & 2 deletions libcni/api.go
Original file line number Diff line number Diff line change
Expand Up @@ -255,11 +255,11 @@ func (c *CNIConfig) cacheAdd(result types.Result, config []byte, netName string,
if err != nil {
return err
}
if err := os.MkdirAll(filepath.Dir(fname), 0700); err != nil {
if err := os.MkdirAll(filepath.Dir(fname), 0o700); err != nil {
return err
}

return os.WriteFile(fname, newBytes, 0600)
return os.WriteFile(fname, newBytes, 0o600)
}

func (c *CNIConfig) cacheDel(netName string, rt *RuntimeConf) error {
Expand Down
Loading

0 comments on commit f89a8c6

Please sign in to comment.