forked from getodk/central-backend
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
133 lines (105 loc) · 3.69 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
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
default: base
node_modules: package.json
npm install --legacy-peer-deps
touch node_modules
.PHONY: test-oidc-integration
test-oidc-integration: node_version
TEST_AUTH=oidc NODE_CONFIG_ENV=oidc-integration-test make test-integration
.PHONY: test-oidc-e2e
test-oidc-e2e: node_version
test/e2e/oidc/run-tests.sh
.PHONY: dev-oidc
dev-oidc: base
NODE_CONFIG_ENV=oidc-development npx nodemon --watch lib --watch config lib/bin/run-server.js
.PHONY: fake-oidc-server
fake-oidc-server:
cd test/e2e/oidc/fake-oidc-server && \
FAKE_OIDC_ROOT_URL=http://localhost:9898 npx nodemon index.mjs
.PHONY: fake-oidc-server-ci
fake-oidc-server-ci:
cd test/e2e/oidc/fake-oidc-server && \
node index.mjs
.PHONY: fake-s3-accounts
fake-s3-accounts: node_version
NODE_CONFIG_ENV=s3-dev node lib/bin/s3-create-bucket.js
.PHONY: dev-s3
dev-s3: fake-s3-accounts base
NODE_CONFIG_ENV=s3-dev npx nodemon --watch lib --watch config lib/bin/run-server.js
# default admin credentials: minioadmin:minioadmin
# See: https://hub.docker.com/r/minio/minio/
# MINIO_KMS_SECRET_KEY, MINIO_KMS_AUTO_ENCRYPTION enable encryption - this changes how s3 ETags are generated.
# See: https://docs.aws.amazon.com/AmazonS3/latest/API/API_Object.html
# See: https://github.com/minio/minio/discussions/19012
S3_SERVER_ARGS := --network host \
-e MINIO_ROOT_USER=odk-central-dev \
-e MINIO_ROOT_PASSWORD=topSecret123 \
-e MINIO_KMS_AUTO_ENCRYPTION=on \
-e MINIO_KMS_SECRET_KEY=odk-minio-test-key:QfdUCrn3UQ58W5pqCS5SX4SOlec9sT8yb4rZ4zK24w0= \
minio/minio server /data --console-address ":9001"
.PHONY: fake-s3-server-ephemeral
fake-s3-server-ephemeral:
docker run --rm $(S3_SERVER_ARGS)
.PHONY: fake-s3-server-persistent
fake-s3-server-persistent:
docker run --detach $(S3_SERVER_ARGS)
.PHONY: node_version
node_version: node_modules
node lib/bin/enforce-node-version.js
.PHONY: migrations
migrations: node_version
node lib/bin/run-migrations.js
.PHONY: check-migrations
check-migrations: node_version
node lib/bin/check-migrations.js
.PHONY: base
base: node_version migrations check-migrations
.PHONY: dev
dev: base
npx nodemon --watch lib --watch config lib/bin/run-server.js
.PHONY: run
run: base
node lib/bin/run-server.js
.PHONY: debug
debug: base
node --debug --inspect lib/bin/run-server.js
.PHONY: test
test: lint
BCRYPT=insecure npx mocha --recursive
.PHONY: test-ci
test-ci: lint
BCRYPT=insecure npx mocha --recursive --reporter test/ci-mocha-reporter.js
.PHONY: test-fast
test-fast: node_version
BCRYPT=insecure npx mocha --recursive --fgrep @slow --invert
.PHONY: test-integration
test-integration: node_version
BCRYPT=insecure npx mocha --recursive test/integration
.PHONY: test-unit
test-unit: node_version
BCRYPT=insecure npx mocha --recursive test/unit
.PHONY: test-coverage
test-coverage: node_version
npx nyc -x "**/migrations/**" --reporter=lcov node_modules/.bin/_mocha --recursive test
.PHONY: lint
lint: node_version
npx eslint --cache --max-warnings 0 .
.PHONY: run-docker-postgres
run-docker-postgres: stop-docker-postgres
docker start odk-postgres14 || (\
docker run -d --name odk-postgres14 -p 5432:5432 -e POSTGRES_PASSWORD=odktest postgres:14.10-alpine \
&& sleep 5 \
&& node lib/bin/create-docker-databases.js --log \
)
.PHONY: stop-docker-postgres
stop-docker-postgres:
docker stop odk-postgres14 || true
.PHONY: rm-docker-postgres
rm-docker-postgres: stop-docker-postgres
docker rm odk-postgres14 || true
.PHONY: check-file-headers
check-file-headers:
git ls-files | node lib/bin/check-file-headers.js
.PHONY: api-docs
api-docs:
(test "$(docker images -q odk-docs)" || docker build --file odk-docs.dockerfile -t odk-docs .) && \
docker run --rm -it -v ./docs:/docs/docs/_static/central-spec -p 8000:8000 odk-docs