forked from contiv/ofnet
-
Notifications
You must be signed in to change notification settings - Fork 18
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix linter issues, add Makefile targets, add CI jobs (#1)
Signed-off-by: Antonin Bas <[email protected]>
- Loading branch information
1 parent
692753c
commit fc668b9
Showing
15 changed files
with
231 additions
and
78 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
name: Go | ||
on: | ||
pull_request: | ||
branches: | ||
- main | ||
push: | ||
branches: | ||
- main | ||
|
||
jobs: | ||
# test: | ||
# runs-on: [ubuntu-latest] | ||
# steps: | ||
# - name: Set up Go 1.15 | ||
# uses: actions/setup-go@v1 | ||
# with: | ||
# go-version: 1.15 | ||
# - name: Check-out code | ||
# uses: actions/checkout@v2 | ||
# - name: Run unit tests | ||
# run: | | ||
# make test | ||
|
||
tidy: | ||
runs-on: [ubuntu-latest] | ||
steps: | ||
- name: Set up Go 1.15 | ||
uses: actions/setup-go@v1 | ||
with: | ||
go-version: 1.15 | ||
- name: Check-out code | ||
uses: actions/checkout@v2 | ||
- name: Check tidiness | ||
run: | | ||
./ci/check-tidy.sh | ||
golangci: | ||
runs-on: [ubuntu-latest] | ||
steps: | ||
- name: Check-out code | ||
uses: actions/checkout@v2 | ||
- name: Run code linters | ||
run: | | ||
make golangci |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
name: Release | ||
on: | ||
push: | ||
branches: | ||
- main | ||
paths: | ||
- 'VERSION' | ||
|
||
jobs: | ||
release: | ||
runs-on: [ubuntu-latest] | ||
steps: | ||
- name: Check-out code | ||
uses: actions/checkout@v2 | ||
- name: Read version | ||
run: | | ||
echo "version=$(head VERSION)" >> $GITHUB_ENV | ||
- name: Create release | ||
uses: ncipollo/release-action@v1 | ||
with: | ||
omitBody: true | ||
token: "${{ secrets.GITHUB_TOKEN }}" | ||
tag: "${{ env.version }}" | ||
commit: "${{ env.GITHUB_SHA }}" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,13 @@ | ||
# vagrant | ||
.vagrant | ||
cscope* | ||
.cache | ||
.golangci-bin | ||
|
||
.DS_Store | ||
|
||
# VIM | ||
.*.swp | ||
|
||
# Emacs | ||
*~ | ||
|
||
.idea/ | ||
.vscode/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
run: | ||
tests: true | ||
timeout: 5m | ||
skip-files: | ||
- ".*\\.pb\\.go" | ||
skip-dirs-use-default: true | ||
|
||
linters-settings: | ||
goimports: | ||
local-prefixes: antrea.io/ofnet | ||
|
||
linters: | ||
disable-all: true | ||
enable: # see https://golangci-lint.run/usage/linters/ | ||
- deadcode | ||
- staticcheck | ||
- govet | ||
- gofmt | ||
- goimports | ||
- gosec | ||
- misspell | ||
|
||
run: | ||
deadline: 5m |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,22 @@ | ||
# TODO | ||
GO ?= go | ||
|
||
all: test | ||
|
||
.PHONY: test | ||
test: | ||
$(GO) test -v ./... | ||
|
||
# code linting | ||
.golangci-bin: | ||
@echo "===> Installing Golangci-lint <===" | ||
@curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $@ v1.41.1 | ||
|
||
.PHONY: golangci | ||
golangci: .golangci-bin | ||
@echo "===> Running golangci <===" | ||
@GOOS=linux .golangci-bin/golangci-lint run -c .golangci.yml | ||
|
||
.PHONY: golangci-fix | ||
golangci-fix: .golangci-bin | ||
@echo "===> Running golangci-fix <===" | ||
@GOOS=linux .golangci-bin/golangci-lint run -c .golangci.yml --fix |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
v0.1.0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
#!/usr/bin/env bash | ||
|
||
set -e | ||
|
||
: "${GO:=go}" | ||
|
||
goversion=$($GO version) | ||
|
||
$GO mod tidy | ||
|
||
rc=0 | ||
diff=$(git diff --exit-code -- go.mod go.sum) || rc=$? | ||
|
||
if [ $rc -ne 0 ]; then | ||
echo "Found some differences when running 'go mod tidy'" | ||
echo "**********" | ||
echo "$diff" | ||
echo "**********" | ||
echo "Please ensure you are using the correct version of go ($goversion), run 'go mod tidy', and commit the changes" | ||
fi | ||
|
||
exit $rc |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,6 +2,7 @@ package ofctrl | |
|
||
import ( | ||
"fmt" | ||
|
||
"antrea.io/libOpenflow/openflow13" | ||
"antrea.io/libOpenflow/util" | ||
) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.