forked from hyperledger-labs/nephos
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.travis.yml
58 lines (50 loc) · 2.4 KB
/
.travis.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
# Based on: https://github.com/LiliC/travis-minikube/blob/minikube-30-kube-1.12/.travis.yml
sudo: required
# We need the systemd for the kubeadm and it's default from 16.04+
dist: xenial
env:
- CHANGE_MINIKUBE_NONE_USER=true
language: python
python:
- "3.7-dev"
addons:
sonarcloud:
organization: "hyperledger-labs"
install:
- sudo apt-get install jq
- pip install -r requirements.txt
- pip install codecov
# Setup Minikube, needed for testing
before_script:
- sudo mount --make-rshared /
# Download kubectl, which is a requirement for using minikube.
- curl -Lo kubectl https://storage.googleapis.com/kubernetes-release/release/v1.12.0/bin/linux/amd64/kubectl && chmod +x kubectl && sudo mv kubectl /usr/local/bin/
# Download minikube.
- curl -Lo minikube https://storage.googleapis.com/minikube/releases/v0.30.0/minikube-linux-amd64 && chmod +x minikube && sudo mv minikube /usr/local/bin/
- sudo minikube start --vm-driver=none --bootstrapper=kubeadm --kubernetes-version=v1.12.0
# Fix the kubectl context, as it's often stale.
- minikube update-context
# Wait for Kubernetes to be up and ready.
- JSONPATH='{range .items[*]}{@.metadata.name}:{range @.status.conditions[*]}{@.type}={@.status};{end}{end}'; until kubectl get nodes -o jsonpath="$JSONPATH" 2>&1 | grep -q "Ready=True"; do sleep 1; done
# Start the ingress addon
- sudo minikube addons enable ingress
# Add the minikube IP to the hosts file
- echo "$(minikube ip) ca.nephos.local" | sudo tee -a /etc/hosts
# Install Helm
- sudo apt-get install socat
- curl -Lo /tmp/helm.tar.gz https://kubernetes-helm.storage.googleapis.com/helm-${HELM_VERSION}-linux-amd64.tar.gz
- tar -zxvf /tmp/helm.tar.gz -C /tmp
- sudo mv /tmp/linux-amd64/helm /usr/local/bin/helm
- helm init --wait
# Install Hyperledger Fabric tools
- curl -sSL https://raw.githubusercontent.com/hyperledger/fabric/master/scripts/bootstrap.sh | bash -s ${FABRIC_VERSION} -ds
- export PATH=$(pwd)/bin:$PATH
# Run tests
script:
- PYTHONPATH=. pytest --ignore=./integration --cov=. --cov-report xml:coverage.xml --cov-report term-missing
- PYTHONPATH=. pytest -x -s ./integration
# Run SonarQube only on non-PRs and when "SONAR_TOKEN" is defined
- 'if [[ "$TRAVIS_PULL_REQUEST" == "false" && $SONAR_TOKEN ]]; then sonar-scanner; fi'
after_success:
# Code coverage, deploy to PyPI and, when uploading new version, do mutation testing
- ./travis_success.sh