Skip to content

Commit

Permalink
Add install script and add some workflows (#1)
Browse files Browse the repository at this point in the history
1. Add goreleaser.yml.

2. Add install script.

3. Add parameter "-v" when running benchmark, fixed missing benchmark
error when running some test cases.

4. Use structured logging for all logs.

5. Add release and golint workflows.

Signed-off-by: Wenqi Qiu <[email protected]>
  • Loading branch information
wenqiq authored Oct 21, 2021
1 parent 3d64bd3 commit 3abb559
Show file tree
Hide file tree
Showing 10 changed files with 567 additions and 14 deletions.
69 changes: 69 additions & 0 deletions .github/workflows/go.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
name: Go
on:
pull_request:
branches:
- main
push:
branches:
- main

env:
go-cache-name: go

jobs:
golangci-lint:
name: Golangci-lint
strategy:
matrix:
platform: [ubuntu-latest, macos-latest]
runs-on: ${{ matrix.platform }}
steps:
- name: Set up Go 1.17
uses: actions/setup-go@v2
with:
go-version: 1.17
- name: Check-out code
uses: actions/checkout@v2
- uses: actions/cache@v2
with:
# In order:
# * Module download cache
# * Build cache (Linux)
# * Build cache (Mac)
path: |
~/go/pkg/mod
~/.cache/go-build
~/Library/Caches/go-build
%LocalAppData%\go-build
key: ${{ runner.os }}-${{ env.go-cache-name }}-${{ hashFiles('**/go.sum') }}
restore-keys: |
${{ runner.os }}-${{ env.go-cache-name }}-
- name: Run golangci-lint
run: make golangci

bin:
name: Build benchci binaries
runs-on: [ubuntu-latest]
steps:
- name: Set up Go 1.17
uses: actions/setup-go@v2
with:
go-version: 1.17
- name: Check-out code
uses: actions/checkout@v2
- uses: actions/cache@v2
with:
# In order:
# * Module download cache
# * Build cache (Linux)
# * Build cache (Mac)
path: |
~/go/pkg/mod
~/.cache/go-build
~/Library/Caches/go-build
%LocalAppData%\go-build
key: ${{ runner.os }}-${{ env.go-cache-name }}-${{ hashFiles('**/go.sum') }}
restore-keys: |
${{ runner.os }}-${{ env.go-cache-name }}-
- name: Build benchci binaries
run: make bin
29 changes: 29 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
name: Upload release files
on:
push:
tags:
- v*

jobs:
goReleaser:
name: UploadRelease
runs-on: ubuntu-latest
steps:
- name: Set up Go 1.17
uses: actions/setup-go@v2
with:
go-version: 1.17

- name: Check out code into the Go module directory
uses: actions/checkout@v2
with:
fetch-depth: 0

- name: Run goreleaser
uses: goreleaser/goreleaser-action@v2
with:
distribution: goreleaser
version: latest
args: release --rm-dist
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
6 changes: 5 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
bin

# Emacs save files
*~
*~
dist/

.idea/
vendor/
33 changes: 33 additions & 0 deletions .golangci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
# golangci-lint configuration used for CI
run:
tests: true
timeout: 10m
skip-files:
- ".*\\.pb\\.go"
skip-dirs-use-default: true

linters-settings:
goimports:
local-prefixes: antrea.io/benchci
revive:
ignore-generated-header: false
severity: warning
confidence: 0.8
rules:
- name: unreachable-code
- name: errorf
- name: range
- name: superfluous-else
- name: var-declaration

linters:
disable-all: true
enable:
- misspell
- gofmt
- deadcode
- staticcheck
- gosec
- goimports
- vet
- revive
22 changes: 22 additions & 0 deletions .goreleaser.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
builds:
- env:
- CGO_ENABLED=0
goos:
- linux
- windows
- darwin
archives:
- name_template: "{{ .ProjectName }}-{{ .Os }}-{{ .Arch }}"
replacements:
386: i386
amd64: x86_64
checksum:
name_template: 'checksums.txt'
snapshot:
name_template: "{{ incpatch .Version }}-next"
changelog:
sort: asc
filters:
exclude:
- '^docs:'
- '^test:'
1 change: 1 addition & 0 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,5 @@ require (
golang.org/x/tools v0.1.5
gopkg.in/src-d/go-git.v4 v4.13.1
gopkg.in/yaml.v2 v2.4.0
k8s.io/klog/v2 v2.20.0
)
4 changes: 4 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ github.com/emirpasic/gods v1.12.0/go.mod h1:YfzfFFoVP/catgzJb4IKIqXjX78Ha8FMSDh3
github.com/flynn/go-shlex v0.0.0-20150515145356-3f9db97f8568/go.mod h1:xEzjJPgXI435gkrCt3MPfRiAkVrwSbHsst4LCFVfpJc=
github.com/gliderlabs/ssh v0.2.2 h1:6zsha5zo/TWhRhwqCD3+EarCAgZ2yN28ipRnGPnwkI0=
github.com/gliderlabs/ssh v0.2.2/go.mod h1:U7qILu1NlMHj9FlMhZLlkCdDnU1DBEAqr0aevW3Awn0=
github.com/go-logr/logr v1.0.0 h1:kH951GinvFVaQgy/ki/B3YYmQtRpExGigSJg6O8z5jo=
github.com/go-logr/logr v1.0.0/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A=
github.com/google/go-cmp v0.3.0 h1:crn/baboCvb5fXaQ0IJ1SGTsTVrWpDsCWC8EGETZijY=
github.com/google/go-cmp v0.3.0/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU=
github.com/jbenet/go-context v0.0.0-20150711004518-d14ea06fba99 h1:BQSFePA1RWJOlocH6Fxy8MmwDt+yVQYULKfN0RoTN8A=
Expand Down Expand Up @@ -95,3 +97,5 @@ gopkg.in/warnings.v0 v0.1.2 h1:wFXVbFY8DY5/xOe1ECiWdKCzZlxgshcYVNkBHstARME=
gopkg.in/warnings.v0 v0.1.2/go.mod h1:jksf8JmL6Qr/oQM2OXTHunEvvTAsrWBLb6OOjuVWRNI=
gopkg.in/yaml.v2 v2.4.0 h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY=
gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ=
k8s.io/klog/v2 v2.20.0 h1:tlyxlSvd63k7axjhuchckaRJm+a92z5GSOrTOQY5sHw=
k8s.io/klog/v2 v2.20.0/go.mod h1:Gm8eSIfQN6457haJuPaMxZw4wyP5k+ykPFlrhQDvhvw=
Loading

0 comments on commit 3abb559

Please sign in to comment.