forked from sciety/sciety
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
145 lines (112 loc) · 4.41 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
134
135
136
137
138
139
140
141
142
143
144
145
ifeq (${TARGET},)
TARGET := dev
endif
DOCKER_COMPOSE = docker-compose --file docker-compose.yml --file docker-compose.$(TARGET).yml
DATA_VOLUME := $(shell pwd)
IMAGE := sciety/sciety
IMAGE_TAG := local
PORT := 8080
export IMAGE
export IMAGE_TAG
.PHONY: backstop* build clean* dev find-* git-lfs install lint* prod release test* update-event-data
dev: export TARGET = dev
dev: .env install build
${DOCKER_COMPOSE} up --abort-on-container-exit --exit-code-from app
prod: export TARGET = prod
prod: .env build
${DOCKER_COMPOSE} up --abort-on-container-exit --exit-code-from app
.env:
cp .env.example .env
.gcp-ncrc-key.json:
gcloud iam service-accounts keys create ./.gcp-ncrc-key.json --iam-account [email protected]
lint: export TARGET = dev
lint: build
${DOCKER_COMPOSE} run --rm app npm run lint
lint\:fix: export TARGET = dev
lint\:fix: build
${DOCKER_COMPOSE} run --rm -e ESLINT=--fix -e STYLELINT=--fix app npm run lint
test: export TARGET = dev
test: build
${DOCKER_COMPOSE} run --rm app npm run test
test\:coverage: export TARGET = dev
test\:coverage: build
${DOCKER_COMPOSE} run --rm app npm run test:coverage
backstop-test: export TARGET = dev
backstop-test: export GOOGLE_TAG_MANAGER_ID = fakedToMakeBackstopRenderTheCookieBanner
backstop-test: node_modules clean-db build
${DOCKER_COMPOSE} up -d
scripts/wait-for-healthy.sh
${DOCKER_COMPOSE} exec -T db psql -c "copy events from '/data/backstop.csv' with CSV" sciety user
${DOCKER_COMPOSE} restart app
scripts/wait-for-healthy.sh
npx backstop --docker test
${DOCKER_COMPOSE} down
backstop-approve: node_modules
npx backstop approve
build:
$(DOCKER_COMPOSE) build app
install: node_modules git-lfs
node_modules: export PUPPETEER_SKIP_CHROMIUM_DOWNLOAD = true
node_modules: package.json package-lock.json
npm install
touch node_modules
git-lfs:
git lfs install
clean:
rm -rf .eslint .jest .stylelint build node_modules static/style.css static/style.css.map
clean-db:
$(DOCKER_COMPOSE) down
find-review-commons-reviews: export TARGET = dev
find-review-commons-reviews: build
$(DOCKER_COMPOSE) run -T app \
npx ts-node scripts/find-reviews-from-hypothesis NEGQVabn > ./data/reviews/316db7d9-88cc-4c26-b386-f067e0f56334.csv
find-elife-reviews: export TARGET = dev
find-elife-reviews: build
$(DOCKER_COMPOSE) run -T app \
npx ts-node scripts/find-reviews-from-hypothesis q5X6RWJ6 > ./data/reviews/b560187e-f2fb-4ff9-a861-a204f3fc0fb0.csv
find-peerj-reviews: export TARGET = dev
find-peerj-reviews: build
$(DOCKER_COMPOSE) run -T app \
npx ts-node scripts/find-reviews-from-crossref-via-biorxiv 10.7717 10.7287 > ./data/reviews/53ed5364-a016-11ea-bb37-0242ac130002.csv
find-pci-reviews: export TARGET = dev
find-pci-reviews: build
$(DOCKER_COMPOSE) run -T app \
npx ts-node scripts/find-reviews-from-pci
find-prereview-reviews: export TARGET = dev
find-prereview-reviews: build
$(DOCKER_COMPOSE) run -T app \
npx ts-node scripts/find-reviews-from-prereview > ./data/reviews/10360d97-bf52-4aef-b2fa-2f60d319edd7.csv
find-ncrc-reviews: export TARGET = dev
find-ncrc-reviews: build .gcp-ncrc-key.json
$(DOCKER_COMPOSE) run -T app \
npx ts-node scripts/find-reviews-from-ncrc > ./data/reviews/62f9b0d0-8d43-4766-a52a-ce02af61bc6a.csv
COMMUNITY_SCRIPTS := \
find-review-commons-reviews \
find-elife-reviews \
find-peerj-reviews \
find-pci-reviews \
find-ncrc-reviews
sort-event-data:
find data -type f | xargs -I % sort -g -o % %
update-event-data: $(COMMUNITY_SCRIPTS) sort-event-data
release: export TAG = latest/$(shell date +%Y%m%d%H%M)
release:
git tag $$TAG
git push origin $$TAG
prod-sql:
kubectl run psql \
--rm -it --image=postgres:12.3 \
--env=PGHOST=$$(kubectl get secret hive-prod-rds-postgres -o json | jq -r '.data."postgresql-host"'| base64 -d) \
--env=PGDATABASE=$$(kubectl get secret hive-prod-rds-postgres -o json | jq -r '.data."postgresql-database"'| base64 -d) \
--env=PGUSER=$$(kubectl get secret hive-prod-rds-postgres -o json | jq -r '.data."postgresql-username"'| base64 -d) \
--env=PGPASSWORD=$$(kubectl get secret hive-prod-rds-postgres -o json | jq -r '.data."postgresql-password"'| base64 -d) \
-- psql
taiko: export TARGET = dev
taiko: clean-db
${DOCKER_COMPOSE} up -d
scripts/wait-for-healthy.sh
npx jest ${TEST} --testTimeout=300000 --bail --roots ./feature-test/
${DOCKER_COMPOSE} down
regression: taiko
render-sanitised-markdown: node_modules
npx ts-node --transpile-only ./scripts/hypothesis-review-render-testbed.ts