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

mdbook linkcheck #523

Merged
merged 2 commits into from
May 14, 2024
Merged

mdbook linkcheck #523

merged 2 commits into from
May 14, 2024

Conversation

jeckersb
Copy link
Contributor

  • ci/docs: Add mdbook-linkcheck
  • docs: fix mdbook-linkcheck errors/warnings

@github-actions github-actions bot added the documentation Improvements or additions to documentation label May 13, 2024
@jeckersb
Copy link
Contributor Author

It occurs to me immediately that the docs workflow only triggers on push currently, so this won't actually run until after merges. So will require a bit of tweaking still since we want this to catch link bugs during review.

@miabbott
Copy link
Contributor

miabbott commented May 13, 2024

@jeckersb I was tinkering on this as well...I think I have something nearly working here - miabbott@46d00fa

Feel free to borrow anything from that

@henrywang
Copy link
Contributor

Please ignore rhel 9.4 integration test failure. The new rhel9-rhel_bootc:rhel-9.4 image sets Compose ID to ''. So the /etc/yum.repo.d/rhel-9.repo can't be configured without Compose ID. I'll update the test in another PR later to fix this issue.

@jeckersb jeckersb force-pushed the mdbook-linkcheck branch 3 times, most recently from dfeb96b to 5de9bde Compare May 14, 2024 19:17
Fixes containers#521

Signed-off-by: John Eckersberg <jeckersb@redhat.com>
Signed-off-by: John Eckersberg <jeckersb@redhat.com>
@jeckersb
Copy link
Contributor Author

Alright I think this is doing the right thing and is ready for review now. I initially tried to make the mdbook setup bits into a reusable workflow, but that didn't quite work and I think what we would really want to share that code is a reusable action. But the github docs seem to imply that the action would need to live by itself in its own repository, which seems like more trouble than it's worth. So at least for now I've elected to go the copy/paste code duplication route.

@jeckersb jeckersb marked this pull request as ready for review May 14, 2024 19:38
Copy link
Collaborator

@cgwalters cgwalters left a comment

Choose a reason for hiding this comment

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

Nice, thanks!

@cgwalters cgwalters enabled auto-merge May 14, 2024 19:57
@miabbott
Copy link
Contributor

miabbott commented May 14, 2024

@jeckersb how about modifying docs.yml to run on PRs?

diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
index 1a04ff0..57968a8 100644
--- a/.github/workflows/ci.yml
+++ b/.github/workflows/ci.yml
@@ -144,7 +144,7 @@ jobs:
       - name: Integration tests
         run: |
           set -xeuo pipefail
-          image=quay.io/centos-bootc/centos-bootc-dev:stream9 
+          image=quay.io/centos-bootc/centos-bootc-dev:stream9
           echo 'ssh-ed25519 ABC0123 testcase@example.com' > test_authorized_keys
           sudo podman run --rm --privileged -v ./test_authorized_keys:/test_authorized_keys --env RUST_LOG=debug -v /:/target -v /var/lib/containers:/var/lib/containers -v ./usr/bin/bootc:/usr/bin/bootc --pid=host --security-opt label=disable \
             ${image} bootc install to-filesystem --acknowledge-destructive \
@@ -199,34 +199,3 @@ jobs:
           truncate -s 20G ${tmpdisk}
           sudo podman run --rm --privileged --env RUST_LOG=debug -v /dev:/dev -v /:/target -v /var/lib/containers:/var/lib/containers -v ./usr/bin/bootc:/usr/bin/bootc --pid=host --security-opt label=disable \
             -v ${tmpdisk}:/disk ${image} bootc install to-disk --via-loopback /disk
-  docs:
-    if: ${{ contains(github.event.pull_request.labels.*.name, 'documentation') }}
-    runs-on: ubuntu-latest
-    env:
-      MDBOOK_VERSION: 0.4.37
-    steps:
-      - uses: actions/checkout@v4
-      - name: Install mdBook
-        run: |
-          tag=$(curl 'https://api.github.com/repos/rust-lang/mdbook/releases/latest' | jq -r '.tag_name')
-          url="https://github.com/rust-lang/mdbook/releases/download/${tag}/mdbook-${tag}-x86_64-unknown-linux-gnu.tar.gz"
-          mkdir mdbook
-          curl -sSL $url | tar -xz --directory=./mdbook
-          echo `pwd`/mdbook >> $GITHUB_PATH
-      - name: Install mdbook-mermaid
-        run: |
-          tag=$(curl 'https://api.github.com/repos/badboy/mdbook-mermaid/releases/latest' | jq -r '.tag_name')
-          url="https://github.com/badboy/mdbook-mermaid/releases/download/${tag}/mdbook-mermaid-${tag}-x86_64-unknown-linux-gnu.tar.gz"
-          mkdir mdbook-mermaid
-          curl -sSL $url | tar -xz --directory=./mdbook-mermaid
-          echo `pwd`/mdbook-mermaid >> $GITHUB_PATH
-      - name: Install mdbook-linkcheck
-        run: |
-          tag=$(curl 'https://api.github.com/repos/Michael-F-Bryan/mdbook-linkcheck/releases/latest' | jq -r '.tag_name')
-          archive="mdbook-linkcheck.x86_64-unknown-linux-gnu.zip"
-          url="https://github.com/Michael-F-Bryan/mdbook-linkcheck/releases/download/${tag}/${archive}"
-          mkdir mdbook-linkcheck
-          curl -sSL -O $url && unzip ${archive} -d ./mdbook-linkcheck && chmod +x ./mdbook-linkcheck/mdbook-linkcheck
-          echo `pwd`/mdbook-linkcheck >> $GITHUB_PATH
-      - name: Build with mdBook
-        run: cd docs && mdbook-mermaid install && mdbook build
diff --git a/.github/workflows/docs.yml b/.github/workflows/docs.yml
index a7f210f..a0caa44 100644
--- a/.github/workflows/docs.yml
+++ b/.github/workflows/docs.yml
@@ -3,6 +3,8 @@ name: Deploy docs to pages
 on:
   push:
     branches: ["main"]
+  pull_request:
+      branches: [main]
   workflow_dispatch:
 
 permissions:
@@ -16,6 +18,7 @@ concurrency:
 
 jobs:
   build:
+    if: ${{ contains(github.event.pull_request.labels.*.name, 'documentation') }}
     runs-on: ubuntu-latest
     env:
       MDBOOK_VERSION: 0.4.37

Edit: needs another if statement to control when the deploy job would run, too

@cgwalters cgwalters merged commit 544ce42 into containers:main May 14, 2024
16 of 18 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants