kopia lustrzana https://github.com/simonw/datasette
Run CI on GitHub Actions, not Travis
* Run CI on GitHub Actions, not Travis - refs #940 * Update documentation refs to Travis * Release action now runs parallel tests, then pushes to PyPI, then Docker Hubpull/952/head
rodzic
52eabb019d
commit
5e0b72247e
|
@ -3,7 +3,6 @@
|
|||
.eggs
|
||||
.gitignore
|
||||
.ipynb_checkpoints
|
||||
.travis.yml
|
||||
build
|
||||
*.spec
|
||||
*.egg-info
|
||||
|
|
|
@ -0,0 +1,72 @@
|
|||
name: Publish Python Package
|
||||
|
||||
on:
|
||||
release:
|
||||
types: [created]
|
||||
|
||||
jobs:
|
||||
test:
|
||||
runs-on: ubuntu-latest
|
||||
strategy:
|
||||
matrix:
|
||||
python-version: [3.6, 3.7, 3.8]
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- name: Set up Python ${{ matrix.python-version }}
|
||||
uses: actions/setup-python@v2
|
||||
with:
|
||||
python-version: ${{ matrix.python-version }}
|
||||
- uses: actions/cache@v2
|
||||
name: Configure pip caching
|
||||
with:
|
||||
path: ~/.cache/pip
|
||||
key: ${{ runner.os }}-pip-${{ hashFiles('**/setup.py') }}
|
||||
restore-keys: |
|
||||
${{ runner.os }}-pip-
|
||||
- name: Install dependencies
|
||||
run: |
|
||||
pip install -e '.[test]'
|
||||
- name: Run tests
|
||||
run: |
|
||||
pytest
|
||||
deploy:
|
||||
runs-on: ubuntu-latest
|
||||
needs: [test]
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- name: Set up Python
|
||||
uses: actions/setup-python@v2
|
||||
with:
|
||||
python-version: '3.8'
|
||||
- uses: actions/cache@v2
|
||||
name: Configure pip caching
|
||||
with:
|
||||
path: ~/.cache/pip
|
||||
key: ${{ runner.os }}-publish-pip-${{ hashFiles('**/setup.py') }}
|
||||
restore-keys: |
|
||||
${{ runner.os }}-publish-pip-
|
||||
- name: Install dependencies
|
||||
run: |
|
||||
pip install setuptools wheel twine
|
||||
- name: Publish
|
||||
env:
|
||||
TWINE_USERNAME: __token__
|
||||
TWINE_PASSWORD: ${{ secrets.PYPI_TOKEN }}
|
||||
run: |
|
||||
python setup.py sdist bdist_wheel
|
||||
twine upload dist/*
|
||||
deploy_docker:
|
||||
runs-on: ubuntu-latest
|
||||
needs: [deploy]
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- name: Build and push to Docker Hub
|
||||
env:
|
||||
DOCKER_USER: ${{ secrets.DOCKER_USER }}
|
||||
DOCKER_PASS: ${{ secrets.DOCKER_PASS }}
|
||||
run: |-
|
||||
docker login -u $DOCKER_USER -p $DOCKER_PASS
|
||||
export REPO=datasetteproject/datasette
|
||||
docker build -f Dockerfile -t $REPO::${GITHUB_REF#refs/tags/} .
|
||||
docker tag $REPO::${GITHUB_REF#refs/tags/} $REPO:latest
|
||||
docker push $REPO
|
|
@ -0,0 +1,29 @@
|
|||
name: Test
|
||||
|
||||
on: [push]
|
||||
|
||||
jobs:
|
||||
test:
|
||||
runs-on: ubuntu-latest
|
||||
strategy:
|
||||
matrix:
|
||||
python-version: [3.6, 3.7, 3.8]
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- name: Set up Python ${{ matrix.python-version }}
|
||||
uses: actions/setup-python@v2
|
||||
with:
|
||||
python-version: ${{ matrix.python-version }}
|
||||
- uses: actions/cache@v2
|
||||
name: Configure pip caching
|
||||
with:
|
||||
path: ~/.cache/pip
|
||||
key: ${{ runner.os }}-pip-${{ hashFiles('**/setup.py') }}
|
||||
restore-keys: |
|
||||
${{ runner.os }}-pip-
|
||||
- name: Install dependencies
|
||||
run: |
|
||||
pip install -e '.[test]'
|
||||
- name: Run tests
|
||||
run: |
|
||||
pytest
|
47
.travis.yml
47
.travis.yml
|
@ -1,47 +0,0 @@
|
|||
language: python
|
||||
dist: xenial
|
||||
|
||||
branches:
|
||||
except:
|
||||
- master
|
||||
|
||||
# 3.6 is listed first so it gets used for the later build stages
|
||||
python:
|
||||
- "3.6"
|
||||
- "3.7"
|
||||
- "3.8"
|
||||
|
||||
# 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: release tagged version
|
||||
if: tag IS present
|
||||
python: 3.6
|
||||
deploy:
|
||||
- provider: pypi
|
||||
user: simonw
|
||||
distributions: "sdist bdist_wheel"
|
||||
password: ${PYPI_PASSWORD}
|
||||
on:
|
||||
branch: master
|
||||
tags: true
|
||||
- stage: publish docker image
|
||||
if: (tag IS present) AND NOT (tag =~ [ab])
|
||||
python: 3.6
|
||||
script:
|
||||
# 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
|
|
@ -3,7 +3,7 @@
|
|||
[![PyPI](https://img.shields.io/pypi/v/datasette.svg)](https://pypi.org/project/datasette/)
|
||||
[![Changelog](https://img.shields.io/github/v/release/simonw/datasette?label=changelog)](https://docs.datasette.io/en/stable/changelog.html)
|
||||
[![Python 3.x](https://img.shields.io/pypi/pyversions/datasette.svg?logo=python&logoColor=white)](https://pypi.org/project/datasette/)
|
||||
[![Travis CI](https://travis-ci.org/simonw/datasette.svg?branch=main)](https://travis-ci.org/simonw/datasette)
|
||||
[![Tests](https://github.com/simonw/datasette/workflows/Test/badge.svg)](https://github.com/simonw/datasette/actions?query=workflow%3ATest)
|
||||
[![Documentation Status](https://readthedocs.org/projects/datasette/badge/?version=latest)](https://docs.datasette.io/en/latest/?badge=latest)
|
||||
[![License](https://img.shields.io/badge/license-Apache%202.0-blue.svg)](https://github.com/simonw/datasette/blob/main/LICENSE)
|
||||
[![docker: datasette](https://img.shields.io/badge/docker-datasette-blue)](https://hub.docker.com/r/datasetteproject/datasette)
|
||||
|
|
|
@ -126,7 +126,7 @@ Now browse to ``http://localhost:8000/`` to view the documentation. Any edits yo
|
|||
Release process
|
||||
---------------
|
||||
|
||||
Datasette releases are performed using tags. When a new version tag is pushed to GitHub, a `Travis CI task <https://github.com/simonw/datasette/blob/master/.travis.yml>`__ will perform the following:
|
||||
Datasette releases are performed using tags. When a new release is published on GitHub, a `GitHub Action workflow <https://github.com/simonw/datasette/blob/main/.github/workflows/deploy-latest.yml>`__ will perform the following:
|
||||
|
||||
* Run the unit tests against all supported Python versions. If the tests pass...
|
||||
* Build a Docker image of the release and push a tag to https://hub.docker.com/r/datasetteproject/datasette
|
||||
|
|
|
@ -10,8 +10,8 @@ datasette|
|
|||
:target: https://docs.datasette.io/en/stable/changelog.html
|
||||
.. |Python 3.x| image:: https://img.shields.io/pypi/pyversions/datasette.svg?logo=python&logoColor=white
|
||||
:target: https://pypi.org/project/datasette/
|
||||
.. |Travis CI| image:: https://travis-ci.org/simonw/datasette.svg?branch=main
|
||||
:target: https://travis-ci.org/simonw/datasette
|
||||
.. |Tests| image:: https://github.com/simonw/datasette/workflows/Test/badge.svg
|
||||
:target: https://github.com/simonw/datasette/actions?query=workflow%3ATest
|
||||
.. |License| image:: https://img.shields.io/badge/license-Apache%202.0-blue.svg
|
||||
:target: https://github.com/simonw/datasette/blob/main/LICENSE
|
||||
.. |docker: datasette| image:: https://img.shields.io/badge/docker-datasette-blue
|
||||
|
|
2
setup.py
2
setup.py
|
@ -38,7 +38,7 @@ setup(
|
|||
"Live demo": "https://latest.datasette.io/",
|
||||
"Source code": "https://github.com/simonw/datasette",
|
||||
"Issues": "https://github.com/simonw/datasette/issues",
|
||||
"CI": "https://travis-ci.org/simonw/datasette",
|
||||
"CI": "https://github.com/simonw/datasette/actions?query=workflow%3ATest",
|
||||
},
|
||||
packages=find_packages(exclude=("tests",)),
|
||||
package_data={"datasette": ["templates/*.html"]},
|
||||
|
|
Ładowanie…
Reference in New Issue