-
Notifications
You must be signed in to change notification settings - Fork 3
/
Makefile
138 lines (114 loc) · 4.16 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
API_VERSION=$(shell cat api_version)
SDK_VERSION=$(shell cat sdk_version)
USER_ID=$(shell id -u)
GROUP_ID=$(shell id -g)
OPENAPI_IMG=openapitools/openapi-generator-cli:v6.3.0
#OPENAPI_IMG=outscale/openapi-generator:java-awsv4-signature
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 java
.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 java -c /sdk/gen.yml -o /sdk/.sdk
docker run -v $(PWD):/sdk --rm $(OPENAPI_IMG) sed -i "s%setUserAgent(\".*\");%setUserAgent(\"osc-sdk-java/$(SDK_VERSION)\");%" /sdk/.sdk/src/main/java/io/github/outscale/osc_sdk_java/client/ApiClient.java
docker run -v $(PWD):/sdk --rm $(OPENAPI_IMG) chown -R $(USER_ID).$(GROUP_ID) /sdk/.sdk
@echo SDK generated
mv .sdk/src ./
mv .sdk/docs ./
@echo start update SDK version
sed "s%SDK_VERSION%$(SDK_VERSION)%" pom.xml.template > pom.xml
sed "s%SDK_VERSION%$(SDK_VERSION)%" README.md.template > README.md
sed -i "s%API_VERSION%$(API_VERSION)%" README.md
$(shell for i in ./examples/*; do sed "s%SDK_VERSION%$(SDK_VERSION)%" $$i/pom.xml.template > $$i/pom.xml; done)
git apply ./.osc-patches/before-format/*
mvn spotless:apply
git apply ./.osc-patches/after-format/*
osc-api/outscale.yaml:
@echo getting osc-api description...
git clone https://github.com/outscale/osc-api-deploy.git
git clone https://github.com/outscale/osc-api-deploy.git osc-api && cd osc-api && git checkout -b $(API_VERSION) $(API_VERSION)
./osc-api-deploy/hacks/patch-nooneof.rb osc-api/outscale.yaml > osc-api/outscale-tmp.yaml
mv osc-api/outscale-tmp.yaml osc-api/outscale.yaml
.PHONY: clean
clean:
@echo cleaning build artifacts...
rm -rf .sdk osc-api src docs || 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: local-deploy
local-deploy:
mvn clean install -Dmaven.test.skip=true -Dmaven.javadoc.skip=true -Dgpg.skip
.PHONY: examples-test
examples-test: example-volumes example-region example-vm example-config_file example-config_env example-password_auth
@echo examples are OK
.PHONY: example-volumes
example-volumes: local-deploy
@echo testing examples/volumes example...
make -C examples/volumes build run
.PHONY: example-region
example-region: local-deploy
@echo testing examples/region example...
make -C examples/region build run
.PHONY: example-vm
example-vm: local-deploy
@echo testing examples/vm example...
make -C examples/vm build run
.PHONY: example-config_file
example-config_file: local-deploy
@echo testing examples/config_file example...
make -C examples/config_file build run
.PHONY: example-config_env
example-config_env: local-deploy
@echo testing examples/config_env example...
make -C examples/config_env build run
.PHONY: example-password_auth
example-password_auth: local-deploy
@echo testing examples/password_auth example...
make -C examples/password_auth build run
# try to regen, should not have any difference
.PHONY: regen-test
regen-test: gen
@echo SDK regeneration test...
git add src
git diff --cached -s --exit-code
git diff -s --exit-code
# Used by bot to auto-release
# GH_TOKEN and SSH_PRIVATE_KEY are needed
.PHONY: auto-release
auto-release: auto-release-cleanup osc-api-check release-check-duplicate release-build release-push release-pr
@echo OK
.PHONY: auto-release-cleanup
auto-release-cleanup:
rm -rf .auto-release-abort || true
.PHONY: osc-api-check
osc-api-check:
bash .github/scripts/osc-api-check.sh
.PHONY: release-check-duplicate
release-check-duplicate:
bash .github/scripts/release-check-duplicate.sh
.PHONY: release-build
release-build:
bash .github/scripts/release-build.sh
.PHONY: release-push
release-push:
bash .github/scripts/release-push.sh
.PHONY: release-pr
release-pr:
bash .github/scripts/release-pr.sh