-
Notifications
You must be signed in to change notification settings - Fork 1
81 lines (81 loc) · 1.96 KB
/
pull_requests.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
name: Pull Requests
on:
pull_request:
branches:
- main
- develop
paths:
- '**.go'
- 'go.mod'
jobs:
test:
strategy:
matrix:
go-version: [1.17.x]
os: [ubuntu-latest, macos-latest, windows-latest]
runs-on: ${{ matrix.os }}
steps:
- name: Install Go
uses: actions/setup-go@v3
with:
go-version: ${{ matrix.go-version }}
- name: Checkout code
uses: actions/checkout@v3
- name: Install dependencies
run: |
go version
go mod download
- name: Run Test
run: |
go test -count=10 ./...
lint:
strategy:
matrix:
go-version: [1.17.x]
os: [ubuntu-latest, macos-latest, windows-latest]
runs-on: ${{ matrix.os }}
steps:
- name: Install Go
uses: actions/setup-go@v3
with:
go-version: ${{ matrix.go-version }}
- name: Checkout code
uses: actions/checkout@v3
- name: Install dependencies
run: |
go install golang.org/x/lint/golint@latest
go mod download
- name: Run Lint
run: |
golint -set_exit_status=1 ./...
release_check:
runs-on: ubuntu-latest
outputs:
git_diff: ${{ steps.output.outputs.git_diff }}
steps:
- name: Checkout repository
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Check Diff
uses: technote-space/get-diff-action@v6
with:
PATTERNS: |
**/*.go
!**/*_test.go
FILES: |
go.mod
- name: Output Diff
id: output
if: env.GIT_DIFF
run: |
echo "::set-output name=git_diff::${{ env.GIT_DIFF }}"
release:
runs-on: ubuntu-latest
needs: [release_check]
if: ${{ needs.release_check.outputs.git_diff }}
steps:
- name: output
run: |
echo "${{ needs.release_check.outputs.git_diff }}";
echo "This pull request will create a release"