-
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
128 additions
and
165 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 |
---|---|---|
|
@@ -6,8 +6,8 @@ on: | |
release: | ||
types: [published] | ||
schedule: | ||
# Daily at 3:21 | ||
- cron: "21 3 * * *" | ||
# Daily at 3:11 | ||
- cron: "11 3 * * *" | ||
|
||
jobs: | ||
pre-commit: | ||
|
@@ -25,78 +25,25 @@ jobs: | |
fail-fast: false | ||
matrix: | ||
os: [macos-latest, ubuntu-latest] | ||
python-version: | ||
- name: pypy-3.9 | ||
toxenv: pypy3-build | ||
- name: pypy-3.9 | ||
toxenv: pypy3-safety | ||
- name: pypy-3.9 | ||
toxenv: pypy3-tests | ||
- name: 3.7 | ||
toxenv: py37-build | ||
- name: 3.7 | ||
toxenv: py37-safety | ||
- name: 3.7 | ||
toxenv: py37-tests | ||
- name: 3.8 | ||
toxenv: py38-build | ||
- name: 3.8 | ||
toxenv: py38-safety | ||
- name: 3.8 | ||
toxenv: py38-tests | ||
- name: 3.9 | ||
toxenv: py39-build | ||
- name: 3.9 | ||
toxenv: py39-safety | ||
- name: 3.9 | ||
toxenv: py39-tests | ||
- name: "3.10" | ||
toxenv: py310-build | ||
- name: "3.10" | ||
toxenv: py310-safety | ||
- name: "3.10" | ||
toxenv: py310-tests | ||
- name: "3.11" | ||
toxenv: py311-build | ||
- name: "3.11" | ||
toxenv: py311-safety | ||
- name: "3.11" | ||
toxenv: py311-tests | ||
- name: "3.11" | ||
toxenv: docs-dirhtml | ||
- name: "3.11" | ||
toxenv: docs-doctest | ||
- name: "3.11" | ||
toxenv: docs-linkcheck | ||
- name: "3.11" | ||
toxenv: docs-spelling | ||
- name: "3.11" | ||
toxenv: docs-style | ||
- name: "3.11" | ||
toxenv: readme | ||
- name: "3.11" | ||
toxenv: secrets | ||
- name: "3.11" | ||
toxenv: style | ||
|
||
steps: | ||
- uses: actions/checkout@v3 | ||
- name: Set up Python | ||
uses: actions/setup-python@v4 | ||
with: | ||
python-version: ${{ matrix.python-version.name }} | ||
- name: Install dependencies | ||
run: > | ||
sudo apt-get update && | ||
sudo apt-get install -y libenchant-2-dev libxml2-dev libxslt-dev | ||
if: runner.os == 'Linux' && startsWith(matrix.python-version.toxenv, 'docs-') | ||
if: runner.os == 'Linux' | ||
- name: Install dependencies | ||
run: brew install enchant | ||
if: runner.os == 'macOS' && startsWith(matrix.python-version.toxenv, 'docs-') | ||
- name: Install tox | ||
run: python -m pip install tox | ||
- name: Run tox | ||
run: python -m tox -e "${{ matrix.python-version.toxenv }}" | ||
if: runner.os == 'macOS' | ||
- name: Set up Python | ||
uses: actions/setup-python@v4 | ||
with: | ||
python-version: "3.11" | ||
- name: Set up nox | ||
uses: wntrblm/[email protected] | ||
- name: Run nox | ||
run: nox | ||
|
||
packaging: | ||
needs: ci | ||
|
@@ -112,23 +59,23 @@ jobs: | |
run: python -m pip install build | ||
- name: Create packages | ||
run: python -m build . | ||
- name: Set up nox | ||
uses: wntrblm/[email protected] | ||
- uses: actions/upload-artifact@v3 | ||
with: | ||
name: dist | ||
path: dist | ||
- name: Publish package | ||
- name: Publish to PyPI | ||
if: github.event_name == 'push' && startsWith(github.event.ref, 'refs/tags') | ||
uses: pypa/gh-action-pypi-publish@release/v1 | ||
with: | ||
user: __token__ | ||
password: ${{ secrets.pypi_password }} | ||
- name: Create Release Notes | ||
- name: Create a Release | ||
if: github.event_name == 'push' && startsWith(github.event.ref, 'refs/tags') | ||
uses: actions/github-script@v6 | ||
uses: softprops/action-gh-release@v1 | ||
with: | ||
github-token: ${{ secrets.GITHUB_TOKEN }} | ||
script: | | ||
await github.request(`POST /repos/${{ github.repository }}/releases`, { | ||
tag_name: "${{ github.ref }}", | ||
generate_release_notes: true | ||
}); | ||
files: | | ||
shiv/bowtie | ||
dist/* | ||
generate_release_notes: true |
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
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 |
---|---|---|
@@ -0,0 +1,101 @@ | ||
from pathlib import Path | ||
|
||
import nox | ||
|
||
ROOT = Path(__file__).parent | ||
DOCS = ROOT / "docs" | ||
PACKAGE = ROOT / "sphinx_json_schema_spec" | ||
|
||
|
||
nox.options.sessions = [] | ||
|
||
|
||
def session(default=True, **kwargs): | ||
def _session(fn): | ||
if default: | ||
nox.options.sessions.append(kwargs.get("name", fn.__name__)) | ||
return nox.session(**kwargs)(fn) | ||
|
||
return _session | ||
|
||
|
||
@session(python=["3.7", "3.8", "3.9", "3.10", "3.11", "pypy3"]) | ||
def tests(session): | ||
session.install("-r", str(ROOT / "test-requirements.txt")) | ||
session.run("pytest", "--verbosity=3") | ||
|
||
|
||
@session(tags=["build"]) | ||
def build(session): | ||
session.install("build") | ||
tmpdir = session.create_tmp() | ||
session.run("python", "-m", "build", str(ROOT), "--outdir", tmpdir) | ||
|
||
|
||
@session(tags=["style"]) | ||
def readme(session): | ||
session.install("build", "twine") | ||
tmpdir = session.create_tmp() | ||
session.run("python", "-m", "build", str(ROOT), "--outdir", tmpdir) | ||
session.run("python", "-m", "twine", "check", tmpdir + "/*") | ||
|
||
|
||
@session(tags=["style"]) | ||
def style(session): | ||
session.install( | ||
"flake8", | ||
"flake8-broken-line", | ||
"flake8-bugbear", | ||
"flake8-commas", | ||
"flake8-quotes", | ||
"flake8-tidy-imports", | ||
) | ||
session.run("python", "-m", "flake8", str(PACKAGE), __file__) | ||
|
||
|
||
@session() | ||
def typing(session): | ||
session.install("mypy", "types-docutils", "types-lxml", str(ROOT)) | ||
session.run("python", "-m", "mypy", str(PACKAGE)) | ||
|
||
|
||
@session(tags=["docs"]) | ||
@nox.parametrize( | ||
"builder", | ||
[ | ||
nox.param(name, id=name) | ||
for name in [ | ||
"dirhtml", | ||
"doctest", | ||
"linkcheck", | ||
"man", | ||
"spelling", | ||
] | ||
], | ||
) | ||
def docs(session, builder): | ||
session.install("-r", str(DOCS / "requirements.txt")) | ||
tmpdir = Path(session.create_tmp()) | ||
argv = ["-n", "-T", "-W"] | ||
if builder != "spelling": | ||
argv += ["-q"] | ||
session.run( | ||
"python", | ||
"-m", | ||
"sphinx", | ||
"-b", | ||
builder, | ||
str(DOCS), | ||
str(tmpdir / builder), | ||
*argv, | ||
) | ||
|
||
|
||
@session(tags=["docs", "style"], name="docs(style)") | ||
def docs_style(session): | ||
session.install( | ||
"doc8", | ||
"pygments", | ||
"pygments-github-lexers", | ||
) | ||
session.run("python", "-m", "doc8", "--max-line-length", "1000", str(DOCS)) |
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
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