Skip to content

Commit

Permalink
Merge pull request #13 from kmike/gh-actions
Browse files Browse the repository at this point in the history
Move to github actions
  • Loading branch information
fizyk committed May 5, 2021
2 parents 56ccecd + ce1dd8c commit 6c0d172
Show file tree
Hide file tree
Showing 26 changed files with 553 additions and 313 deletions.
1 change: 0 additions & 1 deletion .coveragerc
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,3 @@
omit =
port_for/_download_ranges.py
port_for/docopt.py
port_for/tests.py
8 changes: 8 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
version: 2
updates:
- package-ecosystem: pip
directory: "/"
schedule:
interval: daily
time: "04:00"
open-pull-requests-limit: 10
41 changes: 41 additions & 0 deletions .github/workflows/automerge.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
name: Automerge Pull Requests
on:
pull_request:
types:
- labeled
- unlabeled
- synchronize
- opened
- edited
- ready_for_review
- reopened
- unlocked
pull_request_review:
types:
- submitted
check_suite:
types:
- completed
status: {}

jobs:
automerge:
name: Automerge Dependabot
runs-on: ubuntu-latest
if: github.actor == 'dependabot[bot]' || github.actor == 'dependabot-preview[bot]'
steps:
- name: 'Wait for status checks'
id: waitforstatuschecks
uses: "WyriHaximus/github-action-wait-for-status@v1.3"
with:
ignoreActions: Automerge Dependabot
checkInterval: 13
env:
GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
- name: Merge pull requests
uses: pascalgn/automerge-action@v0.13.1
if: steps.waitforstatuschecks.outputs.status == 'success'
env:
MERGE_METHOD: "squash"
MERGE_LABELS: ""
GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
26 changes: 26 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
name: Test build package

on:
push:
branches: [ master ]
pull_request:
branches: [ master ]

jobs:
build:
name: Build Python 🐍 distributions 📦
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@master
- name: Set up Python 3.9
uses: actions/setup-python@v2
with:
python-version: 3.9
- name: Install build tools
run: pip install pep517
- name: Build a wheel package
run: python -m pep517.build .
- name: Install twine to check the package
run: pip install twine
- name: Check the package
run: twine check dist/*
61 changes: 61 additions & 0 deletions .github/workflows/linters.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
name: Run linters

on:
push:
branches: [ master ]
paths:
- '**.py'
- .github/workflows/linters.yml
- requirements-lint.txt
pull_request:
branches: [ master ]
paths:
- '**.py'
- .github/workflows/linters.yml
- requirements-lint.txt

jobs:
pydocstyle:
runs-on: ubuntu-latest
strategy:
fail-fast: false

steps:
- uses: actions/checkout@v2
- name: Set up Python 3.9
uses: actions/setup-python@v2
with:
python-version: 3.9
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements-lint.txt
- name: Run pydocstyle
run: |
pydocstyle port_for/ tests/
pycodestyle:
runs-on: ubuntu-latest
strategy:
fail-fast: false

steps:
- uses: actions/checkout@v2
- name: Set up Python 3.9
uses: actions/setup-python@v2
with:
python-version: 3.9
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements-lint.txt
- name: Run pydocstyle
run: |
pycodestyle port_for/ tests/
black:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-python@v2
- uses: psf/black@21.5b0
29 changes: 29 additions & 0 deletions .github/workflows/pypi.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
name: Package and publish
on:
push:
tags:
- v*
jobs:
build-n-publish:
name: Build and publish Python 🐍 distributions 📦 to PyPI
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@master
- name: Set up Python 3.9
uses: actions/setup-python@v2
with:
python-version: 3.9
- name: Install build tools
run: pip install pep517
- name: Build a wheel package
run: python -m pep517.build .
# - name: Publish distribution 📦 to Test PyPI
# uses: pypa/gh-action-pypi-publish@master
# with:
# password: ${{ secrets.test_pypi_token }}
# repository_url: https://test.pypi.org/legacy/
- name: Publish distribution 📦 to PyPI
uses: pypa/gh-action-pypi-publish@master
with:
password: ${{ secrets.pypi_token }}
verbose: true
45 changes: 45 additions & 0 deletions .github/workflows/tests-macos.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
name: Run tests on macos

on:
push:
branches: [ master ]
paths:
- '**.py'
- .github/workflows/tests-macos.yml
pull_request:
branches: [ master ]
paths:
- '**.py'
- .github/workflows/tests-macos.yml

jobs:
macostests:
runs-on: macos-latest
strategy:
fail-fast: false
matrix:
python-version: [3.7, 3.8, 3.9, pypy-3.7-v7.3.3]
env:
OS: macos-latest
PYTHON: ${{ matrix.python-version }}

steps:
- uses: actions/checkout@v2
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements-test.txt
- name: Run test
run: |
pytest --cov-report=xml
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v1
with:
file: ./coverage.xml
flags: macos
env_vars: OS, PYTHON
fail_ci_if_error: true
43 changes: 43 additions & 0 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
name: Run tests

on:
push:
branches: [ master ]
paths:
- '**.py'
- .github/workflows/tests.yml
- requirements-test.txt
pull_request:
branches: [ master ]

jobs:
tests:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
python-version: [3.6, 3.7, 3.8, 3.9, pypy-3.7-v7.3.3]
env:
OS: ubuntu-latest
PYTHON: ${{ matrix.python-version }}

steps:
- uses: actions/checkout@v2
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements-test.txt
- name: Run test
run: |
pytest --cov-report=xml
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v1
with:
file: ./coverage.xml
flags: linux
env_vars: OS, PYTHON
fail_ci_if_error: true
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,5 @@ htmlcov
.cache
.ipynb_checkpoints/
MANIFEST
coverage
coverage
venv/
61 changes: 0 additions & 61 deletions .travis.yml

This file was deleted.

6 changes: 0 additions & 6 deletions codecov.yml

This file was deleted.

15 changes: 11 additions & 4 deletions port_for/__init__.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,16 @@
# -*- coding: utf-8 -*-
from __future__ import absolute_import
__version__ = '0.4'

from .api import (available_good_ports, available_ports, is_available,
good_port_ranges, port_is_used, select_random,
UNASSIGNED_RANGES)
__version__ = "0.4"

from .api import (
available_good_ports,
available_ports,
is_available,
good_port_ranges,
port_is_used,
select_random,
UNASSIGNED_RANGES,
)
from .store import PortStore
from .exceptions import PortForException

0 comments on commit 6c0d172

Please sign in to comment.