mirror of
https://github.com/ansible-collections/community.routeros.git
synced 2025-08-20 01:28:27 +02:00
Use antsibull-nox for CI. (#361)
This commit is contained in:
parent
9dba8082f9
commit
e286d768c0
36 changed files with 168 additions and 651 deletions
50
noxfile.py
Normal file
50
noxfile.py
Normal file
|
@ -0,0 +1,50 @@
|
|||
|
||||
# The following metadata allows Python runners and nox to install the required
|
||||
# dependencies for running this Python script:
|
||||
#
|
||||
# /// script
|
||||
# dependencies = ["nox>=2025.02.09", "antsibull-nox"]
|
||||
# ///
|
||||
|
||||
import os
|
||||
import sys
|
||||
|
||||
import nox
|
||||
|
||||
|
||||
# We try to import antsibull-nox, and if that doesn't work, provide a more useful
|
||||
# error message to the user.
|
||||
try:
|
||||
import antsibull_nox
|
||||
except ImportError:
|
||||
print("You need to install antsibull-nox in the same Python environment as nox.")
|
||||
sys.exit(1)
|
||||
|
||||
|
||||
IN_CI = os.environ.get("CI") == "true"
|
||||
|
||||
|
||||
antsibull_nox.load_antsibull_nox_toml()
|
||||
|
||||
|
||||
@nox.session(name="update-docs", default=True)
|
||||
def update_docs_fragments(session: nox.Session) -> None:
|
||||
"""
|
||||
Update/check auto-generated parts of docs fragments.
|
||||
"""
|
||||
session.install("ansible-core")
|
||||
prepare = antsibull_nox.sessions.prepare_collections(
|
||||
session, install_in_site_packages=True
|
||||
)
|
||||
if not prepare:
|
||||
return
|
||||
data = ["python", "tests/update-docs.py"]
|
||||
if IN_CI:
|
||||
data.append("--lint")
|
||||
session.run(*data)
|
||||
|
||||
|
||||
# Allow to run the noxfile with `python noxfile.py`, `pipx run noxfile.py`, or similar.
|
||||
# Requires nox >= 2025.02.09
|
||||
if __name__ == "__main__":
|
||||
nox.main()
|
Loading…
Add table
Add a link
Reference in a new issue