Skip to content

Commit b940706

Browse files
committed
Adjust ci
1 parent de36bd3 commit b940706

File tree

8 files changed

+118
-26
lines changed

8 files changed

+118
-26
lines changed

.github/workflows/build.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
---
12
name: "Build"
23

34
on:
@@ -11,7 +12,7 @@ jobs:
1112
- name: "Set up Python"
1213
uses: "actions/setup-python@v5"
1314
with:
14-
python-version: "3.11"
15+
python-version: "3.12"
1516
- name: "Install python dependencies"
1617
run: |
1718
pip install build setuptools wheel
@@ -25,3 +26,4 @@ jobs:
2526
path: |
2627
dist/
2728
if-no-files-found: "error"
29+
...

.github/workflows/docs.yml

Lines changed: 89 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,107 @@
1+
---
12
name: "Docs Test"
23

34
on:
45
workflow_call:
56

7+
defaults:
8+
run:
9+
working-directory: "pulp-docs"
10+
611
jobs:
7-
run-test:
12+
build-docs:
813
runs-on: "ubuntu-latest"
914
steps:
1015
- uses: "actions/checkout@v4"
16+
with:
17+
path: "pulp-docs"
18+
fetch-depth: 0
19+
20+
- uses: "actions/checkout@v4"
21+
with:
22+
repository: "pulp/pulpcore"
23+
path: "pulpcore"
24+
25+
- uses: "actions/checkout@v4"
26+
with:
27+
repository: "pulp/pulp_ansible"
28+
path: "pulp_ansible"
29+
30+
- uses: "actions/checkout@v4"
31+
with:
32+
repository: "pulp/pulp_container"
33+
path: "pulp_container"
34+
35+
- uses: "actions/checkout@v4"
36+
with:
37+
repository: "pulp/pulp_deb"
38+
path: "pulp_deb"
39+
40+
- uses: "actions/checkout@v4"
41+
with:
42+
repository: "pulp/pulp_gem"
43+
path: "pulp_gem"
44+
45+
- uses: "actions/checkout@v4"
46+
with:
47+
repository: "pulp/pulp_maven"
48+
path: "pulp_maven"
49+
50+
- uses: "actions/checkout@v4"
51+
with:
52+
repository: "pulp/pulp_npm"
53+
path: "pulp_npm"
54+
55+
- uses: "actions/checkout@v4"
56+
with:
57+
repository: "pulp/pulp_ostree"
58+
path: "pulp_ostree"
59+
60+
- uses: "actions/checkout@v4"
61+
with:
62+
repository: "pulp/pulp_python"
63+
path: "pulp_python"
64+
65+
- uses: "actions/checkout@v4"
66+
with:
67+
repository: "pulp/pulp_rpm"
68+
path: "pulp_rpm"
69+
70+
- uses: "actions/checkout@v4"
71+
with:
72+
repository: "pulp/pulp-cli"
73+
path: "pulp-cli"
74+
75+
- uses: "actions/checkout@v4"
76+
with:
77+
repository: "pulp/pulp-ui"
78+
path: "pulp-ui"
79+
80+
- uses: "actions/checkout@v4"
81+
with:
82+
repository: "pulp/pulp-openapi-generator"
83+
path: "pulp-openapi-generator"
84+
85+
- uses: "actions/checkout@v4"
86+
with:
87+
repository: "pulp/pulp-oci-images"
88+
path: "pulp-oci-images"
89+
90+
- uses: "actions/checkout@v4"
91+
with:
92+
repository: "pulp/pulp-operator"
93+
path: "pulp-operator"
94+
1195
- name: "Set up Python"
1296
uses: "actions/setup-python@v5"
1397
with:
14-
python-version: "3.11"
98+
python-version: "3.12"
1599

16100
- name: "Install Test Dependencies"
17101
run: |
18102
pip install -r doc_requirements.txt
19103
20-
- name: Build docs
104+
- name: "Build docs"
21105
run: |
22-
make docs
106+
mkdocs build
107+
...

.github/workflows/pr.yml

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,16 +8,10 @@ concurrency:
88
cancel-in-progress: true
99

1010
jobs:
11-
build:
12-
uses: "./.github/workflows/build.yml"
13-
1411
docs:
15-
needs:
16-
- "build"
1712
uses: "./.github/workflows/docs.yml"
1813

1914
tests:
20-
needs: "build"
2115
uses: "./.github/workflows/tests.yml"
2216

2317
ready-to-ship:

.github/workflows/tests.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ jobs:
1111
- name: "Set up Python"
1212
uses: "actions/setup-python@v5"
1313
with:
14-
python-version: "3.11"
14+
python-version: "3.12"
1515

1616
- name: "Install Test Dependencies"
1717
run: |

.github/workflows/update-data.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ jobs:
1919
- name: "Set up Python"
2020
uses: "actions/setup-python@v5"
2121
with:
22-
python-version: "3.11"
22+
python-version: "3.12"
2323

2424
- name: "List requirements"
2525
run: |

mkdocs.yml

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -84,19 +84,14 @@ plugins:
8484
rest_api: "gem"
8585
- title: "Maven"
8686
path: "pulp_maven"
87-
git_url: "https://github.com/pulp/pulp_python"
87+
git_url: "https://github.com/pulp/pulp_maven"
8888
kind: "Content"
89-
rest_api: "python"
89+
rest_api: "maven"
9090
- title: "NPM"
9191
path: "pulp_npm"
9292
git_url: "https://github.com/pulp/pulp_npm"
9393
kind: "Content"
9494
rest_api: "npm"
95-
- title: "RPM"
96-
path: "pulp_rpm"
97-
git_url: "https://github.com/pulp/pulp_rpm"
98-
kind: "Content"
99-
rest_api: "rpm"
10095
- title: "OSTree"
10196
path: "pulp_ostree"
10297
git_url: "https://github.com/pulp/pulp_ostree"
@@ -107,6 +102,11 @@ plugins:
107102
git_url: "https://github.com/pulp/pulp_python"
108103
kind: "Content"
109104
rest_api: "python"
105+
- title: "RPM"
106+
path: "pulp_rpm"
107+
git_url: "https://github.com/pulp/pulp_rpm"
108+
kind: "Content"
109+
rest_api: "rpm"
110110

111111
#TODO Fix cli code paths for docstrings
112112
- title: "Pulp CLI"

pyproject.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ dependencies = [
1616
"mkdocs-literate-nav~=0.6.1",
1717
"httpx",
1818
"rich",
19+
"GitPython~=3.1.44",
1920
]
2021

2122
[project.scripts]

src/pulp_docs/plugin.py

Lines changed: 16 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
import yaml
66

77
import httpx
8-
from git import Repo
8+
from git import Repo, GitCommandError
99
from mkdocs.config import Config, config_options
1010
from mkdocs.config.defaults import MkDocsConfig
1111
from mkdocs.plugins import event_priority, get_plugin_logger, BasePlugin
@@ -252,7 +252,10 @@ def on_files(self, files: Files, /, *, config: MkDocsConfig) -> Files | None:
252252

253253
repository_dir = self.repositories_dir / repository.path
254254
git_repository_dir = self.repositories_dir / Path(repository.path).parts[0]
255-
git_branch = Repo(git_repository_dir).active_branch.name
255+
try:
256+
git_branch = Repo(git_repository_dir).active_branch.name
257+
except TypeError:
258+
git_branch = None
256259
repository_parent_dir = repository_dir.parent
257260
repository_docs_dir = repository_dir / "staging_docs"
258261
if repository_docs_dir.exists():
@@ -281,7 +284,7 @@ def on_files(self, files: Files, /, *, config: MkDocsConfig) -> Files | None:
281284
else:
282285
src_uri = abs_src_path.relative_to(repository_parent_dir)
283286
log.debug(f"Adding {abs_src_path} as {src_uri}.")
284-
if repository.git_url:
287+
if repository.git_url and git_branch:
285288
git_relpath = abs_src_path.relative_to(git_repository_dir)
286289
pulp_meta["edit_url"] = (
287290
f"{repository.git_url}/edit/{git_branch}/{git_relpath}"
@@ -314,9 +317,16 @@ def on_files(self, files: Files, /, *, config: MkDocsConfig) -> Files | None:
314317
)
315318
)
316319
repository_nav.add(src_uri)
317-
api_json = pulp_docs_git_repository.git.show(
318-
f"docs-data:data/openapi_json/{repository.rest_api}-api.json"
319-
)
320+
try:
321+
api_json = pulp_docs_git_repository.git.show(
322+
f"docs-data:data/openapi_json/{repository.rest_api}-api.json"
323+
)
324+
except GitCommandError:
325+
# Try again on the first remote.
326+
remote = pulp_docs_git_repository.remotes[0]
327+
api_json = pulp_docs_git_repository.git.show(
328+
f"{remote}/docs-data:data/openapi_json/{repository.rest_api}-api.json"
329+
)
320330
src_uri = (repository_dir / "api.json").relative_to(
321331
repository_parent_dir
322332
)

0 commit comments

Comments
 (0)