Skip to content

Commit

Permalink
ci: Add Python wheels distribution. Split lint.yml out of ci.yml.
Browse files Browse the repository at this point in the history
  • Loading branch information
jpmckinney committed Apr 10, 2021
1 parent 6069c08 commit 1b66818
Show file tree
Hide file tree
Showing 4 changed files with 54 additions and 6 deletions.
7 changes: 1 addition & 6 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,13 +29,8 @@ jobs:
key: ${{ runner.os }}-pip-${{ hashFiles('**/setup.py') }}
restore-keys: |
${{ runner.os }}-pip-
- run: curl -s -S --retry 3 $BASEDIR/tests/install.sh | bash -
- run: pip install --upgrade pip
- run: pip install .[test]
- run: curl -s -S --retry 3 $BASEDIR/tests/script.sh | bash -
- run: pytest /tmp/test_requirements.py
# The unit tests need to be run with ipython, as the code requires a
# running ipython instance (as you would have in a notebook)
# The unit tests are run with ipython, as the code requires an iPython instance, like in a notebook.
- run: ipython -m pytest -- --cov ocdskingfishercolab
env:
TEST_DATABASE_URL: postgresql://postgres:postgres@localhost:${{ job.services.postgres.ports[5432] }}/postgres
Expand Down
26 changes: 26 additions & 0 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
name: Lint
on: [push, pull_request]
env:
BASEDIR: https://raw.githubusercontent.com/open-contracting/standard-maintenance-scripts/main
jobs:
build:
if: github.event_name == 'push' || github.event.pull_request.head.repo.full_name != github.repository
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-python@v1
with:
python-version: 3.6
- uses: actions/cache@v1
with:
path: ~/.cache/pip
key: ${{ runner.os }}-pip-${{ hashFiles('.github/workflows/lint.yml') }}
restore-keys: |
${{ runner.os }}-pip-
- run: curl -s -S --retry 3 $BASEDIR/tests/install.sh | bash -
- run: pip install .
- run: curl -s -S --retry 3 $BASEDIR/tests/script.sh | bash -
- run: pip install .[test]
- run: pytest /tmp/test_requirements.py
- run: pip install --upgrade check-manifest setuptools
- run: check-manifest
26 changes: 26 additions & 0 deletions .github/workflows/pypi.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
name: Publish to PyPi
on:
push:
branches:
- main
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-python@v1
with:
python-version: 3.6
- run: pip install --upgrade setuptools wheel
- run: python setup.py sdist bdist_wheel
- name: Publish to TestPyPI
uses: pypa/gh-action-pypi-publish@release/v1
with:
password: ${{ secrets.TEST_PYPI_API_TOKEN }}
repository_url: https://test.pypi.org/legacy/
skip_existing: true
- name: Publish to PyPI
if: startsWith(github.ref, 'refs/tags')
uses: pypa/gh-action-pypi-publish@release/v1
with:
password: ${{ secrets.PYPI_API_TOKEN }}
1 change: 1 addition & 0 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
license='BSD',
packages=find_packages(exclude=['tests', 'tests.*']),
long_description=long_description,
long_description_content_type='text/x-rst',
# google-colab on PyPi has different requirements than google-colab on Google Colaboratory. It's not possible to
# list a set of requirements that pip can resolve in both environments.
install_requires=[
Expand Down

0 comments on commit 1b66818

Please sign in to comment.