| # |
| # Licensed to the Apache Software Foundation (ASF) under one |
| # or more contributor license agreements. See the NOTICE file |
| # distributed with this work for additional information |
| # regarding copyright ownership. The ASF licenses this file |
| # to you under the Apache License, Version 2.0 (the |
| # "License"); you may not use this file except in compliance |
| # with the License. You may obtain a copy of the License at |
| # |
| # http://www.apache.org/licenses/LICENSE-2.0 |
| # |
| # Unless required by applicable law or agreed to in writing, |
| # software 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. |
| # |
| name: CI |
| |
| on: |
| push: |
| branches: [ master, develop ] |
| pull_request: |
| branches: "*" |
| |
| jobs: |
| |
| build: |
| name: ${{ matrix.os }} - Go ${{ matrix.go_version }} |
| runs-on: ${{ matrix.os }} |
| strategy: |
| # If you want to matrix build , you can append the following list. |
| matrix: |
| go_version: |
| - 1.18 |
| |
| os: |
| - ubuntu-latest |
| |
| # https://docs.github.com/cn/actions/reference/encrypted-secrets |
| env: |
| DING_TOKEN: ${{ secrets.PROXY_DING_TOKEN }} |
| DING_SIGN: ${{ secrets.PROXY_DING_SIGN }} |
| |
| steps: |
| |
| - name: Set up Go 1.x |
| 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: Check License Header |
| uses: apache/skywalking-eyes@main |
| env: |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| |
| - name: Cache dependencies |
| uses: actions/cache@v2 |
| with: |
| # Cache |
| path: ~/go/pkg/mod |
| # Cache key |
| key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }} |
| # An ordered list of keys to use for restoring the cache if no cache hit occurred for key |
| 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: Go Fmt |
| run: | |
| go fmt ./... && git status && [[ -z `git status -s` ]] |
| # diff -u <(echo -n) <(gofmt -d -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.48.0 |
| |
| - name: Run Linter |
| run: GO111MODULE=on golangci-lint run --timeout=10m -v --disable-all --enable=govet --enable=staticcheck --enable=ineffassign --enable=misspell |
| |
| # integration test |
| # - name: Integration Test |
| # run: | |
| # chmod +x start_integrate_test.sh && chmod +x integrate_test.sh && ./start_integrate_test.sh |
| |
| |
| - name: Hello world |
| run: echo Hello world ${{ secrets.PROXY_DING_TOKEN }} ${{ secrets.PROXY_DING_SIGN }} |