rycus86/webhook-proxy

View on GitHub
.travis.yml

Summary

Maintainability
Test Coverage
language: python
dist: xenial
python:
  - '2.7'
  - '3.4'
  - '3.5'
  - '3.6'
  - '3.7'

services:
  - docker
install: skip
script:
  # prepare dependencies
  - pip install -r requirements.txt
  - pip install -r docker-requirements.txt
  - pip install coveralls
  # prepare reporter
  - curl -L https://codeclimate.com/downloads/test-reporter/test-reporter-latest-linux-amd64 > ./cc-test-reporter
  - chmod +x ./cc-test-reporter
  - ./cc-test-reporter before-build
  # python tests
  - PYTHONPATH=src python -m coverage run --branch --source=src -m unittest discover -s tests -v
  # coverage reports
  - coveralls
  - python -m coverage report -m
  - python -m coverage xml
  - |
    if [[ "$(python --version 2>&1)" = *2.7* ]]; then
      coveralls || exit 0
      ./cc-test-reporter after-build --exit-code $TRAVIS_TEST_RESULT || exit 0
    fi

jobs:
  include:
    - &integration-stage
      stage: integration
      script:
        - pip install -r requirements.txt
        - pip install -r docker-requirements.txt
        - PYTHONPATH=tests python -m unittest discover -s tests -v -p it_*.py
      env:    DIND_VERSION=18.09

    - <<: *integration-stage
      env:    DIND_VERSION=18.02

    - <<: *integration-stage
      env:    DIND_VERSION=17.12

    - <<: *integration-stage
      env:    DIND_VERSION=17.09

    - <<: *integration-stage
      env:    DIND_VERSION=17.06

    - <<: *integration-stage
      env:    DIND_VERSION=1.13

    - &deploy-stage
      stage: deploy
      if: branch = master AND type = push
      script:
        - docker run --rm --privileged multiarch/qemu-user-static:register --reset
        - |
          docker build -t webhook-proxy:$DOCKER_TAG   \
            --build-arg BASE_IMAGE=$BASE_IMAGE        \
            --build-arg GIT_COMMIT=$TRAVIS_COMMIT     \
            --build-arg BUILD_TIMESTAMP=$(date +%s)   \
            -f Dockerfile${FLAVOR}                    \
            .
        - docker tag webhook-proxy:$DOCKER_TAG rycus86/webhook-proxy:$DOCKER_TAG
        - echo ${DOCKER_PASSWORD} | docker login --username "rycus86" --password-stdin
      after_success:
        - docker push rycus86/webhook-proxy:$DOCKER_TAG
      env:
        - DOCKER_TAG=amd64
        - BASE_IMAGE=alpine

    - <<: *deploy-stage
      env:
        - DOCKER_TAG=armhf
        - BASE_IMAGE=rycus86/armhf-alpine-qemu

    - <<: *deploy-stage
      env:
        - DOCKER_TAG=aarch64
        - BASE_IMAGE=rycus86/arm64v8-alpine-qemu

    - <<: *deploy-stage
      env: 
        - FLAVOR=-docker
        - DOCKER_TAG=amd64-docker
        - BASE_IMAGE=alpine

    - <<: *deploy-stage
      env:
        - FLAVOR=-docker
        - DOCKER_TAG=armhf-docker
        - BASE_IMAGE=rycus86/armhf-alpine-qemu

    - <<: *deploy-stage
      env:
        - FLAVOR=-docker
        - DOCKER_TAG=aarch64-docker
        - BASE_IMAGE=rycus86/arm64v8-alpine-qemu

    - stage: manifest
      if: branch = master AND type = push
      script:
        - echo ${DOCKER_PASSWORD} | docker login --username "rycus86" --password-stdin
        - curl -fsSL https://github.com/estesp/manifest-tool/releases/download/v0.7.0/manifest-tool-linux-amd64 > ./manifest-tool
        - chmod +x ./manifest-tool
        - ./manifest-tool push from-spec manifest.yml
        - ./manifest-tool push from-spec manifest-docker.yml