-
Notifications
You must be signed in to change notification settings - Fork 12
Add reusable ci workflow #123
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
--- | ||
name: "Docs CI" | ||
|
||
on: | ||
workflow_call: | ||
inputs: | ||
pulpdocs_ref: | ||
description: "Git reference of this workflow file. Must match the one used for the workflow call" | ||
type: string | ||
required: true | ||
|
||
jobs: | ||
build: | ||
runs-on: "ubuntu-latest" | ||
steps: | ||
- name: "Checkout pulp-docs repository" | ||
uses: "actions/checkout@v4" | ||
with: | ||
repository: "pulp/pulp-docs" | ||
path: "pulp-docs" | ||
ref: "${{ inputs.pulpdocs_ref }}" | ||
fetch-depth: 0 | ||
|
||
- name: "Checkout component repository" | ||
if: "${{ github.event.repository.name != 'pulp-docs' }}" | ||
uses: "actions/checkout@v4" | ||
with: | ||
path: "${{ github.event.repository.name }}" | ||
|
||
- name: "Instructions to run locally" | ||
run: | | ||
cat <<EOL | ||
Ensure you have "pulp-docs" and "${{ github.event.repository.name }}" in your CWD with correct revisions: | ||
|
||
git -C pulp-docs checkout "${{ inputs.pulpdocs_ref }}" | ||
git -C ${{ github.event.repository.name }} checkout "${{ github.head_ref }}" | ||
|
||
Then run: | ||
|
||
cd pulp-docs | ||
pulp-docs fetch --dest /tmp/pulp-docs-tmp | ||
pulp-docs build --path pulp-docs@..:${{ github.event.repository.name }}@..:/tmp/pulp-docs-tmp | ||
EOL | ||
|
||
- uses: "actions/setup-python@v5" | ||
with: | ||
python-version: "3.12" | ||
|
||
- name: "Install pulp-docs" | ||
working-directory: "pulp-docs" | ||
run: | | ||
pip install --upgrade pip | ||
pip install -r doc_requirements.txt | ||
|
||
- name: "Build Docs" | ||
working-directory: "pulp-docs" | ||
env: | ||
DOCS_PATH: "pulp-docs@..:${{ github.event.repository.name }}@.." | ||
DOCS_TMPDIR: "/tmp/pulp-docs-tmp" | ||
run: | | ||
pulp-docs fetch --path-exclude "$DOCS_PATH" --dest "$DOCS_TMPDIR" | ||
pulp-docs build --path "$DOCS_PATH:$DOCS_TMPDIR" | ||
|
||
- name: "Sanity Check" | ||
working-directory: "pulp-docs" | ||
run: | | ||
echo "Checking that the namespace for the component under CI exists in the built docs." | ||
ls "site/${{ github.event.repository.name }}/docs" | ||
Comment on lines
+64
to
+68
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is this step really needed? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I wrote that because the test-CI with selinux succeded, but looking at the logs I realized it wasn't even picked. |
||
... |
This file was deleted.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
--- | ||
name: "Tests" | ||
|
||
on: | ||
|
@@ -20,3 +21,4 @@ jobs: | |
- name: "Run test suite" | ||
run: | | ||
pytest -sv | ||
... |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
--- | ||
name: "Update Data Branch" | ||
|
||
on: | ||
|
@@ -9,12 +10,12 @@ jobs: | |
update-data: | ||
runs-on: "ubuntu-latest" | ||
permissions: | ||
contents: write | ||
contents: "write" | ||
steps: | ||
- name: "Checkout docs-data branch" | ||
uses: "actions/checkout@v4" | ||
with: | ||
ref: docs-data | ||
ref: "docs-data" | ||
|
||
- name: "Set up Python" | ||
uses: "actions/setup-python@v5" | ||
|
@@ -40,3 +41,4 @@ jobs: | |
git config user.name github-actions | ||
git config user.email [email protected] | ||
./update-data.sh | ||
... |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -257,7 +257,7 @@ def rss_items() -> list: | |
return rss_feed["items"][:20] | ||
|
||
|
||
def load_components(find_path: list[str], config: MkDocsConfig, draft: bool): | ||
def load_components(find_path: list[str], config: PulpDocsPluginConfig, draft: bool): | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Time to start adding mypy? (Not this PR, it's also a different story.) There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yeah, will do a PR on static checking. |
||
loaded_components = [] | ||
for component_opt in config.components: | ||
component = Component.build(find_path, component_opt) | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If we used a different path here, we could treat pulp-docs in much the same way as any other repository out there.
This just makes me realize, a PR changing the docs in pulp-docs is substancially different from a PR that is changing the docs-building process.