datasette/.travis.yml

57 wiersze
1.9 KiB
YAML

language: python
# 3.6 is listed first so it gets used for the later build stages
python:
- "3.6"
- "3.7-dev"
- "3.5"
# Executed for 3.5 AND 3.5 as the first "test" stage:
script:
- pip install -U pip wheel
- pip install .[test]
- pytest
cache:
directories:
- $HOME/.cache/pip
# This defines further stages that execute after the tests
jobs:
include:
- stage: deploy latest.datasette.io
if: branch = master AND type = push
script:
- pip install .
- npm install -g now
- python tests/fixtures.py fixtures.db fixtures.json
- export ALIAS=`echo $TRAVIS_COMMIT | cut -c 1-7`
- echo "{\"name\":\"datasette-latest-$ALIAS\",\"alias\":\"latest.datasette.io\"}" > now.json
- datasette publish now fixtures.db -m fixtures.json --token=$NOW_TOKEN --branch=$TRAVIS_COMMIT --version-note=$TRAVIS_COMMIT --name=datasette-latest-$ALIAS
- now alias --token=$NOW_TOKEN
- echo "{\"name\":\"datasette-latest-$ALIAS\",\"alias\":\"$ALIAS.datasette.io\"}" > now.json
- now alias --token=$NOW_TOKEN
- stage: release tagged version
if: tag IS present
python: 3.6
script:
- npm install -g now
- export ALIAS=`echo $TRAVIS_COMMIT | cut -c 1-7`
- export TAG=`echo $TRAVIS_TAG | sed 's/\./-/g' | sed 's/.*/v&/'`
- echo "{\"name\":\"datasette-latest-$ALIAS\",\"alias\":\"$TAG.datasette.io\"}" > now.json
- now alias --token=$NOW_TOKEN
# Build and release to Docker Hub
- docker login -u $DOCKER_USER -p $DOCKER_PASS
- export REPO=datasetteproject/datasette
- docker build -f Dockerfile -t $REPO:$TRAVIS_TAG .
- docker tag $REPO:$TRAVIS_TAG $REPO:latest
- docker push $REPO
deploy:
- provider: pypi
user: simonw
distributions: bdist_wheel
password: ${PYPI_PASSWORD}
on:
branch: master
tags: true