-
Notifications
You must be signed in to change notification settings - Fork 3.2k
/
Makefile
executable file
·58 lines (52 loc) · 1.73 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
USE_NIX := false
VERSION := $(shell ./sdk_version.py)
ifndef VERSION
$(error "Failed to obtain a valid version for the SDK")
endif
# work dir
WD := $(shell echo "`pwd`/client")
DOCKER = docker run --rm --user $(shell id -u):$(shell id -g) -v $(WD):/wd --workdir /wd
CHOWN = chown -R $(shell id -u):$(shell id -g)
publish: generate
pip install setuptools twine build
python -m build --sdist --wheel --outdir client/dist/ client
twine check client/dist/*
twine upload client/dist/* -u __token__ -p ${PYPI_API_TOKEN}
generate:
ifeq ($(USE_NIX), true)
chmod -R 777 client || exit 0
rm -rf $(WD)
nix build
cp -r result/data/client ./client
else
rm -Rf $(WD)
mkdir -p $(WD)
cat ../../api/openapi-spec/swagger.json | \
sed 's/io.k8s.api.core.v1.//' | \
sed 's/io.k8s.apimachinery.pkg.apis.meta.v1.//' \
> $(WD)/swagger.json
cp ../../LICENSE $(WD)/LICENSE
$(DOCKER) openapitools/openapi-generator-cli:v5.4.0 \
generate \
--input-spec /wd/swagger.json \
--generator-name python \
--output /wd \
--additional-properties packageVersion=${VERSION} \
--additional-properties packageName="argo_workflows" \
--additional-properties projectName="argo-workflows" \
--additional-properties hideGenerationTimestamp=true \
--remove-operation-id-prefix \
--model-name-prefix '' \
--model-name-suffix '' \
--artifact-id argo-python-client \
--global-property modelTests=false \
--global-property packageName=argo_workflows \
--generate-alias-as-model
# https://vsupalov.com/docker-shared-permissions/#set-the-docker-user-when-running-your-container
$(CHOWN) $(WD) || sudo $(CHOWN) $(WD)
endif
install:
pip3 install ./client
test:
../../hack/access-token.sh init
env ARGO_TOKEN="`../../hack/access-token.sh get`" python3 tests/*.py