Skip to content

Commit 1364368

Browse files
authored
chore: cleanup Makefile (coder#16034)
- add `.PHONY` to some jobs where it was missing - improve the test-e2e job by ensuring the frontend build is up to date - some small correctness tweaks
1 parent 1ab10cf commit 1364368

File tree

1 file changed

+25
-17
lines changed

1 file changed

+25
-17
lines changed

Makefile

+25-17
Original file line numberDiff line numberDiff line change
@@ -260,6 +260,7 @@ $(CODER_DYLIBS): go.mod go.sum $(GO_SRC_FILES)
260260

261261
# This task builds both dylibs
262262
build/coder-dylib: $(CODER_DYLIBS)
263+
.PHONY: build/coder-dylib
263264

264265
# This task builds all archives. It parses the target name to get the metadata
265266
# for the build, so it must be specified in this format:
@@ -391,21 +392,21 @@ node_modules/.installed: package.json
391392
./scripts/pnpm_install.sh
392393

393394
offlinedocs/node_modules/.installed: offlinedocs/package.json
394-
cd offlinedocs
395+
cd offlinedocs/
395396
../scripts/pnpm_install.sh
396397

397398
site/node_modules/.installed: site/package.json
398-
cd site
399+
cd site/
399400
../scripts/pnpm_install.sh
400401

401402
site/out/index.html: site/node_modules/.installed $(shell find ./site $(FIND_EXCLUSIONS) -type f \( -name '*.ts' -o -name '*.tsx' \))
402-
cd site
403+
cd site/
403404
# prevents this directory from getting to big, and causing "too much data" errors
404405
rm -rf out/assets/
405406
pnpm build
406407

407408
offlinedocs/out/index.html: offlinedocs/node_modules/.installed $(shell find ./offlinedocs $(FIND_EXCLUSIONS) -type f) $(shell find ./docs $(FIND_EXCLUSIONS) -type f | sed 's: :\\ :g')
408-
cd offlinedocs
409+
cd offlinedocs/
409410
../scripts/pnpm_install.sh
410411
pnpm export
411412

@@ -450,7 +451,7 @@ endif
450451

451452
fmt/biome: site/node_modules/.installed
452453
echo "$(GREEN)==>$(RESET) $(BOLD)fmt/biome$(RESET)"
453-
cd site
454+
cd site/
454455
# Avoid writing files in CI to reduce file write activity
455456
ifdef CI
456457
pnpm run format:check
@@ -487,7 +488,7 @@ lint/site-icons:
487488
.PHONY: lint/site-icons
488489

489490
lint/ts: site/node_modules/.installed
490-
cd site
491+
cd site/
491492
pnpm lint
492493
.PHONY: lint/ts
493494

@@ -509,7 +510,7 @@ lint/shellcheck: $(SHELL_SRC_FILES)
509510
.PHONY: lint/shellcheck
510511

511512
lint/helm:
512-
cd helm
513+
cd helm/
513514
make lint
514515
.PHONY: lint/helm
515516

@@ -599,7 +600,7 @@ gen/mark-fresh:
599600
fi
600601

601602
# touch sets the mtime of the file to the current time
602-
touch $$file
603+
touch "$$file"
603604
done
604605
.PHONY: gen/mark-fresh
605606

@@ -664,16 +665,16 @@ vpn/vpn.pb.go: vpn/vpn.proto
664665
site/src/api/typesGenerated.ts: site/node_modules/.installed $(wildcard scripts/apitypings/*) $(shell find ./codersdk $(FIND_EXCLUSIONS) -type f -name '*.go')
665666
# -C sets the directory for the go run command
666667
go run -C ./scripts/apitypings main.go > $@
667-
cd site
668+
cd site/
668669
pnpm exec biome format --write src/api/typesGenerated.ts
669670

670671
site/e2e/provisionerGenerated.ts: site/node_modules/.installed provisionerd/proto/provisionerd.pb.go provisionersdk/proto/provisioner.pb.go
671-
cd site
672+
cd site/
672673
pnpm run gen:provisioner
673674

674675
site/src/theme/icons.json: site/node_modules/.installed $(wildcard scripts/gensite/*) $(wildcard site/static/icon/*)
675676
go run ./scripts/gensite/ -icons "$@"
676-
cd site
677+
cd site/
677678
pnpm exec biome format --write src/theme/icons.json
678679

679680
examples/examples.gen.json: scripts/examplegen/main.go examples/examples.go $(shell find ./examples/templates)
@@ -693,12 +694,12 @@ codersdk/rbacresources_gen.go: scripts/typegen/codersdk.gotmpl scripts/typegen/m
693694

694695
site/src/api/rbacresourcesGenerated.ts: site/node_modules/.installed scripts/typegen/codersdk.gotmpl scripts/typegen/main.go coderd/rbac/object.go coderd/rbac/policy/policy.go
695696
go run scripts/typegen/main.go rbac typescript > "$@"
696-
cd site
697+
cd site/
697698
pnpm exec biome format --write src/api/rbacresourcesGenerated.ts
698699

699700
site/src/api/countriesGenerated.ts: site/node_modules/.installed scripts/typegen/countries.tstmpl scripts/typegen/main.go codersdk/countries.go
700701
go run scripts/typegen/main.go countries > "$@"
701-
cd site
702+
cd site/
702703
pnpm exec biome format --write src/api/countriesGenerated.ts
703704

704705
docs/admin/integrations/prometheus.md: node_modules/.installed scripts/metricsdocgen/main.go scripts/metricsdocgen/metrics
@@ -710,7 +711,7 @@ docs/reference/cli/index.md: node_modules/.installed site/node_modules/.installe
710711
CI=true BASE_PATH="." go run ./scripts/clidocgen
711712
pnpm exec markdownlint-cli2 --fix ./docs/reference/cli/*.md
712713
pnpm exec markdown-table-formatter ./docs/reference/cli/*.md
713-
cd site
714+
cd site/
714715
pnpm exec biome format --write ../docs/manifest.json
715716

716717
docs/admin/security/audit-logs.md: node_modules/.installed coderd/database/querier.go scripts/auditdocgen/main.go enterprise/audit/table.go coderd/rbac/object_gen.go
@@ -722,7 +723,7 @@ coderd/apidoc/swagger.json: node_modules/.installed site/node_modules/.installed
722723
./scripts/apidocgen/generate.sh
723724
pnpm exec markdownlint-cli2 --fix ./docs/reference/api/*.md
724725
pnpm exec markdown-table-formatter ./docs/reference/api/*.md
725-
cd site
726+
cd site/
726727
pnpm exec biome format --write ../docs/manifest.json ../coderd/apidoc/swagger.json
727728

728729
update-golden-files: \
@@ -850,6 +851,7 @@ test-migrations: test-postgres-docker
850851
if [[ "$${COMMIT_FROM}" == "$${COMMIT_TO}" ]]; then echo "Nothing to do!"; exit 0; fi
851852
echo "DROP DATABASE IF EXISTS migrate_test_$${COMMIT_FROM}; CREATE DATABASE migrate_test_$${COMMIT_FROM};" | psql 'postgresql://postgres:postgres@localhost:5432/postgres?sslmode=disable'
852853
go run ./scripts/migrate-test/main.go --from="$$COMMIT_FROM" --to="$$COMMIT_TO" --postgres-url="postgresql://postgres:postgres@localhost:5432/migrate_test_$${COMMIT_FROM}?sslmode=disable"
854+
.PHONY: test-migrations
853855

854856
# NOTE: we set --memory to the same size as a GitHub runner.
855857
test-postgres-docker:
@@ -897,6 +899,7 @@ test-tailnet-integration:
897899
-timeout=5m \
898900
-count=1 \
899901
./tailnet/test/integration
902+
.PHONY: test-tailnet-integration
900903

901904
# Note: we used to add this to the test target, but it's not necessary and we can
902905
# achieve the desired result by specifying -count=1 in the go test invocation
@@ -905,6 +908,11 @@ test-clean:
905908
go clean -testcache
906909
.PHONY: test-clean
907910

911+
test-e2e: site/node_modules/.installed site/out/index.html
912+
cd site/
913+
ifdef CI
914+
DEBUG=pw:api pnpm playwright:test --forbid-only --workers 1
915+
else
916+
pnpm playwright:test
917+
endif
908918
.PHONY: test-e2e
909-
test-e2e: site/node_modules/.installed
910-
cd ./site && DEBUG=pw:api pnpm playwright:test --forbid-only --workers 1

0 commit comments

Comments
 (0)