Skip to content

Commit 14c94de

Browse files
committed
Managed by Terraform: Add pull_request_check.yml github workflow
1 parent 5ad25d9 commit 14c94de

1 file changed

Lines changed: 46 additions & 0 deletions

File tree

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
name: Pull Request Check
2+
3+
on: pull_request
4+
5+
jobs:
6+
check:
7+
runs-on: ubuntu-latest
8+
steps:
9+
- name: Checkout
10+
uses: actions/checkout@v2
11+
12+
- name: Set up Go
13+
uses: actions/setup-go@v2
14+
with:
15+
go-version: 1.16
16+
17+
- name: check fmt
18+
run: |
19+
go fmt ./...
20+
echo "==> Checking that code complies with go fmt requirements..."
21+
git diff --exit-code; if [ $$? -eq 1 ]; then \
22+
echo "Found files that are not fmt'ed."; \
23+
echo "You can use the command: \`make fmt\` to reformat code."; \
24+
exit 1; \
25+
fi
26+
27+
- name: check lint
28+
run: |
29+
echo "==> Updating linter dependencies..."
30+
curl -sSfL -q https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(go env GOPATH)/bin v1.23.8
31+
echo "==> Running linter on newly added Go source files..."
32+
GO111MODULE=on golangci-lint run --new-from-rev=$(shell git merge-base origin/main HEAD) ./...
33+
test:
34+
runs-on: ubuntu-latest
35+
steps:
36+
- name: Checkout
37+
uses: actions/checkout@v2
38+
39+
- name: Set up Go
40+
uses: actions/setup-go@v2
41+
with:
42+
go-version: 1.16
43+
44+
- name: test
45+
run: go test -count 1 ./... -timeout=3m
46+

0 commit comments

Comments
 (0)