Skip to content
This repository has been archived by the owner on Jul 5, 2023. It is now read-only.

Commit

Permalink
Simplify travis file and lint target (#107)
Browse files Browse the repository at this point in the history
* Simplify travis file and lint target

* Debug crictl

* Revert minikube version

* Upload codecov for unittests

* Revert Kubernetes version
  • Loading branch information
johscheuer authored Aug 3, 2020
1 parent 086d2eb commit a67aade
Show file tree
Hide file tree
Showing 5 changed files with 49 additions and 96 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -50,3 +50,4 @@ docs/_build/*
cover/*
MANIFEST
kubeconfig
public
3 changes: 2 additions & 1 deletion .pylintrc
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,8 @@ disable=print-statement,
fixme,
too-many-locals,
protected-access,
consider-using-set-comprehension
consider-using-set-comprehension,
bad-continuation

# Enable the message, report, category or checker with the given id(s). You can
# either give multiple identifier separated by comma (,) or put this option
Expand Down
132 changes: 39 additions & 93 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
dist: xenial
dist: bionic
os: linux
language: python

jobs:
include:
- stage: "Check"
name: "Validate"
sudo: required
language: bash
language: shell
before_install:
- sudo apt-get update
- sudo apt-get install shellcheck -y
Expand All @@ -19,93 +20,43 @@ jobs:
script: mdl -r "~MD013" .

- stage: "Test"
name: "test:pycodestyle:3.6"
sudo: required
name: "test:lint"
language: python
cache: pip
python:
- "3.6"
python: "3.8"
script:
- make lint

- stage: "Test"
name: "test:pycodestyle:3.7"
sudo: required
name: "test:unittest"
language: python
cache: pip
python:
- "3.7"
script:
- make lint

- stage: "Test"
name: "test:pylint:3.6"
language: python
cache: pip
python:
- "3.6"
script:
- pip3 install anybadge==1.1.1 pylint==2.3.0 pylint-exit==1.0.0
- pylint --rcfile=.pylintrc --output-format=text src | tee pylint.txt
- score=$(sed -n 's/^Your code has been rated at \([-0-9.]*\)\/.*/\1/p' pylint.txt)
- echo "Pylint score was $score"
- mkdir -p public
- mv pylint.txt public/pylint.txt
- anybadge --value=$score --file=public/pylint.svg pylint

- stage: "Test"
name: "test:pylint:3.7"
language: python
cache: pip
python:
- "3.7"
script:
- pip3 install anybadge==1.1.1 pylint==2.3.0 pylint-exit==1.0.0
- pylint --rcfile=.pylintrc --output-format=text src | tee pylint.txt
- score=$(sed -n 's/^Your code has been rated at \([-0-9.]*\)\/.*/\1/p' pylint.txt)
- echo "Pylint score was $score"
- mkdir -p public
- mv pylint.txt public/pylint.txt
- anybadge --value=$score --file=public/pylint.svg pylint

- stage: "Test"
name: "test:unittest:3.6"
language: python
cache: pip
python:
- "3.6"
script:
- python setup.py test --addopts="-m 'not e2e' --runslow"

- stage: "Test"
name: "test:unittest:3.7"
language: python
cache: pip
python:
- "3.7"
python: "3.8"
before_script:
- pip install codecov
script:
- python setup.py test --addopts="-m 'not e2e' --runslow"
after_script:
- coverage run setup.py test --addopts="-m 'not e2e' --runslow"
after_success:
- codecov

- stage: e2e
name: "docker - calico e2e Tests"
sudo: required
language: python
cache: pip
python:
- "3.7"
# ToDo implement multiple python versions?
python: "3.8"
env:
- KUBECONFIG="$HOME/.kube/config"
- KUBERNETES_VERSION=v1.15.3
- MINIKUBE_VERSION=v1.3.1
- CHANGE_MINIKUBE_NONE_USER=true
- MINIKUBE_WANTUPDATENOTIFICATION=false
- MINIKUBE_WANTREPORTERRORPROMPT=false
- MINIKUBE_HOME=$HOME
- KUBECONFIG="$HOME/.kube/config"
# TODO upgrade to v1.18.6 or newer
- KUBERNETES_VERSION=v1.15.3
# TODO update to v1.12.1 or newer
- MINIKUBE_VERSION=v1.3.1
- CHANGE_MINIKUBE_NONE_USER=true
- MINIKUBE_WANTUPDATENOTIFICATION=false
- MINIKUBE_WANTREPORTERRORPROMPT=false
- MINIKUBE_HOME=$HOME

before_install:
- sudo apt-get update && sudo apt-get install -y conntrack

before_script:
# install dependent binaries
Expand All @@ -123,29 +74,29 @@ jobs:
# run illuminatio e2e tests
- ./local_dev/run_e2e_tests.sh

after_script:
after_success:
- codecov

- stage: e2e
name: "containerd - calico e2e Tests"
sudo: required
language: python
cache: pip
python:
- "3.7"
python: "3.8"
env:
- CONTAINERD_VERSION=1.2.6
- KUBECONFIG="$HOME/.kube/config"
- KUBERNETES_VERSION=v1.15.3
- MINIKUBE_VERSION=v1.3.1
- CHANGE_MINIKUBE_NONE_USER=true
- MINIKUBE_WANTUPDATENOTIFICATION=false
- MINIKUBE_WANTREPORTERRORPROMPT=false
- MINIKUBE_HOME=$HOME
- KUBECONFIG="$HOME/.kube/config"
- CONTAINERD_VERSION=1.3.4
# TODO upgrade to v1.18.6 or newer
- KUBERNETES_VERSION=v1.15.3
# TODO update to v1.12.1 or newer
- MINIKUBE_VERSION=v1.3.1
- CHANGE_MINIKUBE_NONE_USER=true
- MINIKUBE_WANTUPDATENOTIFICATION=false
- MINIKUBE_WANTREPORTERRORPROMPT=false
- MINIKUBE_HOME=$HOME

before_install:
# See: https://github.com/containerd/cri/blob/master/docs/installation.md
- sudo apt-get update && sudo apt-get install libseccomp2 -y
- sudo apt-get update && sudo apt-get install -y libseccomp2 conntrack
- curl --fail -sLO "https://storage.googleapis.com/cri-containerd-release/cri-containerd-${CONTAINERD_VERSION}.linux-amd64.tar.gz"
- sudo tar --no-overwrite-dir -C / -xzf cri-containerd-${CONTAINERD_VERSION}.linux-amd64.tar.gz

Expand All @@ -166,14 +117,13 @@ jobs:
# run illuminatio e2e tests
- ./local_dev/run_e2e_tests.sh

after_script:
after_success:
- codecov

# merely build the image for untagged commits
- stage: build
name: "build images"
if: (tag IS blank)
sudo: required
services:
- docker
script:
Expand All @@ -184,7 +134,6 @@ jobs:
- stage: build
name: "push latest images"
if: (branch = master AND NOT type = pull_request)
sudo: required
services:
- docker
script:
Expand All @@ -198,7 +147,6 @@ jobs:
- stage: build
name: "push tagged images"
if: (tag IS present)
sudo: required
services:
- docker
script:
Expand All @@ -214,8 +162,7 @@ jobs:
if: (tag IS blank)
language: python
cache: pip
python:
- "3.7"
python: "3.8"
script:
- python3 setup.py bdist_wheel
- pip install -e .
Expand All @@ -227,8 +174,7 @@ jobs:
if: (tag IS present)
language: python
cache: pip
python:
- "3.7"
python: "3.8"
script:
- python setup.py bdist_wheel
- pip install twine
Expand Down
7 changes: 6 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
@@ -1,8 +1,13 @@
lint:
pip3 install flake8==3.7.7 pycodestyle==2.5.0 black==19.10b0
@rm -rf ./public
pip3 install flake8==3.7.7 pycodestyle==2.5.0 black==19.10b0 anybadge==1.1.1 pylint==2.5.3 pylint-exit==1.2.0
flake8 --max-line-length 120 src tests
pycodestyle --max-line-length=120 --exclude=conf.py ./**/*.py
black --check --diff ./src ./tests
pylint --rcfile=.pylintrc --output-format=text src | tee pylint.txt
mkdir -p public
anybadge --value=$$(sed -n 's/^Your code has been rated at \([-0-9.]*\)\/.*/\1/p' pylint.txt) --file=public/pylint.svg pylint
mv pylint.txt public/pylint.txt

fmt:
black --diff ./src ./tests
2 changes: 1 addition & 1 deletion local_dev/run_e2e_tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ then
sudo docker pull "${ILLUMINATIO_IMAGE}"
fi

if ! python setup.py test --addopts="-m e2e";
if ! coverage run setup.py test --addopts="-m e2e";
then
kubectl -n illuminatio get po -o yaml
fi

0 comments on commit a67aade

Please sign in to comment.