-
Notifications
You must be signed in to change notification settings - Fork 10
Expand file tree
/
Copy pathMakefile
More file actions
148 lines (128 loc) Β· 4.36 KB
/
Makefile
File metadata and controls
148 lines (128 loc) Β· 4.36 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
SHELL := /bin/bash
PACKAGE_NAME := $(shell jq --raw-output '.name' package.json 2>/dev/null)
PACKAGE_VERSION := $(shell jq --raw-output '.version' package.json 2>/dev/null)
GIT_REV := $(shell git rev-parse --short HEAD 2>/dev/null || echo 0)
UUID := $(shell date +%s)
.PHONY: lint
lint:
npm run lint
.PHONY: unit-tests
unit-tests:
npm run test:unit
.PHONY: type-check
type-check:
npm run type-check
.PHONY: build
build:
npm run build
.PHONY: artillery
artillery-ci:
npm run artillery-ci
.PHONY: credentials
credentials:
aws sts get-session-token --duration 900 > credentials.json
.PHONY: package-for-docker
package-for-docker:
npm run build && npm pack && mv s3proxy-*.tgz examples/
.PHONY: dockerize-for-test
dockerize-for-test: package-for-docker
cd examples && docker buildx build --progress plain --build-arg VERSION=$(PACKAGE_VERSION) --load -t s3proxy:test .
.PHONY: artillery-docker
artillery-docker: dockerize-for-test credentials
@echo "Starting artillery-docker test with cleanup on exit..."
@docker kill s3proxy-test 2>/dev/null || true
@docker run -v $(shell pwd)/credentials.json:/src/credentials.json:ro --rm --name s3proxy-test -d -p 8080:8080 \
-e BUCKET=s3proxy-public \
-e AWS_REGION=us-east-1 \
-e PORT=8080 \
-e NODE_ENV=dev \
-t s3proxy:test
@trap 'docker kill s3proxy-test 2>/dev/null || true' EXIT; \
npx wait-on http://localhost:8080/index.html && \
TEST_ENVIRONMENT=docker-container npx artillery run --config shared-testing/configs/load-test.yml shared-testing/scenarios/load-test.yml
.PHONY: test-validation-docker
test-validation-docker: dockerize-for-test credentials
@echo "Starting validation-docker test with cleanup on exit..."
@docker kill s3proxy-validation 2>/dev/null || true
@docker run -v $(shell pwd)/credentials.json:/src/credentials.json:ro --rm --name s3proxy-validation -d -p 8082:8080 \
-e BUCKET=s3proxy-public \
-e AWS_REGION=us-east-1 \
-e PORT=8080 \
-e NODE_ENV=dev \
-t s3proxy:test
@trap 'docker kill s3proxy-validation 2>/dev/null || true' EXIT; \
npx wait-on http://localhost:8082/index.html && \
S3PROXY_URL=http://localhost:8082 npm run test:validation
.PHONY: test-all-docker
test-all-docker: test-validation-docker artillery-docker
# Pre-release verification - runs all quality checks
.PHONY: pre-release-check
pre-release-check:
@echo "π Running pre-release verification..."
@echo "π Step 1: Verifying current branch state..."
@git status
@echo ""
@echo "π§ͺ Running unit tests..."
@npm run test:unit
@echo ""
@echo "ποΈ Verifying build works..."
@npm run build
@echo ""
@echo "π¦ Checking package contents..."
@npm run package:verify
@echo ""
@echo "π Step 2: Running code quality checks..."
@echo "π Linting code (warnings are acceptable)..."
@npm run lint || echo "β οΈ Linting warnings found but acceptable for release"
@echo ""
@echo "π Type checking..."
@npm run type-check
@echo ""
@echo "π Running coverage..."
@npm run test:coverage
@echo ""
@echo "π Security audit..."
@npm audit --audit-level critical
@echo ""
@echo "β
Pre-release verification complete!"
@echo "π Ready to proceed with release process."
###################################################################
##
## These are the top level targets: test, functional-tests, all.
## They are expected to pass using parallel mode (make -j),
## e.g. make -j all
##
###################################################################
.PHONY: test
test : build type-check lint unit-tests
.PHONY: test-performance
test-performance: artillery-ci artillery-docker
.PHONY: functional-tests
functional-tests: artillery-docker
.PHONY: all
all: test functional-tests
###################################################################
##
## Cleanup targets
##
###################################################################
.PHONY: clean
clean:
@echo "π§Ή Cleaning up generated files..."
@rm -f load-test-results-*.json
@rm -f artillery-report-*.json
@rm -f performance-test-*.json
@rm -f s3proxy*.tgz
@rm -f version.txt
@rm -f credentials.json
@rm -rf dist/
@rm -rf coverage/
@rm -rf node_modules/.cache/
@echo "β
Cleanup complete"
.PHONY: clean-test-results
clean-test-results:
@echo "π§Ή Cleaning up test result files..."
@rm -f load-test-results-*.json
@rm -f artillery-report-*.json
@rm -f performance-test-*.json
@echo "β
Test results cleaned"