| name: CI |
| |
| on: |
| push: |
| branches: |
| - main |
| - 'release-*' |
| - 'feature-*' |
| 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.23' |
| os: |
| - ubuntu-latest |
| |
| env: |
| DING_TOKEN: ${{ secrets.DING_TOKEN }} |
| DING_SIGN: ${{ secrets.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@v4.0.0 |
| |
| - name: Cache dependencies |
| uses: actions/cache@v4 |
| with: |
| # Cache |
| path: ~/go/pkg/mod |
| # Cache key |
| key: ${{ runner.os }}-go-${{ matrix.go_version }}-${{ 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-${{ matrix.go_version }}- |
| |
| - name: Get dependencies |
| run: | |
| go mod tidy |
| |
| - name: Go Fmt |
| run: | |
| go fmt ./... && git status && [[ -z `git status -s` ]] |
| # diff -u <(echo -n) <(gofmt -d -s .) |
| |
| - name: Check License Header |
| uses: apache/skywalking-eyes/header@e1a02359b239bd28de3f6d35fdc870250fa513d5 |
| |
| - name: Set Go version again to override skywalking |
| uses: actions/setup-go@v2 |
| with: |
| go-version: ${{ matrix.go_version }} |
| |
| - name: Check Go version |
| run: | |
| go version |
| |
| - name: Switch Dubbo-go version |
| run: | |
| # Acquire information of branch |
| if [ "$GITHUB_EVENT_NAME" == "pull_request" ]; then |
| BRANCH=${{github.base_ref}} |
| elif [ "$GITHUB_EVENT_NAME" == "push" ]; then |
| BRANCH=$GITHUB_REF_NAME |
| else |
| echo "$GITHUB_EVENT_NAME event is unsupported right now" |
| exit 1 |
| fi |
| echo "EVENT = $GITHUB_EVENT_NAME, BRANCH = $BRANCH" |
| # Edit the version |
| go mod edit -replace=dubbo.apache.org/dubbo-go/v3=dubbo.apache.org/dubbo-go/v3@$BRANCH |
| go mod tidy |
| |
| - name: Integration Test |
| run: | |
| ./start_integrate_test.sh |