Skip to content

fix issue120 and issue103: add mutex to prevent data race in websocket write message and use named return values for WritePkg method #204

fix issue120 and issue103: add mutex to prevent data race in websocket write message and use named return values for WritePkg method

fix issue120 and issue103: add mutex to prevent data race in websocket write message and use named return values for WritePkg method #204

name: CI
on:
push:
branches: [ master ]
pull_request:
branches: "*"
jobs:
build:
name: Build
runs-on: ${{ matrix.os }}
strategy:
# If you want to matrix build , you can append the following list.
matrix:
go_version:
- '1.20'
os:
- ubuntu-latest
env:
# DING_TOKEN: db178ff8c63cdc1b9ae0b86f7c4006ddf35e0249f4ae03441d80e55fdc600419
# DING_SIGN: SECbcc50d56d7315e57da8469d05da306d6cd825348a781861a42084e9579f1aebb
DING_TOKEN: ${{ secrets.DING_TOKEN }}
DING_SIGN: ${{ secrets.DING_SIGN }}
steps:
- name: Set up Go ${{ matrix.go_version }}
uses: actions/setup-go@v2
with:
go-version: ${{ matrix.go_version }}
id: go
- name: Check out code into the Go module directory
uses: actions/checkout@v2
- name: Cache Go Dependence
uses: actions/cache@v2
with:
path: ~/go/pkg/mod
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
restore-keys: ${{ runner.os }}-go-
- name: Get dependencies
run: |
if [ -f Gopkg.toml ]; then
curl https://raw.githubusercontent.com/golang/dep/master/install.sh | sh
dep ensure
else
go get -v -t -d ./...
fi
- name: License Check
run: |
sh before_validate_license.sh
chmod u+x /tmp/tools/license/license-header-checker
go fmt ./... && [[ -z `git status -s` ]]
/tmp/tools/license/license-header-checker -v -a -r -i vendor /tmp/tools/license/license.txt . go && [[ -z `git status -s` ]]
- name: Install go ci lint
run: curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(go env GOPATH)/bin v1.56.0
- name: Run Linter
run: golangci-lint run --timeout=10m -v --disable-all --enable=govet --enable=staticcheck --enable=ineffassign --enable=misspell
- name: Test
run: go mod vendor && go test $(go list ./... | grep -v vendor | grep -v demo) -coverprofile=coverage.txt -covermode=atomic
- name: Coverage
run: bash <(curl -s https://codecov.io/bash)
# # Because the contexts of push and PR are different, there are two Notify.
# # Notifications are triggered only in the apache/dubbo-getty repository.
# - name: DingTalk Message Notify only Push
# uses: zcong1993/[email protected]
# # Whether job is successful or not, always () is always true.
# if: |
# always() &&
# github.event_name == 'push' &&
# github.repository == 'apache/dubbo-getty'
# with:
# # DingDing bot token
# dingToken: ${{ env.DING_TOKEN }}
# secret: ${{ env.DING_SIGN }}
# # Post Body to send
# body: |
# {
# "msgtype": "markdown",
# "markdown": {
# "title": "Github Actions",
# "text": "## Github Actions \n - name: CI \n - repository: ${{ github.repository }} \n - trigger: ${{ github.actor }} \n - event: ${{ github.event_name }} \n - ref: ${{ github.ref }} \n - status: [${{ job.status }}](https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}) \n - environment: ${{ runner.os }} \n - SHA: [${{ github.sha }}](${{ github.event.compare }})"
# }
# }
#
# - name: DingTalk Message Notify only PR
# uses: zcong1993/[email protected]
# if: |
# always() &&
# github.event_name == 'pull_request' &&
# github.repository == 'apache/dubbo-getty'
# with:
# dingToken: ${{ env.DING_TOKEN }}
# secret: ${{ env.DING_SIGN }}
# body: |
# {
# "msgtype": "markdown",
# "markdown": {
# "title": "Github Actions",
# "text": "## Github Actions \n - name: CI \n - repository: ${{ github.repository }} \n - pr_title: **${{ github.event.pull_request.title }}** \n - trigger: ${{ github.actor }} \n - event: ${{ github.event_name }} \n - ref: [${{ github.ref }}](${{ github.event.pull_request._links.html.href }}) \n - status: [${{ job.status }}](https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}) \n - environment: ${{ runner.os }} \n > SHA: [${{ github.sha }}](${{ github.event.pull_request._links.html.href }})"
# }
# }