From 29360cb103dc0d9948bbe8417b13c6889c2834eb Mon Sep 17 00:00:00 2001 From: andeya Date: Sat, 10 Dec 2022 02:02:39 +0800 Subject: [PATCH] style: improved ci Change-Id: I049c62d0408a7bee322194138bc5790bfe080596 --- .../{golangci-lint.yml => go-ci.yml} | 17 ++++++-- .github/workflows/go.yml | 39 ------------------- .gitignore | 1 + Makefile | 6 +-- 4 files changed, 17 insertions(+), 46 deletions(-) rename .github/workflows/{golangci-lint.yml => go-ci.yml} (75%) delete mode 100644 .github/workflows/go.yml diff --git a/.github/workflows/golangci-lint.yml b/.github/workflows/go-ci.yml similarity index 75% rename from .github/workflows/golangci-lint.yml rename to .github/workflows/go-ci.yml index fade44d..645d635 100644 --- a/.github/workflows/golangci-lint.yml +++ b/.github/workflows/go-ci.yml @@ -1,4 +1,4 @@ -name: golangci-lint +name: go-ci on: push: @@ -7,14 +7,23 @@ on: pull_request: jobs: - golangci: - name: lint + test-and-lint: + name: test-and-lint runs-on: ubuntu-latest steps: - uses: actions/setup-go@v3 with: go-version: 1.19.4 - uses: actions/checkout@v3 + - name: Test + run: make coverage + - name: Codecov + uses: codecov/codecov-action@v3 + with: + token: ${{ secrets.CODECOV_TOKEN }} + file: ./cover.out + flags: unittests + verbose: true - name: golangci-lint uses: golangci/golangci-lint-action@v3 with: @@ -25,7 +34,7 @@ jobs: working-directory: ./ # Optional: golangci-lint command line arguments. - args: --timeout 600s --max-same-issues 50 + args: --print-resources-usage --fast --timeout 20m0s --max-same-issues 50 # Optional: show only new issues if it's a pull request. The default value is `false`. # only-new-issues: true diff --git a/.github/workflows/go.yml b/.github/workflows/go.yml deleted file mode 100644 index e97ee52..0000000 --- a/.github/workflows/go.yml +++ /dev/null @@ -1,39 +0,0 @@ -# This workflow will build a golang project -# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-go - -name: Go - -on: - push: - tags: - branches: - pull_request: - -jobs: - - build: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v3 - - - name: Set up Go - uses: actions/setup-go@v3 - with: - go-version: 1.19.4 - - - name: Build - run: make build - - - name: Test - run: make test - - - name: Test - run: make coverage - - - name: Codecov - uses: codecov/codecov-action@v3 - with: - token: ${{ secrets.CODECOV_TOKEN }} - file: ./cover.out - flags: unittests - verbose: true \ No newline at end of file diff --git a/.gitignore b/.gitignore index 8037d85..0cf9c73 100644 --- a/.gitignore +++ b/.gitignore @@ -16,3 +16,4 @@ .idea /iter1/ +cover.html diff --git a/Makefile b/Makefile index 6418225..46f9a3b 100644 --- a/Makefile +++ b/Makefile @@ -15,7 +15,7 @@ watch-bench: reflex -t 50ms -s -- sh -c 'go test -benchmem -count 3 -bench ./...' coverage: - ${BIN} test -v -coverprofile=cover.out -covermode=atomic . + ${BIN} test -v -coverprofile=cover.out -covermode=atomic ./... ${BIN} tool cover -html=cover.out -o cover.html # tools @@ -30,9 +30,9 @@ tools: go mod tidy lint: - golangci-lint run --timeout 600s --max-same-issues 50 ./... + golangci-lint run --print-resources-usage --fast --timeout 20m0s --max-same-issues 50 ./... lint-fix: - golangci-lint run --timeout 600s --max-same-issues 50 --fix ./... + golangci-lint run --print-resources-usage --fast --timeout 20m0s --max-same-issues 50 --fix ./... audit: ${BIN} mod tidy