diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..a42ea7a --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,58 @@ +name: Tests + +on: + push: + branches: + - master + pull_request: + branches: + - master + +env: + GO111MODULE: on + GOPROXY: "https://proxy.golang.org" + +jobs: + test: + name: Go-Test + strategy: + fail-fast: false + matrix: + go: [1.14.x, 1.15.x] + os: [ubuntu-latest, macos-latest, windows-latest] + runs-on: ${{ matrix.os}} + steps: + - name: Installing Go + uses: actions/setup-go@v1 + with: + go-version: ${{ matrix.go }} + - name: Checkout code + uses: actions/checkout@v2 + - name: Run unit tests + run: go test -race -coverprofile=coverage -covermode=atomic -v + - name: Upload code coverage report to Codecov + uses: codecov/codecov-action@v1.2.1 + with: + file: ./coverage + flags: unittests + verbose: true + name: codecov-ants + - name: Print Go environment + id: vars + run: | + printf "Using go at: $(which go)\n" + printf "Go version: $(go version)\n" + printf "\n\nGo environment:\n\n" + go env + printf "\n\nSystem environment:\n\n" + env + # Calculate the short SHA1 hash of the git commit + echo "::set-output name=short_sha::$(git rev-parse --short HEAD)" + echo "::set-output name=go_cache::$(go env GOCACHE)" + - name: Cache go modules + uses: actions/cache@v2 + with: + path: ${{ steps.vars.outputs.go_cache }} + key: ${{ runner.os }}-${{ matrix.go }}-go-ci-${{ hashFiles('**/go.sum') }} + restore-keys: | + ${{ runner.os }}-${{ matrix.go }}-go-ci diff --git a/.github/workflows/codeql.yml b/.github/workflows/codeql.yml new file mode 100644 index 0000000..f9609c6 --- /dev/null +++ b/.github/workflows/codeql.yml @@ -0,0 +1,45 @@ +name: CodeQL + +on: + push: + branches: [master] + pull_request: + branches: [master] + schedule: + - cron: '0 5 * * 6' + +jobs: + analyze: + name: Analyze + runs-on: ubuntu-latest + + steps: + - name: Checkout repository + uses: actions/checkout@v2 + with: + # We must fetch at least the immediate parents so that if this is + # a pull request then we can checkout the head. + fetch-depth: 2 + + # Initializes the CodeQL tools for scanning. + - name: Initialize CodeQL + uses: github/codeql-action/init@v1 + + # Autobuild attempts to build any compiled languages (C/C++, C#, or Java). + # If this step fails, then you should remove it and run the build manually (see below) + - name: Autobuild + uses: github/codeql-action/autobuild@v1 + + # ℹ️ Command-line programs to run using the OS shell. + # 📚 https://git.io/JvXDl + + # ✏️ If the Autobuild fails above, remove it and uncomment the following three lines + # and modify them (or add more) to build your code if your project + # uses a compiled language + + #- run: | + # make bootstrap + # make release + + - name: Perform CodeQL Analysis + uses: github/codeql-action/analyze@v1 \ No newline at end of file diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml new file mode 100644 index 0000000..6798c93 --- /dev/null +++ b/.github/workflows/lint.yml @@ -0,0 +1,20 @@ +name: Lint + +on: + push: + branches: + - master + pull_request: + branches: + - master + +jobs: + golangci: + name: Golangci-Lint + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - name: Run golangci-lint + uses: golangci/golangci-lint-action@v2 + with: + version: v1.29 diff --git a/README.md b/README.md index 94d13ef..3df321c 100644 --- a/README.md +++ b/README.md @@ -2,7 +2,7 @@ A goroutine pool for Go

- + diff --git a/README_ZH.md b/README_ZH.md index 00b999e..610747e 100644 --- a/README_ZH.md +++ b/README_ZH.md @@ -2,7 +2,7 @@ Go 语言的 goroutine 池

- +