This repository has been archived by the owner on Aug 16, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 40
61 lines (61 loc) · 2.14 KB
/
check_generated_code_drift.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
name: check_generated_code_drift
on:
push:
branches:
- main
pull_request:
branches:
- main
jobs:
check_generated_code_drift:
name: Check Generated Code for Drift
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- uses: dorny/paths-filter@v2
id: changes
with:
filters: |
src:
- 'resources/services/**/*'
- name: Set up Go 1.x
if: steps.changes.outputs.src == 'true' || github.event_name != 'pull_request'
uses: actions/setup-go@v3
with:
go-version: ^1.18
- name: Install tools
if: steps.changes.outputs.src == 'true' || github.event_name != 'pull_request'
run: |
make install-tools
- uses: actions/cache@v3
if: steps.changes.outputs.src == 'true' || github.event_name != 'pull_request'
with:
# In order:
# * Module download cache
# * Build cache (Linux)
# * Build cache (Mac)
# * Build cache (Windows)
path: |
~/go/pkg/mod
~/.cache/go-build
~/Library/Caches/go-build
~\AppData\Local\go-build
key: ${{ runner.os }}-go-${{ matrix.go }}-${{ hashFiles('**/go.sum') }}
restore-keys: |
${{ runner.os }}-go-${{ matrix.go }}-
- name: Fail if new cq-gen config file is missing //check-for-changes
if: steps.changes.outputs.src == 'true' || github.event_name != 'pull_request'
run: |
./scripts/check-new-files-have-check-for-changes-flag.sh
- name: Run go generate on changed service directories
if: steps.changes.outputs.src == 'true' || github.event_name != 'pull_request'
run: |
./scripts/regenerate-changed-directories.sh
- name: Fail if any files are changed
if: steps.changes.outputs.src == 'true' || github.event_name != 'pull_request'
run: |
echo "List of files changed after running go generate:"
git status -s ./resources/services
test "$(git status -s ./resources/services | wc -l)" -eq 0