Skip to content

Commit

Permalink
chore(*): add a CI pipeline to check pull requests
Browse files Browse the repository at this point in the history
  • Loading branch information
caohe committed Mar 14, 2023
1 parent 0d758ec commit b003048
Show file tree
Hide file tree
Showing 4 changed files with 72 additions and 3 deletions.
58 changes: 58 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
name: CI

on:
push:
branches: [ main ]
pull_request:
branches: [ main ]
types: [ opened, edited, reopened, synchronize ]

jobs:
lint:
name: Lint
runs-on: ubuntu-18.04
steps:
- uses: actions/checkout@v3
- uses: actions/setup-go@v3
with:
go-version-file: go.mod
- name: Check Go modules
run: |
go mod tidy && git add go.* &&
git diff --cached --exit-code || (echo 'Please run "go mod tidy" to sync Go modules' && exit 1);
- name: Verify gofmt
run: |
make fmt && git add pkg cmd &&
git diff --cached --exit-code || (echo 'Please run "make fmt" to verify gofmt' && exit 1);
# TODO: enable the vet check once the existing vet issues have been resolved.
# - name: Verify govet
# run: |
# make vet && git add pkg cmd &&
# git diff --cached --exit-code || (echo 'Please run "make vet" to verify govet' && exit 1);
# TODO: enable the lint check once the existing lint issues have been resolved.
# - uses: golangci/golangci-lint-action@v3
# with:
# args: --verbose --timeout 5m
# version: v1.47.3

build:
name: Build
runs-on: ubuntu-18.04
steps:
- uses: actions/checkout@v3
- uses: actions/setup-go@v3
with:
go-version-file: go.mod
- name: Build
run: make all-binaries

unit-test:
name: Unit Test
runs-on: ubuntu-18.04
steps:
- uses: actions/checkout@v3
- uses: actions/setup-go@v3
with:
go-version-file: go.mod
- name: Coverage
run: sudo make test
1 change: 0 additions & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ on:
push:
branches: [ 'master', 'main', 'release-*' ]
# Publish semver tags as releases.
pull_request: {}
release:
types: [ 'published' ]

Expand Down
12 changes: 12 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,18 @@ clean-bin: ## Remove all generated binaries
rm -rf hack/tools/bin
rm -rf output

.PHONY: fmt
fmt: ## Run go fmt against code.
go fmt ./...

.PHONY: vet
vet: ## Run go vet against code.
go vet ./...

.PHONY: test
test: ## Run go vet against code.
go test -coverprofile coverage.out -covermode=atomic ./... -v


## --------------------------------------
## Build binaries and images
Expand Down
4 changes: 2 additions & 2 deletions pkg/agent/qrm-plugins/cpu/dynamicpolicy/cpuadvisor/cpu.pb.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/// Code generated by protoc-gen-gogo. DO NOT EDIT.
*/ // Code generated by protoc-gen-gogo. DO NOT EDIT.
// source: cpu.proto

package cpuadvisor
Expand All @@ -23,11 +23,11 @@ import (
_ "github.com/gogo/protobuf/gogoproto"
proto "github.com/gogo/protobuf/proto"
github_com_gogo_protobuf_sortkeys "github.com/gogo/protobuf/sortkeys"
v1alpha1 "k8s.io/kubelet/pkg/apis/resourceplugin/v1alpha1"
grpc "google.golang.org/grpc"
codes "google.golang.org/grpc/codes"
status "google.golang.org/grpc/status"
io "io"
v1alpha1 "k8s.io/kubelet/pkg/apis/resourceplugin/v1alpha1"
math "math"
math_bits "math/bits"
reflect "reflect"
Expand Down

0 comments on commit b003048

Please sign in to comment.