github.com/dubbogo/gost@v1.14.0/.github/workflows/github-actions.yml (about)

     1  name: CI
     2  
     3  on:
     4    push:
     5      branches: [ master ]
     6    pull_request:
     7      branches: "*"
     8    pull_request_target:
     9      branches: "*"
    10  
    11  jobs:
    12    build:
    13      name: ${{ matrix.os }} - Go${{ matrix.go_version }} - JDK${{ matrix.jdk_version }}
    14  
    15      runs-on: ${{ matrix.os }}
    16  
    17      strategy:
    18        matrix:
    19          os:
    20            - ubuntu-latest
    21          go_version:
    22            - 1.16
    23      env:
    24        DING_TOKEN: ${{ secrets.DING_TOKEN }}
    25        DING_SIGN: ${{ secrets.DING_SIGN }}
    26  
    27      steps:
    28      - uses: actions/checkout@v2
    29  
    30      - name: Set up Go ${{ matrix.go_version }}
    31        uses: actions/setup-go@v2
    32        with:
    33          go-version: ${{ matrix.go_version }}
    34        id: go
    35  
    36      - name: Cache Go Dependence
    37        uses: actions/cache@v2
    38        with:
    39          path: ~/go/pkg/mod
    40          key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
    41          restore-keys: ${{ runner.os }}-go-
    42  
    43      - name: Get dependencies
    44        run: |
    45          if [ -f Gopkg.toml ]; then
    46              curl https://raw.githubusercontent.com/golang/dep/master/install.sh | sh
    47              dep ensure
    48          else
    49              go get -v -t -d ./...
    50          fi
    51  
    52      - name: format
    53        run: |
    54          gofmt -l -w . && [[ -z `git status -s` ]]
    55  
    56      - name: License Check
    57        run: |
    58          go fmt ./... && [[ -z `git status -s` ]]
    59          sh before_validate_license.sh
    60          chmod u+x /tmp/tools/license/license-header-checker
    61          /tmp/tools/license/license-header-checker -v -a -r -i vendor  /tmp/tools/license/license.txt . go  && [[ -z `git status -s` ]]
    62  
    63      - name: Install go ci lint
    64        run: curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(go env GOPATH)/bin v1.27.0
    65  
    66      - name: Run Linter
    67        run: golangci-lint run --timeout=10m -v --disable-all --enable=govet --enable=staticcheck --enable=ineffassign --enable=misspell
    68  
    69      - name: Go Test
    70        run: GO111MODULE=on && go mod vendor && go test ./... -bench . -race -v -coverprofile=coverage.txt
    71  
    72      - name: Coverage
    73        run: bash <(curl -s https://codecov.io/bash)
    74  
    75      - name: Hello world
    76        run: echo Hello world ${{ secrets.DING_TOKEN }} ${{ secrets.DING_SIGN }}
    77