specter-desktop/.gitlab-ci.yml
Kim Neunert 130a68242a
removing blobs and adjusting automations (#1299)
* removing blobs and adjusting automations

* .gitignore

* clearing upo .gitignore

* including in build-folder (fix setup.py) and in bdist-packages (MANIFEST.in)

* remove print

Co-authored-by: benk10 <ben.kaufman10@gmail.com>
2021-07-15 12:09:18 -05:00

169 lines
6.7 KiB
YAML

# 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.20.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/
- ./tests/elements
stages:
- testing
- releasing
before_script:
- docker info || echo "no docker-command found" # Print out docker version for debugging
- echo CI_PROJECT_NAMESPACE = $CI_PROJECT_NAMESPACE
- echo CI_PROJECT_ROOT_NAMESPACE = $CI_PROJECT_ROOT_NAMESPACE
- python -V # Print out python version for debugging
- apt update
- apt install -y libusb-1.0-0-dev libudev-dev # usb-support in hidapi
# This doesn't get cached in gitlab but we don't need it anyway for now:
# - ./tests/install_bitcoind.sh --debug --elements compile
- pip3 install --upgrade virtualenv
- virtualenv --python=python3 .env
- source .env/bin/activate
check:
stage: testing
# We simply check here whether all the tests on github are completed and green
script:
- ./utils/release.sh wait_on_master || exit 1 # that command will have a non-0 exit-value if not everything is green
# jobs with a preceding . like .test are hidden jobs and are not executed. I leave them in here as
# we might want to reactivate them in the case that github explodes or something.
# So effectively, gitlab is currently only used for releasing.
.test:
stage: testing
# We assume here that people who want to get code into the master-branch are
# relying on PRs and people who are working on gitlab-forks are working
# on CI which probably want fast feedback on the releasing-jobs
# and therefore skip the test-job
# tem deactivated as it did not work as expected
#only:
# - $CI_PROJECT_ROOT_NAMESPACE =~ "cryptoadvance"
script:
- pip3 install -r requirements.txt
- pip3 install -e .
- pip3 install -r test_requirements.txt
- python3 setup.py install # compiles babel stuff as well (might make pip install obsolete)
# pytest --docker not working? Uncomment this for better debugging:
# - python3 tests/conftest.py
- py.test --cov-report term --cov cryptoadvance --docker
.test-cypress:
image: registry.gitlab.com/cryptoadvance/specter-desktop/cypress-python:20210424
stage: testing
script:
# start the server in the background
- pip3 install -e .
- pip3 install -r test_requirements.txt
- python3 setup.py install # compiles babel stuff as well (might make pip install obsolete)
- npm i
- ./utils/test-cypress.sh --docker --debug run
- docker ps || echo "probably no docker available anyway"
artifacts:
when: always
paths:
- cypress/videos/**/*.mp4
- cypress/screenshots/**/*.png
expire_in: 1 day
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|[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
# 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
- ls -l dist
# twine reads the password from the env-var TWINE_PASSWORD
# Either testing it or doing the real thing depending on which gitlab-project we're running:
- if ! [[ ${CI_PROJECT_ROOT_NAMESPACE} = "cryptoadvance" ]]; then python3 -m twine upload --verbose --user __token__ dist/* --repository-url https://test.pypi.org/legacy/ ; fi
- if [[ ${CI_PROJECT_ROOT_NAMESPACE} = "cryptoadvance" ]]; then python3 -m twine upload --verbose --user __token__ dist/* ; fi
- sha256sum dist/cryptoadvance.specter-*.tar.gz > ./dist/SHA256SUMS-pip.txt
- python ./utils/github.py upload ./dist/SHA256SUMS-pip.txt
- python ./utils/github.py upload ./dist/cryptoadvance.specter-*.tar.gz
artifacts:
when: always
paths:
- dist/*
expire_in: 1 day
release_binary_windows:
stage: releasing
only:
- tags
tags:
- windows
before_script:
- python -V
- pip3 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
- echo "Releasing for ${CI_PROJECT_ROOT_NAMESPACE}"
- cd pyinstaller
- .\build-win-ci.bat $CI_COMMIT_TAG
- python ../utils/github.py upload ./release/specterd-$CI_COMMIT_TAG-win64.zip
artifacts:
when: always
paths:
- pyinstaller/release/*
expire_in: 1 day
release_electron_linux_windows:
image: registry.gitlab.com/cryptoadvance/specter-desktop/electron-builder:latest
stage: releasing
only:
- tags
before_script:
- python -V # Print out python version for debugging
- apt update
- apt install -y unzip libusb-1.0-0-dev libudev-dev # usb-support in hidapi
- pip3 install virtualenv
# Only difference to default befor_script: (ToDo fix this)
- python3 -m virtualenv --python=python3 .env
- source .env/bin/activate
script:
- echo "Releasing for ${CI_PROJECT_ROOT_NAMESPACE}"
- export CI_PROJECT_ROOT_NAMESPACE # needed in the build-script to download the right windows-binary
- cd pyinstaller
- ./build-ci.sh $CI_COMMIT_TAG "make-hash"
- ls -l release-linux
- ls -l release-win
- sha256sum ./release-linux/specterd-${CI_COMMIT_TAG}-x86_64-linux-gnu.zip ./release-linux/specter_desktop-${CI_COMMIT_TAG}-x86_64-linux-gnu.tar.gz ./release-win/Specter-Setup-${CI_COMMIT_TAG}.exe > ./SHA256SUMS.txt
- cat ./SHA256SUMS.txt
- if [[ -f /credentials/private.key ]]; then gpg --import /credentials/private.key; echo $GPG_PASSPHRASE | gpg --detach-sign --batch --yes --passphrase-fd 0 --pinentry-mode loopback ./SHA256SUMS.txt; fi
- python ../utils/github.py upload ./release-win/Specter-Setup-${CI_COMMIT_TAG}.exe
- python ../utils/github.py upload ./release-linux/specterd-${CI_COMMIT_TAG}-x86_64-linux-gnu.zip
- python ../utils/github.py upload ./release-linux/specter_desktop-${CI_COMMIT_TAG}-x86_64-linux-gnu.tar.gz
- python ../utils/github.py upload ./SHA256SUMS.txt
- if [[ -f /credentials/private.key ]]; then python3 ../utils/github.py upload ./SHA256SUMS.txt.sig ; fi
artifacts:
when: always
paths:
- pyinstaller/release-linux/*
- pyinstaller/release-win/*
- pyinstaller/SHA256SUMS.txt
expire_in: 1 day