Merge pull request #782 from SHA-4096/fix/ut #2114
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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.20' | |
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@v3.2.6 | |
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 |