-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
69 lines (58 loc) · 1.65 KB
/
Makefile
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
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
# get the repo root and output path
REPO_ROOT:=${CURDIR}
BIN_PATH=$(REPO_ROOT)/bin
IMAGE_TAG=curtbushko/commit-status-action
# record the source commit in the binary, overridable.
COMMIT?=$(shell git rev-parse HEAD 2>/dev/null)
GOVERSION:=$(shell cat .go-version)
# used for building the binary.
BIN_NAME?=action
PKG:=github.com/curtbushko/commit-status-action
BUILD_LD_FLAGS:=-X=$(PKG).gitCommit=$(COMMIT)
BUILD_FLAGS?=-trimpath -buildvcs=false -ldflags="-buildid= -w $(BUILD_LD_FLAGS)"
default: build
.PHONY: build
build:
CGO_ENABLED=0 go build -v -o "$(BIN_PATH)/$(BIN_NAME)" $(BUILD_FLAGS)
.PHONY: clean
clean:
rm -rf "$(BIN_PATH)/"
.PHONY: test
test:
go test -v ./.
.PHONY: integration-test
integration-test:
INPUT_TOKEN=${GITHUB_TOKEN} \
INPUT_STATE="success" \
INPUT_CONTEXT="status check test" \
INPUT_DESCRIPTION="testing.." \
INPUT_OWNER="curtbushko" \
INPUT_REPOSITORY="commit-status-action" \
INPUT_SHA=${COMMIT} \
INPUT_DETAILS_URL="https://foo" \
$(BIN_PATH)/action
.PHONY: docker-build
docker-build:
docker build --build-arg GOVERSION=${GOVERSION} -t ghcr.io/$(IMAGE_TAG):latest .
.PHONY: lint
lint:
golangci-lint run -c ./.golangci.yml
.PHONY: github-lint
github-lint: action-lint super-linter
.PHONY: action-lint
action-lint:
docker run --rm -v $(CURDIR):/repo \
--workdir /repo \
rhysd/actionlint:latest \
-color \
-ignore 'SC2129' \
-verbose
.PHONY: super-linter
super-linter:
echo "Ignore long line warnings as we cannot pass the yaml rules into the container"
docker run --rm -v $(CURDIR):/tmp/lint \
-e RUN_LOCAL=true \
-e USE_FILE_ALGORITHM=true \
-e VALIDATE_ALL_CODEBASE=false \
-e VALIDATE_YAML=true \
github/super-linter:latest