mirror of
https://github.com/containers/bootc.git
synced 2026-02-05 15:45:53 +01:00
Move docs workflow into Justfile + container
This drains nontrivial logic out GHA and into something isolated via containers and driven via `Justfile` and easily replicable locally too. Signed-off-by: Colin Walters <walters@verbum.org>
This commit is contained in:
34
.github/workflows/ci.yml
vendored
34
.github/workflows/ci.yml
vendored
@@ -108,39 +108,15 @@ jobs:
|
|||||||
sudo find /ostree/repo/objects -name '*.file' -type f | while read f; do
|
sudo find /ostree/repo/objects -name '*.file' -type f | while read f; do
|
||||||
sudo fsverity measure $f >/dev/null
|
sudo fsverity measure $f >/dev/null
|
||||||
done
|
done
|
||||||
# Build documentation using mdBook (only for PRs with 'documentation' label)
|
# Test that we can build documentation
|
||||||
# TODO move into Justfile
|
|
||||||
docs:
|
docs:
|
||||||
if: ${{ contains(github.event.pull_request.labels.*.name, 'documentation') }}
|
|
||||||
runs-on: ubuntu-24.04
|
runs-on: ubuntu-24.04
|
||||||
env:
|
|
||||||
MDBOOK_VERSION: 0.4.37
|
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v4
|
||||||
- name: Install mdBook
|
- name: Bootc Ubuntu Setup
|
||||||
run: |
|
uses: ./.github/actions/bootc-ubuntu-setup
|
||||||
tag=$(curl 'https://api.github.com/repos/rust-lang/mdbook/releases/latest' | jq -r '.tag_name')
|
- name: Build mdbook
|
||||||
url="https://github.com/rust-lang/mdbook/releases/download/${tag}/mdbook-${tag}-x86_64-unknown-linux-gnu.tar.gz"
|
run: just build-mdbook
|
||||||
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
|
|
||||||
# Build containers and disk images for integration testing across OS matrix
|
# Build containers and disk images for integration testing across OS matrix
|
||||||
build-integration:
|
build-integration:
|
||||||
strategy:
|
strategy:
|
||||||
|
|||||||
43
.github/workflows/docs.yml
vendored
43
.github/workflows/docs.yml
vendored
@@ -14,53 +14,22 @@ concurrency:
|
|||||||
group: "pages"
|
group: "pages"
|
||||||
cancel-in-progress: false
|
cancel-in-progress: false
|
||||||
|
|
||||||
# To build the docs locally you can also do e.g.:
|
|
||||||
# cargo install mdbook-mermaid
|
|
||||||
# cd docs
|
|
||||||
# mdbook-mermaid install
|
|
||||||
# mdbook serve
|
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
build:
|
build:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-24.04
|
||||||
env:
|
|
||||||
MDBOOK_VERSION: 0.4.37
|
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v4
|
||||||
- name: Install mdBook
|
- name: Bootc Ubuntu Setup
|
||||||
run: |
|
uses: ./.github/actions/bootc-ubuntu-setup
|
||||||
tag=$(curl 'https://api.github.com/repos/rust-lang/mdbook/releases/latest' | jq -r '.tag_name')
|
- name: Build mdbook
|
||||||
url="https://github.com/rust-lang/mdbook/releases/download/${tag}/mdbook-${tag}-x86_64-unknown-linux-gnu.tar.gz"
|
run: mkdir target && just build-mdbook-to target/docs
|
||||||
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: Setup Pages
|
- name: Setup Pages
|
||||||
id: pages
|
id: pages
|
||||||
uses: actions/configure-pages@v5
|
uses: actions/configure-pages@v5
|
||||||
- name: Install mdbook_header_footer
|
|
||||||
run: |
|
|
||||||
cargo install mdbook_header_footer
|
|
||||||
- name: Build with mdBook
|
|
||||||
run: cd docs && mdbook-mermaid install && mdbook build
|
|
||||||
- name: Upload artifact
|
- name: Upload artifact
|
||||||
uses: actions/upload-pages-artifact@v3
|
uses: actions/upload-pages-artifact@v3
|
||||||
with:
|
with:
|
||||||
path: ./docs/book/html
|
path: ./target/docs
|
||||||
|
|
||||||
deploy:
|
deploy:
|
||||||
environment:
|
environment:
|
||||||
|
|||||||
18
Justfile
18
Justfile
@@ -65,6 +65,24 @@ test-container: build-units build-integration-test-image
|
|||||||
podman run --rm --read-only localhost/bootc-units /usr/bin/bootc-units
|
podman run --rm --read-only localhost/bootc-units /usr/bin/bootc-units
|
||||||
podman run --rm localhost/bootc-integration bootc-integration-tests container
|
podman run --rm localhost/bootc-integration bootc-integration-tests container
|
||||||
|
|
||||||
|
build-mdbook:
|
||||||
|
podman build -t localhost/bootc-mdbook -f docs/Dockerfile.mdbook .
|
||||||
|
|
||||||
|
# Generate the rendered HTML to the target DIR directory
|
||||||
|
build-mdbook-to DIR: build-mdbook
|
||||||
|
#!/bin/bash
|
||||||
|
set -xeuo pipefail
|
||||||
|
# Create a temporary container to extract the built docs
|
||||||
|
container_id=$(podman create localhost/bootc-mdbook)
|
||||||
|
podman cp ${container_id}:/src/docs/book {{DIR}}
|
||||||
|
podman rm -f ${container_id}
|
||||||
|
|
||||||
|
mdbook-serve: build-mdbook
|
||||||
|
#!/bin/bash
|
||||||
|
set -xeuo pipefail
|
||||||
|
podman run --init --replace -d --name bootc-mdbook --rm --publish 127.0.0.1::8000 localhost/bootc-mdbook
|
||||||
|
echo http://$(podman port bootc-mdbook 8000/tcp)
|
||||||
|
|
||||||
# Update all generated files (man pages and JSON schemas)
|
# Update all generated files (man pages and JSON schemas)
|
||||||
#
|
#
|
||||||
# This is the unified command that:
|
# This is the unified command that:
|
||||||
|
|||||||
33
docs/Dockerfile.mdbook
Normal file
33
docs/Dockerfile.mdbook
Normal file
@@ -0,0 +1,33 @@
|
|||||||
|
FROM registry.access.redhat.com/ubi10/ubi:latest
|
||||||
|
# An intermediate layer which caches the RPMS
|
||||||
|
RUN <<EORUN
|
||||||
|
set -xeuo pipefail
|
||||||
|
dnf -y install cargo rust jq unzip
|
||||||
|
dnf clean all
|
||||||
|
EORUN
|
||||||
|
# See main Dockerfile for rust caching
|
||||||
|
RUN --mount=type=cache,target=/src/target --mount=type=cache,target=/var/roothome <<EORUN
|
||||||
|
set -xeuo pipefail
|
||||||
|
|
||||||
|
# Bootstrap cargo-binstall
|
||||||
|
export PATH=$HOME/.cargo/bin:$PATH
|
||||||
|
curl -L --proto '=https' --tlsv1.2 -sSf https://raw.githubusercontent.com/cargo-bins/cargo-binstall/main/install-from-binstall-release.sh | bash
|
||||||
|
|
||||||
|
deps=(mdbook@0.4.52
|
||||||
|
mdbook-mermaid@0.16.0
|
||||||
|
mdbook-linkcheck@0.7.7
|
||||||
|
mdbook_header_footer@0.0.3)
|
||||||
|
cargo binstall --no-confirm ${deps[@]}
|
||||||
|
mv ~/.cargo/bin/* /usr/bin/
|
||||||
|
|
||||||
|
EORUN
|
||||||
|
# And now actually build the docs
|
||||||
|
WORKDIR /src
|
||||||
|
COPY . /src
|
||||||
|
RUN <<EORUN
|
||||||
|
set -xeuo pipefail
|
||||||
|
cd docs && mdbook build
|
||||||
|
EORUN
|
||||||
|
WORKDIR /src/docs
|
||||||
|
CMD ["mdbook", "serve", "-n", "0.0.0.0", "-p", "8000"]
|
||||||
|
EXPOSE 8000
|
||||||
@@ -16,6 +16,3 @@ footers = [
|
|||||||
|
|
||||||
[output.html]
|
[output.html]
|
||||||
additional-js = ["mermaid.min.js", "mermaid-init.js"]
|
additional-js = ["mermaid.min.js", "mermaid-init.js"]
|
||||||
|
|
||||||
[output.linkcheck]
|
|
||||||
optional = true
|
|
||||||
|
|||||||
Reference in New Issue
Block a user