forked from AlexStocks/getty
-
Notifications
You must be signed in to change notification settings - Fork 71
114 lines (100 loc) · 4.2 KB
/
Copy pathgithub-actions.yml
File metadata and controls
114 lines (100 loc) · 4.2 KB
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
name: CI
on:
push:
branches: [ master ]
pull_request:
branches: "*"
jobs:
license:
name: Check License Header
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Check License Header
uses: apache/skywalking-eyes/header@main
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
config: .licenserc.yaml
mode: check
CI:
name: CI
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: db178ff8c63cdc1b9ae0b86f7c4006ddf35e0249f4ae03441d80e55fdc600419
# DING_SIGN: SECbcc50d56d7315e57da8469d05da306d6cd825348a781861a42084e9579f1aebb
DING_TOKEN: ${{ secrets.DING_TOKEN }}
DING_SIGN: ${{ secrets.DING_SIGN }}
steps:
- name: Set up Go ${{ matrix.go_version }}
uses: actions/setup-go@v5
with:
go-version: ${{ matrix.go_version }}
- name: Check out code into the Go module directory
uses: actions/checkout@v4
- name: Cache Go Dependence
# ref: https://github.com/actions/cache/blob/main/examples.md#go---module
uses: actions/cache@v4
with:
# Cache, works only on Linux
path: |
~/.cache/go-build
~/go/pkg/mod
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: Check Code Format
run: make fmt && git status && [[ -z `git status -s` ]]
- name: Unit Test
run: make test
- name: Lint
run: make lint
- name: Coverage
run: bash <(curl -s https://codecov.io/bash)
# # Because the contexts of push and PR are different, there are two Notify.
# # Notifications are triggered only in the apache/dubbo-getty 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-getty'
# 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-getty'
# 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 }})"
# }
# }