Skip to content

Commit 0b58ac0

Browse files
build: simplifying Makefile (#115)
1 parent d393b9c commit 0b58ac0

File tree

1 file changed

+26
-25
lines changed

1 file changed

+26
-25
lines changed

Makefile

Lines changed: 26 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,59 +1,63 @@
1-
# So new files are owned by the user.
1+
DOCKER_RUN_OPTS := --rm -v $(PWD):/workspace -w /workspace
2+
23
UID := $(shell id -u)
34
GID := $(shell id -g)
5+
DOCKER_RUN_WRITE_OPTS := $(DOCKER_RUN_OPTS) -u $(UID):$(GID)
46

5-
.PHONY: check-clean-git-history check-conventional-commits-linting check-shell-formatting check-yaml-formatting fix-shell-formatting fix-yaml-formatting check-github-actions-workflows-linting compile unit-test payload
7+
.PHONY: default
8+
default: compile
69

710
# renovate: depName=ghcr.io/developerc286/clean_git_history
811
CLEAN_GIT_HISTORY_VERSION=1.0.4@sha256:5783341a3377a723e409e72b9ec0826a75ba944288d030978355de05ef65b186
912

13+
.PHONY: check-clean-git-history
1014
check-clean-git-history:
11-
docker pull ghcr.io/developerc286/clean_git_history:$(CLEAN_GIT_HISTORY_VERSION)
12-
docker run --rm -v $(PWD):/workspace -u $(UID):$(GID) ghcr.io/developerc286/clean_git_history:$(CLEAN_GIT_HISTORY_VERSION) $(FROM)
15+
docker run $(DOCKER_RUN_WRITE_OPTS) ghcr.io/developerc286/clean_git_history:$(CLEAN_GIT_HISTORY_VERSION) $(FROM)
1316

1417
# renovate: depName=ghcr.io/developerc286/conventional_commits_linter
1518
CONVENTIONAL_COMMITS_LINTER_VERSION=0.15.0@sha256:b631a3cdcbed28c8938a2a6b63e16ecfd0d7ff71c28e878815adf9183e1fb599
1619

20+
.PHONY: check-clean-git-history
1721
check-conventional-commits-linting:
18-
docker pull ghcr.io/developerc286/conventional_commits_linter:$(CONVENTIONAL_COMMITS_LINTER_VERSION)
19-
docker run --rm -v $(PWD):/workspace -u $(UID):$(GID) ghcr.io/developerc286/conventional_commits_linter:$(CONVENTIONAL_COMMITS_LINTER_VERSION) --allow-angular-type-only $(FROM)
22+
docker run $(DOCKER_RUN_WRITE_OPTS) ghcr.io/developerc286/conventional_commits_linter:$(CONVENTIONAL_COMMITS_LINTER_VERSION) --allow-angular-type-only $(FROM)
2023

2124
# renovate: depName=mvdan/shfmt
22-
SHFMT_VERSION=v3.12.0-alpine@sha256:204a4d2d876123342ad394bd9a28fb91e165abc03868790d4b39cfa73233f150
25+
SHFMT_VERSION=v3.11.0-alpine@sha256:394d755b6007056a2e6d7537ccdbdcfca01b9855ba91e99df0166ca039c9d422
2326

27+
.PHONY: check-shell-formatting
2428
check-shell-formatting:
25-
docker pull mvdan/shfmt:$(SHFMT_VERSION)
26-
docker run --rm -v $(PWD):/workspace -w /workspace -u $(UID):$(GID) mvdan/shfmt:$(SHFMT_VERSION) --simplify --diff ci/*
29+
docker run $(DOCKER_RUN_OPTS) mvdan/shfmt:$(SHFMT_VERSION) --simplify --diff ./ci/*
2730

28-
# renovate: depName=ghcr.io/google/yamlfmt
29-
YAMLFMT_VERSION=0.17.2@sha256:fa6874890092db69f35ece6a50e574522cae2a59b6148a1f6ac6d510e5bcf3cc
31+
YAMLFMT_VERSION=0.17.0@sha256:b4ebf4ff064f5bcf779ef4799dad1fc52542e137677699210aea2de2b270e97f
3032

33+
.PHONY: check-yaml-formatting
3134
check-yaml-formatting:
32-
docker pull ghcr.io/google/yamlfmt:$(YAMLFMT_VERSION)
33-
docker run --rm -v $(PWD):/workspace -u $(UID):$(GID) ghcr.io/google/yamlfmt:$(YAMLFMT_VERSION) -verbose -lint -dstar .github/workflows/*
35+
docker run $(DOCKER_RUN_OPTS) ghcr.io/google/yamlfmt:$(YAMLFMT_VERSION) -verbose -lint -dstar .github/workflows/*
3436

37+
.PHONY: fix-shell-formatting
3538
fix-shell-formatting:
36-
docker pull mvdan/shfmt:$(SHFMT_VERSION)
37-
docker run --rm -v $(PWD):/workspace -w /workspace -u $(UID):$(GID) mvdan/shfmt:$(SHFMT_VERSION) --simplify --write ci/*
39+
docker run $(DOCKER_RUN_WRITE_OPTS) mvdan/shfmt:$(SHFMT_VERSION) --simplify --write ./ci/*
3840

41+
.PHONY: fix-yaml-formatting
3942
fix-yaml-formatting:
40-
docker pull ghcr.io/google/yamlfmt:$(YAMLFMT_VERSION)
41-
docker run --rm -v $(PWD):/workspace -u $(UID):$(GID) ghcr.io/google/yamlfmt:$(YAMLFMT_VERSION) -verbose -dstar .github/workflows/*
43+
docker run $(DOCKER_RUN_WRITE_OPTS) ghcr.io/google/yamlfmt:$(YAMLFMT_VERSION) -verbose -dstar .github/workflows/*
4244

4345
# renovate: depName=rhysd/actionlint
4446
ACTIONLINT_VERSION=1.7.7@sha256:887a259a5a534f3c4f36cb02dca341673c6089431057242cdc931e9f133147e9
4547

48+
.PHONY: check-github-actions-workflows-linting
4649
check-github-actions-workflows-linting:
47-
docker pull rhysd/actionlint:$(ACTIONLINT_VERSION)
48-
docker run --rm -v $(PWD):/workspace -w /workspace -u $(UID):$(GID) rhysd/actionlint:$(ACTIONLINT_VERSION) -verbose -color
50+
docker run $(DOCKER_RUN_OPTS) rhysd/actionlint:$(ACTIONLINT_VERSION) -verbose -color
4951

52+
.PHONY: compile
5053
compile:
5154
docker build -t compile -f ci/compile.Dockerfile .
52-
docker run --rm -v $(PWD):/workspace -u $(UID):$(GID) compile
55+
docker run $(DOCKER_RUN_WRITE_OPTS) compile
5356

57+
.PHONY: unit-test
5458
unit-test:
5559
docker build -t unit-test -f ci/unit-test.Dockerfile .
56-
docker run --rm -v $(PWD):/workspace -u $(UID):$(GID) unit-test
60+
docker run $(DOCKER_RUN_WRITE_OPTS) unit-test
5761

5862
PAYLOAD_SOURCE=output.c
5963
PAYLOAD_OBJECT=output
@@ -63,7 +67,4 @@ payload: $(PAYLOAD_OBJECT)
6367
./$(PAYLOAD_OBJECT)
6468

6569
$(PAYLOAD_OBJECT): $(PAYLOAD_SOURCE)
66-
$(CC) -o $(PAYLOAD_OBJECT) $(PAYLOAD_SOURCE) $(PAYLOAD_CFLAGS)
67-
68-
69-
70+
$(CC) -o $(PAYLOAD_OBJECT) $(PAYLOAD_SOURCE) $(PAYLOAD_CFLAGS)

0 commit comments

Comments
 (0)