forked from cryptoadvance/specter-desktop
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.gitlab-ci.yml
98 lines (86 loc) · 3.68 KB
/
.gitlab-ci.yml
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
# this image contains python, bitcoind and docker
# check docker/python-bitcoind on how it's built
image: registry.gitlab.com/cryptoadvance/specter-desktop/python-bitcoind:v0.19.1
variables:
# Cache documentation: https://docs.gitlab.com/ee/ci/caching/
PIP_CACHE_DIR: "$CI_PROJECT_DIR/.cache/pip"
cache:
# enable per-job and per-branch caching
key: "$CI_JOB_NAME-$CI_COMMIT_REF_SLUG"
paths:
- .cache/pip
- .env/
stages:
- testing
- releasing
before_script:
- docker info # Print out docker version for debugging
- python -V # Print out python version for debugging
- apt update
- apt install -y libusb-1.0-0-dev libudev-dev # usb-support in hidapi
- pip install virtualenv
- virtualenv --python=python3 .env
- source .env/bin/activate
test:
stage: testing
script:
- pip3 install -r requirements.txt
- pip3 install -e .
- pip3 install -r test_requirements.txt
# pytest --docker not working? Uncomment this for better debugging:
# - python3 tests/conftest.py
- pytest --docker
release_pip:
stage: releasing
only:
- tags
script:
- pip3 install setuptools wheel twine
# verifying the version number follows vx.y.z (e.g. "v1.2.3")
- if ! [[ $CI_COMMIT_TAG =~ ^v[0-9]{1,2}\.[0-9]{1,2}\.[0-9]{1,2}$ ]]; then exit 1; fi
# set version number in setup.py
- echo Releasing $CI_COMMIT_TAG
- sed -i "s/version=\".*/version=\"$CI_COMMIT_TAG\",/" setup.py
- cat setup.py
- python3 setup.py sdist bdist_wheel
# twine ready the password from the env-var TWINE_PASSWORD
# Add --repository-url https://test.pypi.org/legacy/ for testing the release procedure
- ls -l dist && python3 -m twine upload --verbose --user __token__ dist/*
release_binary_linux:
image: registry.gitlab.com/cryptoadvance/specter-desktop/bionic-build:latest
stage: releasing
only:
- tags
before_script:
- python -V
- pip install virtualenv
- virtualenv --python=python3 .env
- source .env/bin/activate
script:
# Make sure the version-number is compatibe to the scheme
- if ! [[ $CI_COMMIT_TAG =~ ^v(0|[1-9][0-9]*)\.(0|[1-9][0-9]*)\.(0|[1-9][0-9]*)(-((0|[1-9][0-9]*|[0-9]*[a-zA-Z-][0-9a-zA-Z-]*)(\.(0|[1-9][0-9]*|[0-9]*[a-zA-Z-][0-9a-zA-Z-]*))*))?(\+([0-9a-zA-Z-]+(\.[0-9a-zA-Z-]+)*))?$ ]]; then exit 1; fi
- pip3 install github-binary-upload
- cd pyinstaller && ./build-unix.sh $CI_COMMIT_TAG
- echo $GH_BIN_UPLOAD_PW | github-binary-upload -u gitlab_upload_release_binaries cryptoadvance/specter-desktop $CI_COMMIT_TAG ./release/specterd-${CI_COMMIT_TAG}-x86_64-linux-gnu.tar.gz ./release/specter_desktop-${CI_COMMIT_TAG}-x86_64-linux-gnu.tar.gz
release_binary_windows:
stage: releasing
only:
- tags
tags:
- windows
before_script:
- python -V
- pip install virtualenv
- virtualenv --python=python3 .env
- .\.env\Scripts\activate
script:
# This script won't execute if the script before that fails
# No need to check the version-scheme again
- whoami
- pip3 install github-binary-upload
- cd pyinstaller
- .\build-win.bat $CI_COMMIT_TAG
- (Get-Content .\specter-desktop.iss).replace('#define MyAppVersion "x.y.z"',"#define MyAppVersion `"$Env:CI_COMMIT_TAG`"") | Set-Content .\specter-desktop.iss
- docker run --rm -i -v ${pwd}:/work k9ert/innosetup iscc /work/specter-desktop.iss
- Get-FileHash .\release\specter_desktop_setup.exe -Algorithm SHA256 > .\release\specter_desktop_setup.exe.SHA256
- echo $Env:GH_BIN_UPLOAD_PW | docker run -i -v ${pwd}:/work k9ert/github-binary-upload:latest -u gitlab_upload_release_binaries cryptoadvance/specter-desktop $Env:CI_COMMIT_TAG ./release/specter_desktop_setup.exe ./release/specter_desktop_setup.exe.SHA256