-
Notifications
You must be signed in to change notification settings - Fork 0
29 lines (28 loc) · 1.06 KB
/
test-project.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
name: test project
on:
push:
schedule:
- cron: "15 12 * * 6" # INIT_CRON_EXPRESSION: echo "$(((RANDOM%60))) $(((RANDOM%24)))"' * * '"$( if [[ $(((RANDOM%2))) -eq 0 ]]; then echo 0; else echo 6; fi )"
jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
go: ["1.21"]
name: Go ${{ matrix.go }}
steps:
- uses: actions/checkout@v3
- name: Setup go
uses: actions/setup-go@v3
with:
go-version: ${{ matrix.go }}
- name: verify golang files are consistently formatted and generated
run: |
[ `git status --porcelain=1 | wc -l` -eq 0 ] || (echo "failed to establish that files were unchanged before running format check" ; exit 1)
go generate ./...
find . -type f -name '*.go' ! -path './vendor/*' -exec gofmt -l -s -w {} +
[ `git status --porcelain=1 | wc -l` -eq 0 ] || (echo "files exist that need to be formatted by gofmt" ; exit 1)
- name: test without race
run: go test ./...
- name: test with race
run: go test -race ./...