Skip to content

Commit

Permalink
Switch to hatchling, and requiring Python 3.9+ (#115)
Browse files Browse the repository at this point in the history
* Began switching to hatchling, and requiring Python 3.9+.

* Upgrade pylint and lint.

* Typing linting.

* Review suggestions.

Co-authored-by: Maxwell G <maxwell@gtmx.me>

* Remove leftovers.

* Remove old artifacts before building.

Co-authored-by: Maxwell G <maxwell@gtmx.me>

* Streamline.

Co-authored-by: Maxwell G <maxwell@gtmx.me>

* Fix dependencies.

---------

Co-authored-by: Maxwell G <maxwell@gtmx.me>
  • Loading branch information
felixfontein and gotmax23 authored Apr 8, 2023
1 parent 0d4b174 commit 347e85d
Show file tree
Hide file tree
Showing 42 changed files with 660 additions and 527 deletions.
12 changes: 12 additions & 0 deletions .flake8
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# GNU General Public License v3.0+ (see LICENSES/GPL-3.0-or-later.txt or
# https://www.gnu.org/licenses/gpl-3.0.txt)
# SPDX-License-Identifier: GPL-3.0-or-later
# SPDX-FileCopyrightText: 2023 Maxwell G <maxwell@gtmx.me>

[flake8]
extend-ignore = E203
count = true
max-complexity = 10
# black's max-line-length is 89, but it doesn't touch long string literals.
max-line-length = 100
statistics = true
85 changes: 44 additions & 41 deletions .github/workflows/antsibull-docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -59,28 +59,24 @@ jobs:
- name: Install dependencies
run: |
python -m pip install --upgrade pip
python -m pip install poetry
sed -i -e 's/^python = .*/python = "^${{ matrix.python }}"/' pyproject.toml
poetry install
poetry update
pip install -e .[coverage] ../antsibull-core
working-directory: antsibull-docs

- name: Use antsibull-docs sphinx-init
run: |
poetry run coverage run -p --source antsibull_docs -m antsibull_docs.cli.antsibull_docs sphinx-init --lenient --dest-dir . ${{ matrix.options }}
coverage run -p --source antsibull_docs -m antsibull_docs.cli.antsibull_docs sphinx-init --lenient --dest-dir . ${{ matrix.options }}
working-directory: antsibull-docs

- name: Patch build.sh to supply code coverage
run: |
sed -i build.sh -e 's!antsibull-docs !poetry run coverage run -p --source antsibull_docs -m antsibull_docs.cli.antsibull_docs !g'
sed -i build.sh -e 's!sphinx-build !poetry run coverage run -p --source antsibull_docs --source sphinx_antsibull_ext -m sphinx.cmd.build !g'
sed -i build.sh -e 's!antsibull-docs !coverage run -p --source antsibull_docs -m antsibull_docs.cli.antsibull_docs !g'
sed -i build.sh -e 's!sphinx-build !coverage run -p --source antsibull_docs --source sphinx_antsibull_ext -m sphinx.cmd.build !g'
cat build.sh
working-directory: antsibull-docs

- name: Install dependencies
run: |
poetry run pip install ansible-core
poetry run pip install -r requirements.txt
pip install ansible-core -r requirements.txt
working-directory: antsibull-docs

- name: Install collections
Expand All @@ -93,9 +89,9 @@ jobs:

- name: Lint collection docs
run: |
poetry run coverage run -p --source antsibull_docs --source sphinx_antsibull_ext -m antsibull_docs.cli.antsibull_docs lint-collection-docs ~/.ansible/collections/ansible_collections/community/docker --plugin-docs
poetry run coverage run -p --source antsibull_docs --source sphinx_antsibull_ext -m antsibull_docs.cli.antsibull_docs lint-collection-docs ~/.ansible/collections/ansible_collections/community/crypto
poetry run coverage run -p --source antsibull_docs --source sphinx_antsibull_ext -m antsibull_docs.cli.antsibull_docs lint-collection-docs ~/.ansible/collections/ansible_collections/sensu/sensu_go
coverage run -p --source antsibull_docs --source sphinx_antsibull_ext -m antsibull_docs.cli.antsibull_docs lint-collection-docs ~/.ansible/collections/ansible_collections/community/docker --plugin-docs
coverage run -p --source antsibull_docs --source sphinx_antsibull_ext -m antsibull_docs.cli.antsibull_docs lint-collection-docs ~/.ansible/collections/ansible_collections/community/crypto
coverage run -p --source antsibull_docs --source sphinx_antsibull_ext -m antsibull_docs.cli.antsibull_docs lint-collection-docs ~/.ansible/collections/ansible_collections/sensu/sensu_go
working-directory: antsibull-docs
if: contains(matrix.options, '--use-current')

Expand All @@ -105,24 +101,29 @@ jobs:
working-directory: antsibull-docs

- name: Validate HTML
run:
python .github/workflows/validate-html.py build/html/
run: |
pip install html5lib
python tests/validate-html.py build/html/
working-directory: antsibull-docs

- name: Test plugin rendering
run:
poetry run coverage run -p --source antsibull_docs -m antsibull_docs.cli.antsibull_docs plugin --plugin-type module --dest-dir . community.crypto.acme_account_info
run: |
coverage run -p --source antsibull_docs -m antsibull_docs.cli.antsibull_docs plugin --plugin-type module --dest-dir . community.crypto.acme_account_info
working-directory: antsibull-docs
if: contains(matrix.options, '--use-current')

- name: Combine and upload coverage stats
- name: Combine coverage stats
run: |
poetry run coverage combine .coverage.*
poetry run coverage report
poetry run coverage xml -i
poetry run codecov
coverage combine .coverage.*
coverage report
coverage xml -i
working-directory: antsibull-docs

- name: Upload coverage
uses: codecov/codecov-action@v3
with:
working-directory: antsibull-docs

build-stable:
name: 'Build stable docsite'
runs-on: ubuntu-latest
Expand All @@ -147,10 +148,7 @@ jobs:
- name: Install dependencies
run: |
python -m pip install --upgrade pip
python -m pip install poetry
sed -i -e 's/^python = .*/python = "^3.11"/' pyproject.toml
poetry install
poetry update
pip install -e .[coverage] ../antsibull-core
working-directory: antsibull-docs

- name: Get hold of deps file
Expand All @@ -161,17 +159,21 @@ jobs:
- name: Build stable docs RST files
run: |
mkdir stable-docs
poetry run coverage run -p --source antsibull_docs -m antsibull_docs.cli.antsibull_docs stable --deps-file ansible.deps --dest-dir stable-docs --no-breadcrumbs --no-indexes
coverage run -p --source antsibull_docs -m antsibull_docs.cli.antsibull_docs stable --deps-file ansible.deps --dest-dir stable-docs --no-breadcrumbs --no-indexes
working-directory: antsibull-docs

- name: Combine and upload coverage stats
- name: Combine coverage stats
run: |
poetry run coverage combine .coverage.*
poetry run coverage report
poetry run coverage xml -i
poetry run codecov
coverage combine .coverage.*
coverage report
coverage xml -i
working-directory: antsibull-docs

- name: Upload coverage
uses: codecov/codecov-action@v3
with:
working-directory: antsibull-docs

build-devel:
name: 'Build devel docsite'
runs-on: ubuntu-latest
Expand All @@ -196,10 +198,7 @@ jobs:
- name: Install dependencies
run: |
python -m pip install --upgrade pip
python -m pip install poetry
sed -i -e 's/^python = .*/python = "^3.11"/' pyproject.toml
poetry install
poetry update
pip install -e .[coverage] ../antsibull-core
working-directory: antsibull-docs

- name: Get hold of ansible.in file
Expand All @@ -210,13 +209,17 @@ jobs:
- name: Build devel docs RST files
run: |
mkdir devel-docs
poetry run coverage run -p --source antsibull_docs -m antsibull_docs.cli.antsibull_docs devel --pieces-file ansible.in --dest-dir devel-docs
coverage run -p --source antsibull_docs -m antsibull_docs.cli.antsibull_docs devel --pieces-file ansible.in --dest-dir devel-docs
working-directory: antsibull-docs

- name: Combine and upload coverage stats
- name: Combine coverage stats
run: |
poetry run coverage combine .coverage.*
poetry run coverage report
poetry run coverage xml -i
poetry run codecov
coverage combine .coverage.*
coverage report
coverage xml -i
working-directory: antsibull-docs

- name: Upload coverage
uses: codecov/codecov-action@v3
with:
working-directory: antsibull-docs
72 changes: 72 additions & 0 deletions .github/workflows/nox.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
---
# GNU General Public License v3.0+ (see LICENSES/GPL-3.0-or-later.txt or
# https://www.gnu.org/licenses/gpl-3.0.txt)
# SPDX-License-Identifier: GPL-3.0-or-later
# SPDX-FileCopyrightText: 2023 Maxwell G <maxwell@gtmx.me

name: nox
'on':
push:
branches:
- main
- stable-*
pull_request:
branches:
- main
- stable-*
# Run once per week (Monday at 04:00 UTC)
schedule:
- cron: '0 4 * * 1'
workflow_dispatch:

jobs:
nox-lint:
runs-on: ubuntu-latest
defaults:
run:
working-directory: antsibull-docs
steps:
- name: Check out antsibull-docs
uses: actions/checkout@v3
with:
path: antsibull-docs
- name: Check out dependent project antsibull-core
uses: actions/checkout@v3
with:
repository: ansible-community/antsibull-core
path: antsibull-core
- name: Setup nox
uses: wntrblm/nox@2022.11.21
with:
python-versions: "3.11"
- run: |
nox -v -e lint
nox-test:
runs-on: ubuntu-latest
defaults:
run:
working-directory: antsibull-docs
steps:
- name: Check out antsibull-docs
uses: actions/checkout@v3
with:
path: antsibull-docs
- name: Check out dependent project antsibull-core
uses: actions/checkout@v3
with:
repository: ansible-community/antsibull-core
path: antsibull-core
- name: Setup nox
uses: wntrblm/nox@2022.11.21
with:
python-versions: "3.9, 3.10, 3.11"
- name: Run unit tests
run: |
nox -v -e test
- name: Report coverage
run: |
nox -v -e coverage
- name: Upload coverage
uses: codecov/codecov-action@v3
with:
working-directory: antsibull-docs
82 changes: 0 additions & 82 deletions .github/workflows/pythonlinters.yml

This file was deleted.

Loading

0 comments on commit 347e85d

Please sign in to comment.