forked from ElementsProject/lightning
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
59 lines (44 loc) · 1.96 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
#!/usr/bin/make
.PHONY: bdist sdist release check check-source check-flake8 check-mypy
PKG=client
VERSION = $(shell python3 -c 'from pyln import ${PKG};print(${PKG}.__version__)')
# You can set these variables from the command line.
SPHINXOPTS =
SPHINXBUILD = sphinx-build
SOURCEDIR = docs
BUILDDIR = build
SDIST_FILE = "dist/pyln-${PKG}-$(VERSION).tar.gz"
BDIST_FILE = "dist/pyln_${PKG}-$(VERSION)-py3-none-any.whl"
ARTEFACTS = $(BDIST_FILE) $(SDIST_FILE)
check: check-source check-pytest
check-source: check-flake8 check-mypy
check-flake8:
flake8 --ignore=E501,E731,W503,E741 pyln tests
check-pytest:
pytest tests
check-mypy:
# MYPYPATH=$(PYTHONPATH) mypy --namespace-packages --follow-imports=skip tests pyln
pyproject.toml: pyln/${PKG}/__init__.py
poetry version ${VERSION}
$(SDIST_FILE) $(BDIST_FILE): pyproject.toml
poetry build
test-release: check $(ARTEFACTS) pyproject.toml
# No way of saying "it's ok if files exist" yet
poetry publish --repository testpypi || /bin/true
echo Sleeping for PyPI index to update
sleep 10
# Generate a requirements.txt file, needed for us to download requirements from the prod pypi instead of the test pypi, since some packages are not published to test pypi.
poetry export -f requirements.txt --output requirements.txt --without-hashes
# Create a test virtualenv, install from the testpypi and run the
# tests against it (make sure not to use any virtualenv that may have
# pyln-${PKG} already installed).
virtualenv testpypi --python=/usr/bin/python3 --download --always-copy --clear
testpypi/bin/python3 -m pip install -r requirements.txt flaky pytest-timeout
testpypi/bin/python3 -m pip install -I --index-url https://test.pypi.org/simple/ --no-deps pyln-${PKG}==${VERSION}
testpypi/bin/python3 -c "from pyln import ${PKG};assert(${PKG}.__version__ == '$(VERSION)')"
testpypi/bin/pytest tests
rm -rf testpypi
prod-release: test-release $(ARTEFACTS)
python3 -m twine upload $(ARTEFACTS)
clean:
rm -rf testpypi