Permalink
Fetching contributors…
Cannot retrieve contributors at this time
150 lines (118 sloc) 5.92 KB
#
# This file is used to configure the continuous integration for w3af
# see http://w3af.org/how-w3af-uses-continuous-integration-to-improve
#
# As a user you don't need to understand this file.
#
machine:
services:
- docker
python:
version: 2.7.3
post:
# This was required to avoid issues with different builds of python being
# used between the gtk libs installed in /usr/lib/python2.7/dist-packages/
# and the python which was put inside my virtualenv
- pyenv global system
checkout:
post:
# Since the auto_update feature needs the git repository history, we run
# this command which will retrieve it (since CircleCI doesn't for perf).
# In our case it is fine, and it will get cached.
- if [[ -e .git/shallow ]]; then git fetch --unshallow; fi
dependencies:
cache_directories:
# These are inside the w3af directory
- "xpresser"
pre:
- docker info
- docker version
- docker images
- sudo apt-get update
# GUI dependencies
#- sudo apt-get install -y python-gtksourceview2 python-gtk2 gir1.2-notify-0.7 python-pyatspi2
# python-dbus python-pygame python-opencv python-scipy python-numpy
- sudo apt-get install -y python-webkit
# Misc dependencies
- sudo apt-get install -y stunnel4 libffi-dev tcpdump joe
# ClamAV installation for grep.clamav testing
- sudo apt-get install clamav-daemon clamav-freshclam clamav-unofficial-sigs
- sudo service clamav-daemon start
# Install the core/console dependencies
- pip install --upgrade pip
- w3af/core/controllers/ci/install_scripts/install_core_dependencies.sh
# Install GUI dependencies
- w3af/core/controllers/ci/install_scripts/install_gui_dependencies.sh
# Link the GUI stuff to the venv
- w3af/core/controllers/ci/install_scripts/install_c_extensions_venv.sh
# Install the test dependencies
- w3af/core/controllers/ci/install_scripts/install_test_dependencies.sh
# Run the test servers/dependencies
- cd w3af/tests/ && docker-compose up -d
- w3af/tests/add-test-routes.sh
- w3af/tests/waitfor-test-dependencies.py
post:
- pip --version
- pip freeze
test:
override:
- w3af/core/controllers/ci/nosetests_wrapper/main.py:
timeout: 360
- nosetests w3af/core/data/constants/tests/test_vulns.py:TestVulnsConstants.test_vuln_updated
# Dump the container logs for debugging
- for c in `docker ps -q`; do docker logs $c > $CIRCLE_ARTIFACTS/docker-$c.log; done
# https://bitbucket.org/ned/coveragepy/issue/282/coverage-combine-consumes-a-lot-of-memory
# post:
# - coverage combine
# - coveralls
deployment:
production:
branch: master
owner: andresriancho
commands:
# Save docker hub credentials to file
- sed "s/<EMAIL>/$DOCKER_EMAIL/;s/<AUTH>/$DOCKER_AUTH/" < extras/docker/dockercfg.template > ~/.dockercfg
# Note the master in the URLs
- "curl --header 'Content-Type: application/json' --request POST https://circleci.com/api/v1/project/andresriancho/w3af-module/tree/master?circle-token=$W3AF_MODULE_TOKEN"
- "curl --header 'Content-Type: application/json' --request POST https://circleci.com/api/v1/project/andresriancho/w3af-kali-ci/tree/master?circle-token=$W3AF_KALI_TOKEN"
- "curl --header 'Content-Type: application/json' --request POST https://circleci.com/api/v1/project/andresriancho/w3af-api-client/tree/master?circle-token=$W3AF_API_CLIENT_TOKEN"
# Nasty hack required for docker cache sanity: Because we get a new clone
# of the repo, timestamps don't correspond any more to when the file was
# last changed. To rectify this, first set everything to a timestamp in
# the past and then update the timestamp for all git-tracked files based
# on their last committed change.
#
# This takes ~1min to run, so we're doing it here in order to run it only
# when the build is successful AND we're in master/develop where it's
# really needed
- find . -exec touch -t 201401010000 {} \;
- for x in $(git ls-tree --full-tree --name-only -r HEAD); do touch -t $(date -d "$(git log -1 --format=%ci "${x}")" +%y%m%d%H%M.%S) "${x}"; done
- docker pull andresriancho/w3af:latest; true
- ./docker-build.sh master:
pwd: extras/docker/
- docker push andresriancho/w3af:latest
- w3af/core/controllers/ci/circleci/trigger-w3af-api-build.py
staging:
branch: develop
owner: andresriancho
commands:
# Save docker hub credentials to file
- sed "s/<EMAIL>/$DOCKER_EMAIL/;s/<AUTH>/$DOCKER_AUTH/" < extras/docker/dockercfg.template > ~/.dockercfg
# Note the develop in the URLs
- "curl --header 'Content-Type: application/json' --request POST https://circleci.com/api/v1/project/andresriancho/w3af-module/tree/develop?circle-token=$W3AF_MODULE_TOKEN"
- "curl --header 'Content-Type: application/json' --request POST https://circleci.com/api/v1/project/andresriancho/w3af-api-client/tree/develop?circle-token=$W3AF_API_CLIENT_TOKEN"
# Nasty hack required for docker cache sanity: Because we get a new clone
# of the repo, timestamps don't correspond any more to when the file was
# last changed. To rectify this, first set everything to a timestamp in
# the past and then update the timestamp for all git-tracked files based
# on their last committed change.
#
# This takes ~1min to run, so we're doing it here in order to run it only
# when the build is successful AND we're in master/develop where it's
# really needed
- find . -exec touch -t 201401010000 {} \;
- for x in $(git ls-tree --full-tree --name-only -r HEAD); do touch -t $(date -d "$(git log -1 --format=%ci "${x}")" +%y%m%d%H%M.%S) "${x}"; done
- docker pull andresriancho/w3af:develop; true
- ./docker-build.sh develop:
pwd: extras/docker/
- w3af/core/controllers/ci/circleci/trigger-w3af-api-build.py