|
| 1 | +name: Check uudoc Documentation Generation |
| 2 | + |
| 3 | +on: |
| 4 | + pull_request: |
| 5 | + paths: |
| 6 | + - 'src/bin/uudoc.rs' |
| 7 | + - 'src/uu/*/locales/en-US.ftl' |
| 8 | + - 'Cargo.toml' |
| 9 | + - '.github/workflows/documentation.yml' |
| 10 | + push: |
| 11 | + branches: |
| 12 | + - main |
| 13 | + paths: |
| 14 | + - 'src/bin/uudoc.rs' |
| 15 | + - 'src/uu/*/locales/en-US.ftl' |
| 16 | + - 'Cargo.toml' |
| 17 | + |
| 18 | +jobs: |
| 19 | + check-doc: |
| 20 | + name: Verify uudoc generates correct documentation |
| 21 | + runs-on: ubuntu-latest |
| 22 | + |
| 23 | + steps: |
| 24 | + - name: Checkout repository |
| 25 | + uses: actions/checkout@v4 |
| 26 | + |
| 27 | + - name: Install/setup prerequisites |
| 28 | + shell: bash |
| 29 | + run: sudo apt-get -y update ; sudo apt-get -y install libselinux1-dev |
| 30 | + |
| 31 | + - name: Install Rust toolchain |
| 32 | + uses: dtolnay/rust-toolchain@stable |
| 33 | + |
| 34 | + - name: Download tldr |
| 35 | + run: curl https://tldr.sh/assets/tldr.zip -o docs/tldr.zip |
| 36 | + |
| 37 | + - name: Generate documentation |
| 38 | + run: cargo run --bin uudoc --all-features |
| 39 | + |
| 40 | + - name: Get current version from Cargo.toml |
| 41 | + id: version |
| 42 | + run: | |
| 43 | + VERSION=$(grep '^version' Cargo.toml | head -1 | sed 's/.*= "\(.*\)".*/\1/') |
| 44 | + echo "version=$VERSION" >> $GITHUB_OUTPUT |
| 45 | + echo "Detected version: $VERSION" |
| 46 | +
|
| 47 | + - name: Check for --repeated option in uniq.md |
| 48 | + run: | |
| 49 | + if [ ! -f "docs/src/utils/uniq.md" ]; then |
| 50 | + echo "docs/src/utils/uniq.md does not exist" |
| 51 | + exit 1 |
| 52 | + fi |
| 53 | +
|
| 54 | + if ! grep -q -- "--repeated" docs/src/utils/uniq.md; then |
| 55 | + echo "'--repeated' option not found in docs/src/utils/uniq.md" |
| 56 | + echo "Content of uniq.md:" |
| 57 | + head -50 docs/src/utils/uniq.md |
| 58 | + exit 1 |
| 59 | + fi |
| 60 | +
|
| 61 | + - name: Check for correct version in ls.md |
| 62 | + run: | |
| 63 | + VERSION="${{ steps.version.outputs.version }}" |
| 64 | +
|
| 65 | + if [ ! -f "docs/src/utils/ls.md" ]; then |
| 66 | + echo "docs/src/utils/ls.md does not exist" |
| 67 | + exit 1 |
| 68 | + fi |
| 69 | +
|
| 70 | + if ! grep -q "v(uutils coreutils) $VERSION" docs/src/utils/ls.md; then |
| 71 | + echo "Version '$VERSION' not found in docs/src/utils/ls.md" |
| 72 | + echo "Found version info:" |
| 73 | + grep "v(uutils coreutils)" docs/src/utils/ls.md || echo "No version info found" |
| 74 | + echo "Full version section:" |
| 75 | + grep -A2 -B2 "version" docs/src/utils/ls.md || echo "No version section found" |
| 76 | + exit 1 |
| 77 | + fi |
| 78 | +
|
| 79 | + - name: Verify usage information is present |
| 80 | + run: | |
| 81 | + if [ ! -f "docs/src/utils/cat.md" ]; then |
| 82 | + echo "docs/src/utils/cat.md does not exist" |
| 83 | + exit 1 |
| 84 | + fi |
| 85 | +
|
| 86 | + if ! grep -q "cat \[OPTION\].*\[FILE\]" docs/src/utils/cat.md; then |
| 87 | + echo "Usage information missing from cat.md" |
| 88 | + echo "Content around usage:" |
| 89 | + grep -A5 -B5 "cat" docs/src/utils/cat.md | head -20 |
| 90 | + exit 1 |
| 91 | + fi |
| 92 | +
|
| 93 | + - name: Verify help text is properly resolved |
| 94 | + run: | |
| 95 | + if [ ! -f "docs/src/utils/cat.md" ]; then |
| 96 | + echo "docs/src/utils/cat.md does not exist" |
| 97 | + exit 1 |
| 98 | + fi |
| 99 | +
|
| 100 | + if grep -q "cat-help-" docs/src/utils/cat.md; then |
| 101 | + echo "Found unresolved Fluent keys in cat.md - help text not properly translated" |
| 102 | + echo "Unresolved Fluent keys found:" |
| 103 | + grep "cat-help-" docs/src/utils/cat.md |
| 104 | + exit 1 |
| 105 | + fi |
| 106 | +
|
| 107 | + - name: Verify about text is present |
| 108 | + run: | |
| 109 | + if [ ! -f "docs/src/utils/cat.md" ]; then |
| 110 | + echo "docs/src/utils/cat.md does not exist" |
| 111 | + exit 1 |
| 112 | + fi |
| 113 | +
|
| 114 | + if ! grep -q "Concatenate FILE(s)" docs/src/utils/cat.md; then |
| 115 | + echo "About text missing from cat.md" |
| 116 | + echo "Content of cat.md:" |
| 117 | + head -30 docs/src/utils/cat.md |
| 118 | + exit 1 |
| 119 | + fi |
| 120 | +
|
| 121 | + - name: Verify tldr examples integration |
| 122 | + run: | |
| 123 | + if [ ! -f "docs/src/utils/cp.md" ]; then |
| 124 | + echo "docs/src/utils/cp.md does not exist" |
| 125 | + exit 1 |
| 126 | + fi |
| 127 | +
|
| 128 | + if ! grep -q "The examples are provided by" docs/src/utils/cp.md; then |
| 129 | + echo "tldr examples integration missing from cp.md" |
| 130 | + echo "Expected to find 'The examples are provided by' text" |
| 131 | + echo "Content of cp.md:" |
| 132 | + tail -20 docs/src/utils/cp.md |
| 133 | + exit 1 |
| 134 | + fi |
0 commit comments