-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathMakefile
More file actions
127 lines (111 loc) · 3.63 KB
/
Makefile
File metadata and controls
127 lines (111 loc) · 3.63 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
API_VERSION=$(shell cat api_version)
SDK_VERSION=$(shell cat sdk_version)
USER_ID=$(shell id -u)
GROUP_ID=$(shell id -g)
OPENAPI_IMG=outscale/openapi-generator:ts-fetch-aws-v4
SHELL := /bin/bash
all: help
.PHONY: help
help:
@echo "help:"
@echo "- make gen : regenerate SDK"
@echo "- make test : run all tests"
.PHONY: gen
gen: clean osc-generate
.PNONY: openapi-generator-help
openapi-generator-help:
docker run -v $(PWD):/sdk --rm $(OPENAPI_IMG) config-help -g typescript-fetch
.PHONY: osc-generate
osc-generate: osc-api/outscale.yaml
@echo start generating SDK...
rm -rf .sdk || true
mkdir .sdk
docker run -v $(PWD):/sdk --rm $(OPENAPI_IMG) generate -i /sdk/osc-api/outscale.yaml -g typescript-fetch -c /sdk/gen.yml -t /sdk/templates -o /sdk/.sdk --additional-properties=npmVersion=$(SDK_VERSION)
# Set sdk version using reproductible sed.
docker run -v $(PWD):/sdk --rm $(OPENAPI_IMG) sed -i "s/\"version\".*/\"version\": \"$(SDK_VERSION)\",/" /sdk/package.json
docker run -v $(PWD):/sdk --rm $(OPENAPI_IMG) chown -R $(USER_ID).$(GROUP_ID) /sdk/.sdk
mv .sdk/src ./
@echo SDK generated
@echo testing SDK build...
npm install --local
osc-api/outscale.yaml:
@echo getting osc-api description...
git clone https://github.com/outscale/osc-api-deploy.git osc-api && cd osc-api && git checkout -b $(API_VERSION) $(API_VERSION)
sed -i "s/operationId: DisableOutscaleLoginForUsers/operationId: DisableOutscaleLoginForUsersZz/g" osc-api/outscale.yaml
sed -i "s/operationId: EnableOutscaleLoginForUsers/operationId: EnableOutscaleLoginForUsersZz/g" osc-api/outscale.yaml
.PHONY: clean
clean:
@echo cleaning build artifacts...
rm -rf .sdk osc-api src node_modules dist || true
.PHONY: test
test: reuse-test examples-test regen-test
@echo all tests OK...
.PHONY: reuse-test
reuse-test:
@echo testing licensing with reuse...
docker run --rm --volume $(PWD):/data fsfe/reuse:0.11.1 lint
.PHONY: examples-test
examples-test: example-web-vms example-node-create-volumes example-node-volumes
@echo examples are OK
.PHONY: example-web-vms
example-web-vms:
@echo testing examples/web-vms example...
@source ~/.nvm/nvm.sh; \
cd examples/web-vms; \
echo "nvm --version:"; \
nvm --version; \
echo "nvm install..."; \
nvm install 20.5.1; \
echo "nvm use..."; \
nvm use 20.5.1; \
echo "npm version:"; \
npm version; \
echo "npm install..."; \
npm install --local --install-links
.PHONY: example-node-create-volumes
example-node-create-volumes:
@echo testing examples/node-create-volume example...
@source ~/.nvm/nvm.sh; \
cd examples/node-create-volume; \
echo "nvm version:"; \
nvm --version; \
echo "nvm install..."; \
nvm install 20.5.1; \
echo "nvm use..."; \
nvm use 20.5.1; \
echo "npm version:"; \
npm version; \
echo "npm install..."; \
npm install --local --install-links; \
echo "running node example..."; \
node --trace-warnings ./src/index.js > /dev/null
.PHONY: example-node-volumes
example-node-volumes:
@echo testing examples/node-volumes example...
@source ~/.nvm/nvm.sh; \
cd examples/node-volumes; \
echo "nvm version:"; \
nvm --version; \
echo "nvm install..."; \
nvm install 20.5.1; \
echo "nvm use..."; \
nvm use 20.5.1; \
echo "npm version:"; \
npm version; \
echo "npm install..."; \
npm install --local --install-links; \
echo "running node example..."; \
node ./src/index.js > /dev/null
# try to regen, should not have any difference
.PHONY: regen-test
regen-test: gen
@echo SDK regeneration test...
git add src dist
git diff --cached -s --exit-code
git diff -s --exit-code
.PHONY: osc-api-check
osc-api-check:
bash .github/scripts/osc-api-check.sh
.PHONY: release-build
release-build:
bash .github/scripts/release-build.sh