-
Notifications
You must be signed in to change notification settings - Fork 114
101 lines (87 loc) · 2.86 KB
/
tests.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
name: Unit Tests
on:
push:
branches: [ master ]
paths-ignore:
- "**/*.md"
- "**/udemy.yml"
pull_request:
branches: [ master ]
paths-ignore:
- "**/*.md"
- "**/udemy.yml"
jobs:
build:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-20.04, macos-11, windows-2022]
steps:
- uses: actions/setup-go@v3.0.0
with:
go-version: '^1.18'
- id: go-cache-paths
run: |
echo "::set-output name=go-build::$(go env GOCACHE)"
echo "::set-output name=go-mod::$(go env GOMODCACHE)"
echo "::set-output name=go-path-bin::$(go env GOPATH)/bin"
- uses: actions/checkout@v2.5.0
- name: Go Build Cache
uses: actions/cache@v3.0.11
with:
path: ${{ steps.go-cache-paths.outputs.go-build }}
key: ${{ runner.os }}-go-build-${{ hashFiles('**/go.sum') }}
- name: Go Mod Cache
uses: actions/cache@v3.0.11
with:
path: ${{ steps.go-cache-paths.outputs.go-mod }}
key: ${{ runner.os }}-go-mod-${{ hashFiles('**/go.sum') }}
- name: Go Bin Cache
uses: actions/cache@v3.0.11
with:
path: ${{ steps.go-cache-paths.outputs.go-path-bin }}
key: ${{ runner.os }}-go-path-bin-${{ hashFiles('**/go.sum') }}
- name: Install make (if needed)
run: choco install make
if: runner.os == 'Windows'
- name: Install Protoc
uses: arduino/setup-protoc@v1.1.2
with:
version: '3.x'
repo-token: ${{ secrets.GITHUB_TOKEN }}
- name: Install gRPC Go plugins
run: |
go install google.golang.org/protobuf/cmd/protoc-gen-go@v1.28
go install google.golang.org/grpc/cmd/protoc-gen-go-grpc@v1.2
- name: Test
run: make test
red-cross-platform-badge:
needs: [build]
runs-on: ubuntu-latest
if: ${{ failure() }}
steps:
- uses: actions/checkout@v2.5.0
- run: |
sed -i 's/linux-brightgreen/linux-red/g' README.md
if [[ `git status --porcelain` ]]; then
git config --global user.name 'Clement Jean'
git config --global user.email 'Clement-Jean@users.noreply.github.com'
git add README.md
git commit -m "Cross-Platform build failed"
git push
fi
green-cross-platform-badge:
needs: [build]
runs-on: ubuntu-latest
if: ${{ success() }}
steps:
- uses: actions/checkout@v2.5.0
- run: |
sed -i 's/linux-red/linux-brightgreen/g' README.md
if [[ `git status --porcelain` ]]; then
git config --global user.name 'Clement Jean'
git config --global user.email 'Clement-Jean@users.noreply.github.com'
git add README.md
git commit -m "Cross-Platform build succeeded"
git push
fi