-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Hypermodern Python Cookiecutter f993d87
- Loading branch information
Showing
10 changed files
with
154 additions
and
154 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
pip==20.1 | ||
pip==20.1.1 | ||
nox==2019.11.9 | ||
poetry==1.0.5 | ||
virtualenv==20.0.21 |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,42 +1,72 @@ | ||
name: Release | ||
|
||
on: | ||
release: | ||
types: [published] | ||
push: | ||
branches: | ||
- master | ||
|
||
jobs: | ||
release: | ||
name: Release | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/[email protected] | ||
- uses: actions/setup-python@v2 | ||
- name: Check out the repository | ||
uses: actions/[email protected] | ||
with: | ||
fetch-depth: 2 | ||
|
||
- name: Set up Python | ||
uses: actions/setup-python@v2 | ||
with: | ||
python-version: "3.8" | ||
- 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 | ||
|
||
- name: Upgrade pip | ||
run: | | ||
import hashlib | ||
import sys | ||
pip install --constraint=.github/workflows/constraints.txt pip | ||
pip --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: Install Poetry | ||
run: | | ||
pip install --constraint=.github/workflows/constraints.txt poetry | ||
poetry --version | ||
print("::set-output name=result::{}".format(result)) | ||
- uses: actions/[email protected] | ||
if: matrix.os != 'windows-latest' | ||
- name: Detect and tag new version | ||
id: check-version | ||
uses: salsify/[email protected] | ||
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/[email protected] | ||
version-command: | | ||
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/[email protected] | ||
with: | ||
user: __token__ | ||
password: ${{ secrets.PYPI_TOKEN }} | ||
|
||
- name: Publish package on TestPyPI | ||
if: "! steps.check-version.outputs.tag" | ||
uses: pypa/[email protected] | ||
with: | ||
user: __token__ | ||
password: ${{ secrets.TEST_PYPI_TOKEN }} | ||
repository_url: https://test.pypi.org/legacy/ | ||
|
||
- name: Publish the release notes | ||
uses: release-drafter/[email protected] | ||
with: | ||
publish: ${{ steps.check-version.outputs.tag != '' }} | ||
tag: ${{ steps.check-version.outputs.tag }} | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,26 +1,59 @@ | ||
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-3.8" } | ||
- { python-version: 3.7, os: ubuntu-latest, session: "mypy-3.7" } | ||
- { python-version: 3.6, os: ubuntu-latest, session: "mypy-3.6" } | ||
- { python-version: 3.8, os: ubuntu-latest, session: "tests-3.8" } | ||
- { python-version: 3.7, os: ubuntu-latest, session: "tests-3.7" } | ||
- { python-version: 3.6, os: ubuntu-latest, session: "tests-3.6" } | ||
- { python-version: 3.8, os: windows-latest, session: "tests-3.8" } | ||
- { python-version: 3.8, os: macos-latest, session: "tests-3.8" } | ||
- { python-version: 3.8, os: ubuntu-latest, session: "docs" } | ||
|
||
env: | ||
NOXSESSION: ${{ matrix.session }} | ||
|
||
steps: | ||
- uses: actions/[email protected] | ||
- uses: actions/setup-python@v2 | ||
- name: Check out the repository | ||
uses: actions/[email protected] | ||
|
||
- name: Set up Python ${{ matrix.python-version }} | ||
uses: actions/setup-python@v2 | ||
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: Compute pre-commit cache key | ||
if: matrix.session == 'pre-commit' | ||
id: pre-commit-cache | ||
shell: python | ||
run: | | ||
import hashlib | ||
|
@@ -32,14 +65,32 @@ jobs: | |
result = "${{ runner.os }}-{}-{}-pre-commit".format(python, digest[:8]) | ||
print("::set-output name=result::{}".format(result)) | ||
- uses: actions/[email protected] | ||
if: matrix.os != 'windows-latest' | ||
- name: Restore pre-commit cache | ||
uses: actions/[email protected] | ||
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 | ||
- name: Upload documentation | ||
if: matrix.session == 'docs' | ||
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/[email protected] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.