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

Switch to hatchling, and requiring Python 3.9+ #115

Merged
merged 8 commits into from
Apr 8, 2023
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
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
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we move this to an integration nox target?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I first wanted to do that, but than decided to not do it in this PR since it is a quite extensive job, and also there would be five different targets and not just one (you really want to run them in parallel since they take a long time).

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nox supports parametrizing sessions which would make this easier, but yeah, I think it's reasonable to do that separately.

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
gotmax23 marked this conversation as resolved.
Show resolved Hide resolved
gotmax23 marked this conversation as resolved.
Show resolved Hide resolved
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
gotmax23 marked this conversation as resolved.
Show resolved Hide resolved
- 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