Skip to content

Commit

Permalink
Began switching to hatchling, and requiring Python 3.9+.
Browse files Browse the repository at this point in the history
  • Loading branch information
felixfontein committed Apr 7, 2023
1 parent 8f686ba commit 7954841
Show file tree
Hide file tree
Showing 18 changed files with 614 additions and 422 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
86 changes: 45 additions & 41 deletions .github/workflows/antsibull-docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -55,28 +55,25 @@ 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
pip install -r requirements.txt
working-directory: antsibull-docs

- name: Install collections
Expand All @@ -89,9 +86,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 @@ -101,24 +98,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 @@ -143,10 +145,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 @@ -157,17 +156,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 @@ -192,10 +195,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 @@ -206,13 +206,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
68 changes: 68 additions & 0 deletions .github/workflows/nox.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
---
# 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]
pull_request:
branches: [main]
# 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 -p 3.9 3.10 3.11
- name: Report coverage
run: |
nox -v -e coverage
- name: Upload coverage
uses: codecov/codecov-action@v3
with:
working-directory: antsibull-docs
78 changes: 0 additions & 78 deletions .github/workflows/pythonlinters.yml

This file was deleted.

Loading

0 comments on commit 7954841

Please sign in to comment.