Skip to content

Commit ec7f1d1

Browse files
add unit test-workflow with explicit permissions (#137)
1 parent 7d4d758 commit ec7f1d1

File tree

1 file changed

+28
-0
lines changed

1 file changed

+28
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
# This workflow defines a reusable Go unit test flow, that relies on the existence of the make target "test".
2+
3+
name: Unit Test (reusable)
4+
5+
on:
6+
workflow_call:
7+
8+
jobs:
9+
unit:
10+
runs-on: ubuntu-latest
11+
permissions:
12+
contents: write # Needed for vendoring. `setup-go`` needs at least `read` level.
13+
steps:
14+
- name: Checkout code
15+
uses: actions/checkout@v4
16+
17+
- name: Setup Go
18+
uses: actions/setup-go@v5
19+
with:
20+
go-version-file: "go.mod" # This uses the Go version defined in the mod file, in contrast to setting a defined version.
21+
22+
- name: Sync Go dependencies
23+
run: |
24+
go mod vendor
25+
26+
- name: Run tests
27+
run: |
28+
make test

0 commit comments

Comments
 (0)