forked from sequinstream/sequin
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
182 lines (139 loc) · 6.87 KB
/
Makefile
File metadata and controls
182 lines (139 loc) · 6.87 KB
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
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
# Running `make` will trigger `make help`
.DEFAULT_GOAL := help
# for formatting
BOLD="\033[1m"
NORMAL="\033[0m"
# Any target invoked by make target does not correspond to a file, so
# it should always be executed. This avoids: 1. Having to remember to
# add newly created targets as PHONY. 2. Using a catch-all target
# (%:) with a no-op (@:) to prevent failures for non-existing targets.
.PHONY: $(MAKECMDGOALS)
help: ## Prints target: [dep1 dep1 ...] and what it does
@echo -e ${BOLD}Available targets:${NORMAL}
@grep -E '^[a-zA-Z_-]+.*## .*$$' $(MAKEFILE_LIST) | sed 's/^Makefile://' | column -t -s"##"
dev: ## Run the app locally
iex --name sequin-stream-dev@127.0.0.1 --cookie sequin-stream-dev -S mix phx.server
dev2: ## Run a second node locally
SERVER_PORT=4001 elixir --name sequin-stream-dev2@127.0.0.1 --cookie sequin-stream-dev -S mix phx.server
deviex: ## Open an IEx session on the running local app. If entr is installed, also watch files and auto-recompile on changes.
iex --name console-$$(openssl rand -hex 4)@127.0.0.1 --remsh sequin-stream-dev@127.0.0.1 --cookie sequin-stream-dev
watch: ## Watch files and auto-recompile on changes using entr
git ls-files | entr mix compile
deviex2: ## Open a second IEx session on the running local app
iex --name console-$$(openssl rand -hex 4)@127.0.0.1 --remsh sequin-stream-dev2@127.0.0.1 --cookie sequin-stream-dev
signoff: ## Run the signoff script [exclude=<tag>]
@if [ -n "$(exclude)" ]; then \
./scripts/signoff.sh --exclude $(exclude); \
else \
./scripts/signoff.sh; \
fi
signoff-dirty: ## Run the signoff script with --dirty flag [exclude=<tag>]
@if [ -n "$(exclude)" ]; then \
./scripts/signoff.sh --dirty --exclude $(exclude); \
else \
./scripts/signoff.sh --dirty; \
fi
signoff-pr: ## Run signoff on a PR by providing PR number: make signoff-pr pr=1234
@if [ -z "$(pr)" ]; then \
echo "Usage: make signoff-pr pr=<pr-number>"; \
else \
./scripts/signoff_pr.sh $(pr); \
fi
signoff-stack: ## Run the signoff-stack script
@./scripts/signoff_stack.sh
merge: ## Run the merge script
@./scripts/merge.sh
merge-force: ## Run the merge script, bypassing signoff check
@./scripts/merge.sh --force
init: ## Create .settings.json from .settings.json.example
@if [ ! -f .settings.json ]; then \
cp .settings.example.json .settings.json; \
echo ".settings.json created. Please edit it to configure your settings."; \
else \
echo ".settings.json already exists. No changes made."; \
fi
release: ## Create and push a release tag (triggers GitHub Actions release workflow)
@./scripts/tag-release.sh
release-force: ## Create and push a release tag, skipping signoff check
@./scripts/tag-release.sh --no-signoff
release-local: ## Emergency fallback: run full release locally (use only if GH Actions unavailable)
@./scripts/release.sh
checkout-pr: ## Check out a PR locally: make checkout-pr pr=<pr-number>
@if [ -z "$(pr)" ]; then \
echo "Usage: make checkout-pr pr=<pr-number>"; \
else \
./scripts/checkout_pr.sh $(pr); \
fi
delete-branch: ## Delete the current branch and its non‑origin remote
@./scripts/delete_branch.sh
spellcheck: ## Run cspell to check spelling in .md and .mdx files
@npx -y cspell "**/*.{md,mdx}" --config spellcheck/.cspell.json --exclude "**/node_modules/**"
addword: ## Add a word to project-words.txt
@if [ -z "$(word)" ]; then \
echo "Usage: make addword word=<word>"; \
else \
echo "$(word)" >> spellcheck/project-words.txt; \
sort -u spellcheck/project-words.txt -o spellcheck/project-words.txt; \
echo "Added '$(word)' to project-words.txt"; \
fi
check-links: ## Run mintlify broken-links in the docs directory
@cd docs && npx mintlify broken-links
buildpush: ## Run mix buildpush (build and push docker image)
mix buildpush
buildpush-gh: ## Run GitHub workflow in watch mode
gh workflow run docker-cloud-build.yml --ref main
sleep 3
gh run watch $(gh run list --workflow=docker-cloud-build.yml --limit 1 --json databaseId --jq '.[0].databaseId')
buildpush-dirty: ## Run mix buildpush with --dirty flag
mix buildpush --dirty
impersonate: ## Generate impersonate link for impersonated user from .settings.json
@INFRA_DIR=$$(jq -r '.infraDir // "../infra"' .settings.json); \
cd "$$INFRA_DIR" && ./scripts/prod_rpc.sh "Sequin.Accounts.Impersonate.generate_link\(~s{$(impersonating_user_id)}\,~s{$(impersonated_user_id)}\)"
deploy: ## Deploy the specified [sha=<commit-sha>] or latest commit
@INFRA_DIR=$$(jq -r '.infraDir // "../infra"' .settings.json); \
cd "$$INFRA_DIR" && ./scripts/deploy.sh $(sha)
remiex: ## Drop into remote iex session
@INFRA_DIR=$$(jq -r '.infraDir // "../infra"' .settings.json); \
cd "$$INFRA_DIR" && ./scripts/prod_sequin.sh remote
connectdb: ## Connect to the production database [id=<id>] [open=<open>]
@INFRA_DIR=$$(jq -r '.infraDir // "../infra"' .settings.json); \
cd "$$INFRA_DIR" && ./scripts/prod_db.sh $(id) $(open)
connect: ## Connect to the production database
@INFRA_DIR=$$(jq -r '.infraDir // "../infra"' .settings.json); \
cd "$$INFRA_DIR" && ./scripts/prod_ssh.sh
docs: ## Run mintlify dev server for documentation
@cd docs && npx mintlify dev
website: ## Serve the website locally on port 8000
@cd website && python -m http.server 8000
redis-console-consumer: ## Read from redis stream <stream-key> [from-beginning]
@./scripts/redis-console-consumer.sh $(wordlist 2,$(words $(MAKECMDGOALS)),$(MAKECMDGOALS))
e2e-gh-run: ## Trigger GitHub workflow run [BRANCH=<branch-name>] (defaults to current branch)
@BRANCH=$${BRANCH:-$$(git branch --show-current)}; \
echo "Running workflow on branch: $$BRANCH"; \
gh workflow run e2e-tests.yml --ref $$BRANCH; \
sleep 3; \
gh run watch $$(gh run list --workflow=e2e-tests.yml --limit 1 --json databaseId --jq '.[0].databaseId')
e2e-up: ## Start e2e test environment containers
cd priv/tests_e2e && docker compose up -d
e2e-down: ## Stop and remove e2e test environment containers and volumes
cd priv/tests_e2e && docker compose down -v --remove-orphans
docker rm -f sequin-e2e-kafka tests_e2e-postgres-1 tests_e2e-redis-1 2>/dev/null || true
e2e-rebuild: ## Rebuild e2e test environment from scratch (no cache)
cd priv/tests_e2e && docker compose down -v --remove-orphans
docker rm -f sequin-e2e-kafka tests_e2e-postgres-1 tests_e2e-redis-1 2>/dev/null || true
cd priv/tests_e2e && docker compose build --no-cache
make e2e-up
e2e-restart: e2e-down e2e-up ## Restart e2e test environment (shortcut for down+up)
e2e-tests: ## Run the e2e test suite [kafka|sqs] - Run all tests if no tag provided
@if [ -n "$(filter kafka sqs,$(MAKECMDGOALS))" ]; then \
cd priv/tests_e2e && elixir tests.exs $(filter kafka sqs,$(MAKECMDGOALS)); \
else \
cd priv/tests_e2e && elixir tests.exs; \
fi
kafka sqs: e2e-tests
@:
e2e-clean: ## Remove e2e kafka container
docker stop sequin-e2e-kafka || true
docker rm sequin-e2e-kafka || true
e2e-logs: ## Show logs from e2e test environment containers
cd priv/tests_e2e && docker compose logs -f