Skip to content

Commit

Permalink
travis cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
jaymccon committed Nov 21, 2019
1 parent 8c2d178 commit 7a2b615
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 101 deletions.
6 changes: 4 additions & 2 deletions .coveragerc
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
[run]
include = taskcat/*
branch = True
source = taskcat/

[report]
fail_under = 75
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ repos:
- id: pytest-local
name: pytest-local
description: Run pytest in the local virtualenv
entry: pytest --cov="taskcat" --doctest-modules --ignore "tests/data" "tests/"
entry: pytest --cov="./taskcat/"
language: system
pass_filenames: false
always_run: true
98 changes: 0 additions & 98 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,102 +30,4 @@ install:
- pip install .
script: pre-commit run --all-files
after_success:
- coverage run ./setup.py test > /dev/null
- codecov --token=$CODECOV_TOKEN

jobs:
include:
- stage: "[Version Bump] Check/Create Release PR"
name: "[Version Bump] Check/Create Release PR"
if: branch = master AND commit_message !~ /(Bump|Release taskcat)/ AND type = push
before_script:
- |
pip install bump2version
HUB_DIST=linux-amd64
HUB_VERSION=$(curl -w "%{url_effective}\n" -I -L -s -S github.com/github/hub/releases/latest -o /dev/null | awk -F'releases/tag/v' '{ print $2 }')
curl "https://github.com/github/hub/releases/download/v${HUB_VERSION}/hub-${HUB_DIST}-${HUB_VERSION}.tgz" -L | tar xvz && sudo ./hub-${HUB_DIST}-${HUB_VERSION}/install && rm -r ./hub-${HUB_DIST}-${HUB_VERSION}
- mkdir -p ~/.config/taskcat
- |
echo -e "github.com:\n- user: taskcat-ci\n oauth_token: ${GHT}\n protocol: https" > ~/.config/hub
- cat ~/.config/hub
script:
- export RELEASE_ID=$(cut -f1-2 -d . VERSION)
- export ORIGINAL_VERSION=$(cat VERSION)
- git checkout "release/v${RELEASE_ID}" || git checkout -b "release/v${RELEASE_ID}"
- bumpversion --no-commit --allow-dirty --no-tag patch
- bumpversion --commit --allow-dirty --no-tag release --message "Bump Version - Creating a new minor version"
- export NEW_VERSION=$(cat VERSION)
- git push "https://${GHT}:@github.com/${TRAVIS_REPO_SLUG}" "release/v${RELEASE_ID}" --force || travis_terminate 1
- |
OPEN_PR=$(hub pr list -s open --base master --head "release/v${RELEASE_ID}" -L 1 -f "%I")
if [ -z "${OPEN_PR}" ]; then
hub pull-request -m "Release taskcat [${NEW_VERSION}]" -h "release/v${RELEASE_ID}"
fi
- |
OPEN_PR=$(hub pr list -s open --base master --head "release/v${RELEASE_ID}" -L 1 -f "%I")
LAST_RELEASE_COMMIT=$(git rev-list --tags --max-count=1)
TAG_BODY=$(git --no-pager log --no-merges --oneline ${LAST_RELEASE_COMMIT}..HEAD --pretty='- %h %s')
hub api -XPATCH repos/${TRAVIS_REPO_SLUG}/issues/${OPEN_PR} -f body="${TAG_BODY}"
- stage: "[Version Bump] Create PyPI Development release"
name: "[Version Bump] Create PyPI Development release"
if: branch = master AND type = push
before_script:
- pip install bump2version
- export TEST_PYPI_VERSION=$(python -c "from distutils.version import LooseVersion; import requests; versions = requests.get('https://pypi.org/pypi/taskcat/json').json()['releases'].keys(); versions = [LooseVersion(x) for x in versions if 'dev' in x]; print(sorted(versions, reverse=True)[0])")
script:
- |
echo "${TEST_PYPI_VERSION}" | egrep -i '\.dev[0-9]{1,4}'
if [[ $? -eq 0 ]]; then
# v0.9.1.dev0 -> v0.9.1.dev1
echo "Bumping the development version"
sed -i -e "s,$(cat VERSION),${TEST_PYPI_VERSION},g" .bumpversion.cfg
sed -i -e "s,$(cat VERSION),${TEST_PYPI_VERSION},g" VERSION
bumpversion --allow-dirty --no-tag --no-commit build
else
# v0.9.0 -> v0.9.1.dev0
bumpversion --allow-dirty --no-tag --no-commit patch
fi
- cat VERSION
- |
if [[ "$(cat VERSION)" == "${TEST_PYPI_VERSION}" ]]; then
echo "Something went wrong when bumping the version. Exiting."
travis_terminate 1
fi
- |
egrep -i '\.dev[0-9]{1,4}' VERSION
if [[ $? -eq 1 ]]; then
echo "No .dev pre-release tag found in VERSION. Not building PYPI package"
travis_terminate 1
fi
deploy:
- provider: pypi
skip_cleanup: true
user: $PYPI_USER
password: $PYPI_PASSWORD
on:
branch: master
tags: false

- stage: "Tag build changelog/Push pypi and github release/Update docs"
name: "Tag build changelog/Push pypi and github release/Update docs"
if: branch = master AND fork = false AND type = push
script:
- |
echo "${TRAVIS_COMMIT_MESSAGE}" | egrep -i 'Merge pull request.*from aws-quickstart/release.*$'
if [[ $? -eq 0 ]]; then
LAST_RELEASE_COMMIT=$(git rev-list --tags --max-count=1)
TAG_BODY=$(git --no-pager log --no-merges --oneline ${LAST_RELEASE_COMMIT}..HEAD --pretty='- %h %s')
git tag -a "$(cat VERSION)" -m "${TAG_BODY}"
git push --tags "https://$GHT:@github.com/$TRAVIS_REPO_SLUG"
fi
deploy:
- provider: releases
skip_cleanup: true
api_key: "$GHT"
file: directory/*
on:
branch: master
fork: false

# Add Docker provider

0 comments on commit 7a2b615

Please sign in to comment.