Skip to content

Commit 3fec3ed

Browse files
authored
Merge pull request #93 from austinvazquez/pin-deps
Resolve build reproducibility issues
2 parents ec72798 + 98ae97c commit 3fec3ed

File tree

2 files changed

+28
-4
lines changed

2 files changed

+28
-4
lines changed

.github/workflows/go.yml

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,21 @@ jobs:
2222
go-version: ${{ matrix.go }}
2323

2424
- name: Check out code into the Go module directory
25-
uses: actions/checkout@v2
25+
uses: actions/checkout@v3
26+
with:
27+
# By default, the checkout action only fetches the last commit,
28+
# but we want to run DCO check against all commit messages.
29+
# Assuming that a pull request may have multiple commits,
30+
# fetching the single commit doesn't work for us.
31+
#
32+
# While DCO check (on Makefile) checks latest 5 commits,
33+
# the checkout action automatically creates a merge commit
34+
# for merging "main" into a pull request branch.
35+
# In addition to that, Git cannot recognize merge commits when
36+
# one of the parents is missing.
37+
# So, we will fetch 15 commits just in case to have
38+
# 5 actual commits with associated merged commits.
39+
fetch-depth: 15
2640

2741
- name: Run static analysis
2842
run: make lint

Makefile

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,19 +36,29 @@ build-in-docker:
3636
test:
3737
go test -v ./...
3838

39+
GO_MINOR_VERSION = $(shell go version | cut -c 14- | cut -d' ' -f1 | cut -d'.' -f2)
40+
3941
$(BINPATH)/ltag:
40-
GOBIN=$(BINPATH) GO111MODULE=off go get -u github.com/kunalkushwaha/ltag
42+
@if [ $(GO_MINOR_VERSION) -lt 16 ]; then \
43+
GOBIN=$(BINPATH) GO111MODULE=on go get -u github.com/kunalkushwaha/[email protected]; \
44+
else \
45+
GOBIN=$(BINPATH) GO111MODULE=on go install github.com/kunalkushwaha/[email protected]; \
46+
fi
4147

4248
$(BINPATH)/git-validation:
43-
GOBIN=$(BINPATH) GO111MODULE=off go get -u github.com/vbatts/git-validation
49+
@if [ $(GO_MINOR_VERSION) -lt 16 ]; then \
50+
GOBIN=$(BINPATH) GO111MODULE=on go get -u github.com/vbatts/[email protected]; \
51+
else \
52+
GOBIN=$(BINPATH) GO111MODULE=on go install github.com/vbatts/[email protected]; \
53+
fi
4454

4555
$(BINPATH)/golangci-lint:
4656
curl -sfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh| sh -s -- -b $(BINPATH) v1.46.2
4757
$(BINPATH)/golangci-lint --version
4858

4959
lint: $(BINPATH)/ltag $(BINPATH)/git-validation $(BINPATH)/golangci-lint
5060
$(BINPATH)/ltag -v -t ./.headers -check
51-
$(BINPATH)/git-validation -q -run DCO,short-subject -range HEAD~3..HEAD
61+
$(BINPATH)/git-validation -q -run DCO,short-subject -range HEAD~5..HEAD
5262
$(BINPATH)/golangci-lint run
5363

5464
clean:

0 commit comments

Comments
 (0)