Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Initial implementation #99

Merged
merged 17 commits into from
Sep 25, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .cookiecutter.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"_template": "gh:cjolowicz/cookiecutter-hypermodern-python",
"_template": "https://github.com/cjolowicz/cookiecutter-hypermodern-python.git",
"author": "Claudio Jolowicz",
"email": "mail@claudiojolowicz.com",
"friendly_name": "nox-poetry",
Expand Down
26 changes: 0 additions & 26 deletions .dependabot/config.yml

This file was deleted.

2 changes: 1 addition & 1 deletion .flake8
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[flake8]
select = B,B9,C,D,DAR,E,F,N,RST,S,W
ignore = E203,E501,W503
ignore = E203,E501,RST203,RST301,W503
max-line-length = 80
max-complexity = 10
docstring-convention = google
Expand Down
18 changes: 18 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
version: 2
updates:
- package-ecosystem: github-actions
directory: "/"
schedule:
interval: daily
- package-ecosystem: pip
directory: "/.github/workflows"
schedule:
interval: daily
- package-ecosystem: pip
directory: "/docs"
schedule:
interval: daily
- package-ecosystem: pip
directory: "/"
schedule:
interval: daily
7 changes: 4 additions & 3 deletions .github/workflows/constraints.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
pip==20.1
nox==2019.11.9
poetry==1.0.5
pip==20.2.3
nox==2020.8.22
poetry==1.0.10
virtualenv==20.0.31
16 changes: 0 additions & 16 deletions .github/workflows/coverage.yml

This file was deleted.

18 changes: 0 additions & 18 deletions .github/workflows/docs.yml

This file was deleted.

12 changes: 0 additions & 12 deletions .github/workflows/release-drafter.yml

This file was deleted.

88 changes: 62 additions & 26 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -1,42 +1,78 @@
name: Release

on:
release:
types: [published]
push:
branches:
- master

jobs:
release:
name: Release
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2.1.0
- uses: actions/setup-python@v2
- name: Check out the repository
uses: actions/checkout@v2.3.2
with:
fetch-depth: 2

- name: Set up Python
uses: actions/setup-python@v2.1.2
with:
python-version: "3.8"
- run: |

- name: Upgrade pip
run: |
pip install --constraint=.github/workflows/constraints.txt pip
pip install --constraint=.github/workflows/constraints.txt nox poetry
- name: Compute cache key prefix
if: matrix.os != 'windows-latest'
id: cache_key_prefix
shell: python
pip --version

- name: Install Poetry
run: |
import hashlib
import sys
pip install --constraint=.github/workflows/constraints.txt poetry
poetry --version

python = "py{}.{}".format(*sys.version_info[:2])
payload = sys.version.encode() + sys.executable.encode()
digest = hashlib.sha256(payload).hexdigest()
result = "${{ runner.os }}-{}-{}-pre-commit".format(python, digest[:8])
- name: Check if there is a parent commit
id: check-parent-commit
run: |
echo "::set-output name=sha::$(git rev-parse --verify --quiet HEAD^)"

print("::set-output name=result::{}".format(result))
- uses: actions/cache@v1.2.0
if: matrix.os != 'windows-latest'
- name: Detect and tag new version
id: check-version
if: steps.check-parent-commit.outputs.sha
uses: salsify/action-detect-and-tag-new-version@v2.0.1
with:
path: ~/.cache/pre-commit
key: ${{ steps.cache_key_prefix.outputs.result }}-${{ hashFiles('.pre-commit-config.yaml') }}
restore-keys: |
${{ steps.cache_key_prefix.outputs.result }}-
- run: nox --force-color
- run: poetry build --ansi
- uses: pypa/gh-action-pypi-publish@v1.1.0
version-command: |
bash -o pipefail -c "poetry version | awk '{ print \$2 }'"

- name: Bump version for developmental release
if: "! steps.check-version.outputs.tag"
run: |
poetry version patch &&
version=$(poetry version | awk '{ print $2 }') &&
poetry version $version.dev.$(date +%s)

- name: Build package
run: |
poetry build --ansi

- name: Publish package on PyPI
if: steps.check-version.outputs.tag
uses: pypa/gh-action-pypi-publish@v1.3.1
with:
user: __token__
password: ${{ secrets.PYPI_TOKEN }}

- name: Publish package on TestPyPI
if: "! steps.check-version.outputs.tag"
uses: pypa/gh-action-pypi-publish@v1.3.1
with:
user: __token__
password: ${{ secrets.TEST_PYPI_TOKEN }}
repository_url: https://test.pypi.org/legacy/

- name: Publish the release notes
uses: release-drafter/release-drafter@v5.11.0
with:
publish: ${{ steps.check-version.outputs.tag != '' }}
tag: ${{ steps.check-version.outputs.tag }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
26 changes: 0 additions & 26 deletions .github/workflows/test-pypi.yml

This file was deleted.

97 changes: 76 additions & 21 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
@@ -1,26 +1,63 @@
name: Tests
on: [push, pull_request]

on:
- push
- pull_request

jobs:
tests:
name: ${{ matrix.session }} ${{ matrix.python-version }} / ${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
include:
- { python-version: 3.8, os: ubuntu-latest }
- { python-version: 3.8, os: windows-latest }
- { python-version: 3.8, os: macos-latest }
- { python-version: 3.7, os: ubuntu-latest }
- { python-version: 3.6, os: ubuntu-latest }
runs-on: ${{ matrix.os }}
name: Python ${{ matrix.python-version }} (${{ matrix.os }})
- { python-version: 3.8, os: ubuntu-latest, session: "pre-commit" }
- { python-version: 3.8, os: ubuntu-latest, session: "safety" }
- { python-version: 3.8, os: ubuntu-latest, session: "mypy" }
- { python-version: 3.7, os: ubuntu-latest, session: "mypy" }
- { python-version: 3.6, os: ubuntu-latest, session: "mypy" }
- { python-version: 3.8, os: ubuntu-latest, session: "tests" }
- { python-version: 3.7, os: ubuntu-latest, session: "tests" }
- { python-version: 3.6, os: ubuntu-latest, session: "tests" }
- { python-version: 3.8, os: windows-latest, session: "tests" }
- { python-version: 3.8, os: macos-latest, session: "tests" }
- { python-version: 3.8, os: ubuntu-latest, session: "docs-build" }

env:
NOXSESSION: ${{ matrix.session }}

steps:
- uses: actions/checkout@v2.1.0
- uses: actions/setup-python@v2
- name: Check out the repository
uses: actions/checkout@v2.3.2

- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2.1.2
with:
python-version: ${{ matrix.python-version }}
- name: Compute cache key prefix
if: matrix.os != 'windows-latest'
id: cache_key_prefix

- name: Upgrade pip
run: |
pip install --constraint=.github/workflows/constraints.txt pip
pip --version

- name: Install Poetry
run: |
pip install --constraint=.github/workflows/constraints.txt poetry
poetry --version

- name: Install Nox
run: |
pip install --constraint=.github/workflows/constraints.txt nox
nox --version

- name: Install nox-poetry
run: |
pip install .

- name: Compute pre-commit cache key
if: matrix.session == 'pre-commit'
id: pre-commit-cache
shell: python
run: |
import hashlib
Expand All @@ -32,14 +69,32 @@ jobs:
result = "${{ runner.os }}-{}-{}-pre-commit".format(python, digest[:8])

print("::set-output name=result::{}".format(result))
- uses: actions/cache@v1.2.0
if: matrix.os != 'windows-latest'

- name: Restore pre-commit cache
uses: actions/cache@v2
if: matrix.session == 'pre-commit'
with:
path: ~/.cache/pre-commit
key: ${{ steps.cache_key_prefix.outputs.result }}-${{ hashFiles('.pre-commit-config.yaml') }}
key: ${{ steps.pre-commit-cache.outputs.result }}-${{ hashFiles('.pre-commit-config.yaml') }}
restore-keys: |
${{ steps.cache_key_prefix.outputs.result }}-
- run: |
pip install --constraint=.github/workflows/constraints.txt pip
pip install --constraint=.github/workflows/constraints.txt nox poetry
- run: nox --force-color
${{ steps.pre-commit-cache.outputs.result }}-

- name: Run Nox
run: |
nox --force-color --python=${{ matrix.python-version }}

- name: Upload documentation
if: matrix.session == 'docs-build'
uses: actions/upload-artifact@v2
with:
name: docs
path: docs/_build

- name: Create coverage report
if: always() && matrix.session == 'tests'
run: |
nox --force-color --session=coverage -- xml

- name: Upload coverage report
if: always() && matrix.session == 'tests'
uses: codecov/codecov-action@v1.0.13
Loading