Skip to content

Commit

Permalink
Merge branch 'github-ci'
Browse files Browse the repository at this point in the history
  • Loading branch information
Matthieu Berthomé committed Aug 23, 2020
2 parents 842c507 + ad6ee83 commit c726a53
Show file tree
Hide file tree
Showing 8 changed files with 153 additions and 55 deletions.
109 changes: 109 additions & 0 deletions .github/workflows/python-package.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,109 @@
name: Python package

on: [push, pull_request]

jobs:
generate:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
- name: Set up Python 3.6
uses: actions/setup-python@v1
with:
python-version: 3.6
- uses: dschep/install-pipenv-action@v1
- name: Install dependencies
run: pipenv install --dev --python 3.6
- name: generate code
run: pipenv run python local_gen.py
- uses: actions/upload-artifact@master
with:
name: generated-ldraw-library
path: ldraw/library

test:
needs: generate
runs-on: ubuntu-latest
strategy:
max-parallel: 4
matrix:
python-version: [3.5, 3.6, 3.7]

steps:
- uses: actions/checkout@v1
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v1
with:
python-version: ${{ matrix.python-version }}
- uses: dschep/install-pipenv-action@v1
- name: Install dependencies
run: pipenv install --dev --python ${{ matrix.python-version }}

- uses: actions/download-artifact@master
with:
name: generated-ldraw-library
path: ldraw/library

- name: install for test
run: |
pipenv install --dev
pipenv run pip freeze
- name: Test with pytest
run: pipenv run pytest --cov=ldraw
- name: Coveralls
env:
COVERALLS_REPO_TOKEN: ${{ secrets.coveralls_repo_token }}
run: pipenv run coveralls

publish:
needs:
- test
- generate
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
- name: Set up Python 3.6
uses: actions/setup-python@v1
with:
python-version: 3.6
- uses: dschep/install-pipenv-action@v1
- name: Install dependencies
run: pipenv --python 3.6 install --dev

- uses: actions/download-artifact@master
with:
name: generated-ldraw-library
path: ldraw/library

- name: Build package
run: |
pipenv run python setup.py sdist bdist_wheel
- name: Twine check
run: pipenv run twine check dist/*
- name: test upload
if: github.event_name == 'push' && startsWith(github.event.ref, 'refs/tags')
env:
TWINE_USERNAME: __token__
TWINE_PASSWORD: ${{ secrets.testpypi_password }}
run: |
pipenv run twine upload --repository-url https://test.pypi.org/legacy/ dist/*
- name: Publish package
if: github.event_name == 'push' && startsWith(github.event.ref, 'refs/tags')
env:
TWINE_USERNAME: __token__
TWINE_PASSWORD: ${{ secrets.pypi_password }}
run: |
pipenv run twine upload dist/*
cleanup_job:
needs: publish
if: always()
runs-on: ubuntu-latest
steps:
- name: call webhook to delete artifacts
env:
FOR_WEBHOOKS_SECRET: ${{ secrets.FOR_WEBHOOKS_SECRET }}
run: |
echo "::add-mask::$FOR_WEBHOOKS_SECRET"
curl --verbose --fail --show-error --location --request POST "https://api.github.com/repos/$GITHUB_REPOSITORY/dispatches" --header "Authorization: token $FOR_WEBHOOKS_SECRET" --header 'Content-Type: application/json' --header 'Accept: application/vnd.github.everest-preview+json' --data-raw "{ \"event_type\": \"delete_all_artifacts\", \"client_payload\": {\"parent_runid\": \"$GITHUB_RUN_ID\", \"parent_repo\": \"$GITHUB_REPOSITORY\"} }"
14 changes: 14 additions & 0 deletions .github/workflows/webhook_target.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
name: delete calling job's artifacts
on: repository_dispatch
jobs:
main:
runs-on: ubuntu-latest
steps:
- name: Delete artifacts
if: github.event.action == 'delete_all_artifacts'
uses: christian-korneck/delete-run-artifacts-action@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
parent_runid: ${{ github.event.client_payload.parent_runid }}
parent_repo: ${{ github.event.client_payload.parent_repo }}
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,5 @@ tmp/
\.tox
tmp/
ldraw/library/

dist/
Pipfile.lock
33 changes: 0 additions & 33 deletions .travis.yml

This file was deleted.

26 changes: 26 additions & 0 deletions Pipfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
[[source]]
name = "pypi"
url = "https://pypi.org/simple"
verify_ssl = true

[dev-packages]
pycodestyle = "*"
pytest = "*"
coveralls = "*"
pytest-cov = "*"
mock = "*"
setuptools-scm = "*"
twine = "*"

[packages]
appdirs = "*"
numpy = "*"
pymklist = "*"
pystache = "*"
attrdict = "*"
progress = "*"
PyYAML = "*"
Pillow = "*"

[pipenv]
allow_prereleases = true
4 changes: 2 additions & 2 deletions README.rst
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
.. image:: https://coveralls.io/repos/github/rienafairefr/python-ldraw/badge.svg?branch=master
:target: https://coveralls.io/github/rienafairefr/python-ldraw?branch=master

.. image:: https://travis-ci.org/rienafairefr/python-ldraw.svg?branch=master
:target: https://travis-ci.org/rienafairefr/python-ldraw
.. image:: https://github.com/rienafairefr/python-ldraw/workflows/Python%20package/badge.svg
:target: https://github.com/rienafairefr/python-ldraw/actions?query=workflow%3A%22Python+package%22

.. image:: https://img.shields.io/pypi/pyversions/pyldraw.svg :alt: PyPI - Python Version
:target: https://pypi.python.org/pypi/pyldraw
Expand Down
3 changes: 1 addition & 2 deletions dev-requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,4 @@ coveralls
pytest-cov
mock
setuptools_scm
tox
ipdb
twine
17 changes: 0 additions & 17 deletions tox.ini

This file was deleted.

0 comments on commit c726a53

Please sign in to comment.