Skip to content
This repository was archived by the owner on May 5, 2025. It is now read-only.

Commit 7926e10

Browse files
committed
ci: Check Go mod and OSS licenses for good measure
1 parent 99311ae commit 7926e10

File tree

2 files changed

+86
-0
lines changed

2 files changed

+86
-0
lines changed

.github/workflows/generated.yaml

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
name: Generated Files
2+
3+
on:
4+
push:
5+
branches: [ main ]
6+
pull_request:
7+
branches: [ main ]
8+
9+
jobs:
10+
11+
gomod:
12+
name: Go Modules
13+
runs-on: ubuntu-latest
14+
15+
steps:
16+
- uses: actions/checkout@v2
17+
18+
- name: Set up Go
19+
uses: actions/setup-go@v2
20+
with:
21+
go-version: '1.17'
22+
23+
- name: Go caches
24+
uses: actions/cache@v2
25+
with:
26+
path: |
27+
~/go/pkg/mod
28+
key: ${{ github.job }}-${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
29+
restore-keys: |
30+
${{ github.job }}-${{ runner.os }}-go-
31+
32+
- name: Check modules requirements
33+
run: |
34+
go mod tidy
35+
36+
git_status="$(git status --porcelain)"
37+
if [[ ${git_status} ]]; then
38+
echo -e 'Go modules are out-of-date. Please run `go mod tidy`\n'
39+
echo "${git_status}"
40+
exit 1
41+
fi

.github/workflows/licenses.yaml

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
name: OSS Licenses
2+
3+
on:
4+
push:
5+
branches: [ main ]
6+
pull_request:
7+
branches: [ main ]
8+
9+
jobs:
10+
11+
vendor:
12+
name: Third-Party Licenses
13+
runs-on: ubuntu-latest
14+
15+
steps:
16+
- uses: actions/checkout@v2
17+
18+
- name: Set up Go
19+
uses: actions/setup-go@v2
20+
with:
21+
go-version: '1.17'
22+
23+
- name: Go caches
24+
uses: actions/cache@v2
25+
with:
26+
path: |
27+
~/.cache/go-build
28+
~/go/pkg/mod
29+
key: ${{ github.job }}-${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
30+
restore-keys: |
31+
${{ github.job }}-${{ runner.os }}-go-
32+
33+
- name: Install go-licenses
34+
run: go install github.com/google/go-licenses@latest
35+
36+
- name: Check third-party licenses
37+
run: |
38+
go-licenses save ./... --save_path LICENSES/vendor/ --force
39+
40+
git_status="$(git status --porcelain)"
41+
if [[ ${git_status} ]]; then
42+
echo -e 'Third-party licenses are out-of-date. Please run `go-licenses save`\n'
43+
echo "${git_status}"
44+
exit 1
45+
fi

0 commit comments

Comments
 (0)