-
Notifications
You must be signed in to change notification settings - Fork 0
59 lines (48 loc) · 1.32 KB
/
auto_mockgen.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
name: Generate Mocks
on:
push:
branches:
- main
pull_request:
workflow_dispatch:
jobs:
generate:
runs-on: ubuntu-latest
env:
EXAMPLE_TESTS_ROOT: ${{ github.workspace }}
steps:
- uses: actions/checkout@v2
with:
ref: ${{ github.head_ref }}
- name: Install Go
uses: actions/setup-go@v2
with:
go-version: 1.21.1
- name: Install mockgen
run: |
go install go.uber.org/mock/mockgen@latest
go install github.com/sanposhiho/gomockhandler@latest
- name: Install gotests
run: |
cd app
go get -u github.com/cweill/gotests/...
- name: Generate mocks
run: |
cd app
go generate ./...
- name: Go lint
run: |
go fmt ./...
go mod tidy
- name: Configure Git
run: |
git config user.name "GitHub Actions"
git config user.email "[email protected]"
- name: Get the current branch name
id: get-branch-name
run: echo "::set-output name=branch::$(echo ${GITHUB_HEAD_REF})"
- name: Commit and push generated tests
run: |
git add -A
git commit -m "Generate missing mocks [skip ci]"
git push origin ${{ steps.get-branch-name.outputs.branch }}