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