forked from pingcap/dm
-
Notifications
You must be signed in to change notification settings - Fork 0
99 lines (87 loc) · 2.77 KB
/
check-and-build.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
name: Build & Lint
on:
push:
branches:
- master
- release-2.0
- test-ci # please keep this branch for testing
pull_request:
branches:
- master
- release-2.0
# See: https://docs.github.com/en/actions/reference/workflow-syntax-for-github-actions#concurrency.
concurrency:
group: ${{ github.ref }}-${{ github.workflow }}
cancel-in-progress: true
jobs:
make_build:
name: Make Build
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-latest]
steps:
- name: Set up Go 1.16
uses: actions/setup-go@v2
with:
go-version: 1.16
- name: Check out code
uses: actions/checkout@v2
- name: Cache go modules
uses: actions/cache@v2
with:
path: ~/go/pkg/mod
key: ${{ runner.os }}-dm-${{ hashFiles('**/go.sum') }}
- name: Cache tools
uses: actions/cache@v2
with:
path: |
**/tools
key: ${{ runner.os }}-dm-tools-${{ hashFiles('**/tools/go.sum') }}
- name: Build
run: make build
arm_build:
if: ${{ github.ref != 'refs/heads/master' }}
runs-on: ubuntu-latest
name: Make Build
strategy:
fail-fast: false
matrix:
arch: [aarch64]
steps:
- name: Check out code
uses: actions/checkout@v2
- name: build on ${{ matrix.arch }}
uses: uraimo/run-on-arch-action@v2.0.5
with:
arch: ${{ matrix.arch }}
distro: ubuntu20.04
# Not required, but speeds up builds
githubToken: ${{ github.token }}
run: |
apt update -y && apt install -y make gnupg ca-certificates gcc git
echo 'deb http://ppa.launchpad.net/longsleep/golang-backports/ubuntu focal main' > /etc/apt/sources.list
apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys F6BC817356A3D45E
apt update -y && apt install -y golang-go
make build nolint=true
# send Slack notify if failed.
# NOTE: With the exception of `GITHUB_TOKEN`, secrets are not passed to the runner when a workflow is triggered from a forked repository.
- name: Slack notification
if: ${{ failure() }}
env:
SLACK_WEBHOOK: ${{ secrets.SLACK_NOTIFY }}
uses: Ilshidur/action-slack@2.1.0
with:
args: "chaos job failed, see https://github.com/pingcap/dm/actions/runs/{{ GITHUB_RUN_ID }}"
lint:
name: Lint
runs-on: ubuntu-latest
steps:
- name: Check out code
uses: actions/checkout@v2
- name: GolangCI Lint
uses: golangci/golangci-lint-action@v2
with:
version: v1.39
args: --config .golangci.yml --timeout 10m0s --skip-dirs ^_tool/