Skip to content

Commit

Permalink
Merge pull request #1 from wtnb75/ci
Browse files Browse the repository at this point in the history
GitHub Actions対応
  • Loading branch information
wtnb75 authored Dec 19, 2019
2 parents f85ecd1 + 7853ebd commit ad5aa17
Show file tree
Hide file tree
Showing 11 changed files with 176 additions and 3 deletions.
43 changes: 43 additions & 0 deletions .github/workflows/gh-pages.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
name: build and deploy to gh-pages

on:
push:
branches: [master]

jobs:
build-deploy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@master
- name: setup python 3.7
uses: actions/setup-python@v1
with:
python-version: 3.7
- name: get pip cache
id: pip-cache
run: |
python -c "from pip._internal.locations import USER_CACHE_DIR; print('::set-output name=dir::' + USER_CACHE_DIR)"
- name: cache
uses: actions/cache@v1
with:
path: ${{ steps.pip-cache.outputs.dir }}
key: ${{ runner.os }}-pip-${{ hashfiles('**/requirements.txt') }}
restore-keys: ${{ runner.os }}-pip-
- name: Install dev-dependencies
run: pip install -r requirements.txt -r requirements-dev.txt
- name: coverage test
run: nosetests -c .noserc
- name: build wheel
run: python setup.py bdist_wheel
- name: create index
run: dir2pi -S dist
- name: merge contents
run: cp -r dist/simple/ cover/dist/
- name: disable jekyll
run: touch cover/.nojekyll
- name: deploy to gh-pages
uses: peaceiris/actions-gh-pages@v2
env:
ACTIONS_DEPLOY_KEY: ${{ secrets.ACTIONS_DEPLOY_KEY }}
PUBLISH_BRANCH: gh-pages
PUBLISH_DIR: ./cover
38 changes: 38 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
name: CI

on:
push:
branches-ignore: [master, gh-pages]

jobs:
nosetest:

runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, windows-latest, macOS-latest]
pyver: ["3.6", "3.7", "3.8"]

steps:
- uses: actions/checkout@v1
- name: setup python ${{ matrix.pyver }}
uses: actions/setup-python@v1
with:
python-version: ${{ matrix.pyver }}
- name: get pip cache
id: pip-cache
run: |
python -c "from pip._internal.locations import USER_CACHE_DIR; print('::set-output name=dir::' + USER_CACHE_DIR)"
- name: cache
uses: actions/cache@v1
with:
path: ${{ steps.pip-cache.outputs.dir }}
key: ${{ runner.os }}-pip-${{ hashfiles('**/requirements.txt') }}
restore-keys: ${{ runner.os }}-pip-
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt -r requirements-dev.txt
- name: run test
run: |
nosetests -c .noserc
41 changes: 41 additions & 0 deletions .github/workflows/pypi.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
name: release to pypi

on:
push:
tags:
- 'v*'

jobs:
deploy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@master
- name: setup python 3.8
uses: actions/setup-python@v1
with:
python-version: 3.8
- name: get pip cache
id: pip-cache
run: |
python -c "from pip._internal.locations import USER_CACHE_DIR; print('::set-output name=dir::' + USER_CACHE_DIR)"
- name: cache
uses: actions/cache@v1
with:
path: ${{ steps.pip-cache.outputs.dir }}
key: ${{ runner.os }}-pip-${{ hashfiles('**/requirements.txt') }}
restore-keys: ${{ runner.os }}-pip-
- name: Install dependencies
run: pip install -r requirements.txt -r requirements-dev.txt
- name: versioning
run: "echo \"VERSION = '${GITHUB_REF##*/v}'\" > dirimport/_version.py"
- name: build wheel
run: python setup.py bdist_wheel
- name: check
run: twine check dist/*.whl
- name: deploy to pypi
run: twine upload dist/*.whl
env:
TWINE_USERNAME: ${{ secrets.TWINE_USERNAME }}
TWINE_PASSWORD: ${{ secrets.TWINE_PASSWORD }}
TWINE_REPOSITORY_URL: ${{ secrets.TWINE_REPOSITORY_URL }}
TWINE_NON_INTERACTIVE: "1"
34 changes: 34 additions & 0 deletions .github/workflows/style.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
name: CI

on:
push:
branches-ignore: [master, gh-pages]

jobs:
style:

runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
- name: setup python 3.8
uses: actions/setup-python@v1
with:
python-version: 3.8
- name: get pip cache
id: pip-cache
run: |
python -c "from pip._internal.locations import USER_CACHE_DIR; print('::set-output name=dir::' + USER_CACHE_DIR)"
- name: cache
uses: actions/cache@v1
with:
path: ${{ steps.pip-cache.outputs.dir }}
key: ${{ runner.os }}-pip-${{ hashfiles('**/requirements.txt') }}
restore-keys: ${{ runner.os }}-pip-
- name: Install checker
run: |
python -m pip install --upgrade pip
pip install pyflakes pycodestyle
- name: check coding style
run: pycodestyle --max-line-length=120 dirimport
- name: pyflakes
run: pyflakes dirimport/[^_]*.py
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,5 @@ dist
.mypy_cache
man
*.sh
.coverage
cover
6 changes: 6 additions & 0 deletions .noserc
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
[nosetests]
with-doctest=1
with-coverage=1
cover-package=dirimport
cover-html=1
verbosity=2
6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -65,3 +65,9 @@ Commands:
## examples

- [ex1](examples/ex1.ipynb)

# Links

- [pypi](https://pypi.org/project/dirimport/)
- [coverage](https://wtnb75.github.io/dirimport/)
- [local pypi repo](https://wtnb75.github.io/dirimport/dist/)
4 changes: 2 additions & 2 deletions dirimport/__main__.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import os
import click
from . import gen

VERSION = "0.0.2"
from ._version import VERSION


@click.group(invoke_without_command=True)
@click.version_option(VERSION)
@click.pass_context
def cli(ctx):
if ctx.invoked_subcommand is None:
Expand Down
1 change: 1 addition & 0 deletions dirimport/_version.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
VERSION = "0.0.1-master"
2 changes: 2 additions & 0 deletions requirements-dev.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,5 @@ jupyter
wheel
nose
twine
coverage
pip2pi
2 changes: 1 addition & 1 deletion setup.cfg
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[metadata]
name = dirimport
version = attr: dirimport.__main__.VERSION
version = attr: dirimport._version.VERSION
url = https://github.com/wtnb75/dirimport
author = Takashi WATANABE
author_email = wtnb75@gmail.com
Expand Down

0 comments on commit ad5aa17

Please sign in to comment.