-
Notifications
You must be signed in to change notification settings - Fork 112
130 lines (112 loc) · 4.92 KB
/
github-actions.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
name: CI
on:
push:
branches: [ master ]
pull_request:
branches: "*"
pull_request_target:
branches: "*"
jobs:
build:
name: ${{ matrix.os }} - Go${{ matrix.go_version }} - JDK${{ matrix.jdk_version }}
runs-on: ${{ matrix.os }}
strategy:
matrix:
os:
- ubuntu-latest
go_version:
- 1.17
jdk_version:
- 1.8
env:
# DING_TOKEN: 049ae645b5dfb16e3240f81c1757333549ca46b30a5d6b40df562c63c36cf166
# DING_SIGN: SEC128fb97348610e9d4529bfb59ad7f3fd716b972785a0d04f1cee2c83ec160e59
DING_TOKEN: ${{ secrets.DING_TOKEN }}
DING_SIGN: ${{ secrets.DING_SIGN }}
steps:
- uses: actions/checkout@v2
- name: Set up JDK ${{ matrix.jdk_version }}
uses: actions/setup-java@v1
with:
java-version: ${{ matrix.jdk_version }}
- name: Set up Go ${{ matrix.go_version }}
uses: actions/setup-go@v2
with:
go-version: ${{ matrix.go_version }}
id: go
- 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: Cache local Maven repository
uses: actions/cache@v2
with:
path: ~/.m2/repository
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
restore-keys: ${{ runner.os }}-maven-
- name: Java Test And Package
run: |
mvn clean package -DskipTests=true -f test_hessian/pom.xml
mvn test -f test_hessian/pom.xml
mvn clean package -f test_dubbo/pom.xml
git reset --hard
- name: Validate License
run: |
sh before_validate_license.sh
chmod u+x /tmp/tools/license/license-header-checker
/tmp/tools/license/license-header-checker -v -a -r -i vendor /tmp/tools/license/license.txt . go && [[ -z `git status -s` ]]
- name: format
run: |
gofmt -l -w . && [[ -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.27.0
- name: Run Linter
run: golangci-lint run --timeout=10m -v
- name: Go Test
run: GO111MODULE=on && go mod vendor && go test ./... -race -v && go test -bench . -race -coverprofile=coverage.txt
- name: Coverage
run: bash <(curl -s https://codecov.io/bash)
- name: Hello world
run: echo Hello world ${{ secrets.DING_TOKEN }} ${{ secrets.DING_SIGN }}
# # Because the contexts of push and PR are different, there are two Notify.
# # Notifications are triggered only in the apache/dubbo-go-hessian2 repository.
# - name: DingTalk Message Notify only Push
# uses: zcong1993/actions-ding@v3.0.1
# # Whether job is successful or not, always () is always true.
# if: |
# always() &&
# github.event_name == 'push' &&
# github.repository == 'apache/dubbo-go-hessian2'
# 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/actions-ding@v3.0.1
# if: |
# always() &&
# github.event_name == 'pull_request' &&
# github.repository == 'apache/dubbo-go-hessian2'
# 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 }})"
# }
# }