-
Notifications
You must be signed in to change notification settings - Fork 0
223 lines (146 loc) · 4.53 KB
/
reusable_mkdocs.yaml
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
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
---
name: 'Ansible Collection'
on:
workflow_call:
inputs:
ANSIBLE_LINTING_MUST_PASS:
default: true
required: false
description: Fail the linting action if the tests failed
type: boolean
jobs:
lint:
name: 'Lint'
env:
MDLINT_PATHS: '"docs/*.md docs/**/*.md docs/**/**/*.md docs/**/**/**/*.md docs/**/**/**/**/**/*.md #CHANGELOG.md !gitlab-ci !website-template"'
runs-on: ubuntu-latest
steps:
- name: Checkout Code - ${{ github.ref_name }}
uses: actions/checkout@v4
- name: Init Git Submodules
shell: bash
run: |
git submodule update --init;
git submodule foreach git submodule update --init;
ls -ls
- name: Install Dependencies
shell: bash
run: |
sudo apt update;
sudo apt install -y --no-install-recommends npm;
- name: Install Linter
shell: bash
run: |
npm install markdownlint-cli2 --global
npm install markdownlint-cli2-formatter-junit --global
- name: Create Artifact directory
shell: bash
run: |
mkdir -p artifacts
- name: Add linting rules
shell: bash
run: |
if [ ! -f ".markdownlint.json" ]; then
ls -la website-template;
cp "website-template/.markdownlint.json" ".markdownlint.json";
fi;
if [ ! -f ".markdownlint-cli2.jsonc" ]; then
ls -la gitlab-ci/lint
cp -f "gitlab-ci/lint/.markdownlint-cli2.jsonc" ".markdownlint-cli2.jsonc";
fi
ls -la;
- name: Lint
id: lint
shell: bash
run: |
markdownlint-cli2 $MDLINT_PATHS 1>&1 || EXITCODE=$?
if [ "${EXITCODE}" ]; then
echo "exit_code=${EXITCODE}" >> $GITHUB_OUTPUT
else
echo "exit_code=0" >> $GITHUB_OUTPUT
fi
echo "[Trace] GITHUB_OUTPUT[$(cat $GITHUB_OUTPUT)]";
ls -la;
mv -vf markdown.junit.xml "artifacts/markdown_lint.junit.xml"
- name: debug ls
if: ${{ success() || failure() }}
shell: bash
run: |
ls -la artifacts/;
- name: Check if Linting Error Occured
shell: bash
run: |
if [ ${{ steps.lint.outputs.exit_code }} -ge 3 ]; then
echo "[Error] ansible lint failed with ${{ steps.lint.outputs.exit_code }}";
exit ${{ steps.lint.outputs.exit_code }};
fi # don't fail the job?? 1=failed test, 2=failed command i.e. switch/flag
- name: Upload build Artifact
if: ${{ success() || failure() }}
uses: actions/upload-artifact@v4
with:
name: mkdocs-lint
path: artifacts/
- name: Should the Job be force failed?
shell: bash
run: |
if [ "0${{ inputs.ANSIBLE_LINTING_MUST_PASS }}" == "0true" ]; then
if [ ${{ steps.lint.outputs.exit_code }} -gt 0 ]; then
echo "[Trace] ANSIBLE_LINTING_MUST_PASS[${{ inputs.ANSIBLE_LINTING_MUST_PASS }}]";
echo "[Error] ansible lint failed with ${{ steps.lint.outputs.exit_code }}";
exit ${{ steps.lint.outputs.exit_code }};
fi
fi
lint-reports:
name: 'Linting Reports'
if: success() || failure()
needs:
- lint
runs-on: ubuntu-latest
steps:
- name: Markdown Lint Report
if: success() || failure()
uses: dorny/test-reporter@v1
with:
artifact: mkdocs-lint
name: Markdown Lint Report
path: 'markdown_lint.junit.xml'
reporter: java-junit
build:
name: Build
if: false
needs:
- lint
runs-on: ubuntu-latest
steps:
- name: Debug
shell: bash
run: |
echo "To be created";
publish:
name: Publish to Galaxy
if: false
needs:
- lint
- build
runs-on: ubuntu-latest
steps:
- name: to be created
shell: bash
run: |
echo "to be created";
release:
if: false
needs:
- publish
name: Mark Release Live
runs-on: ubuntu-latest
steps:
- name: to be created
shell: bash
run: |
echo "to be created";
# - name: Publish Release
# uses: grzegorzkrukowski/action-publish-github-release@v1
# with:
# tag_name: ${{ github.ref_name }}
# token: ${{ secrets.GITHUB_TOKEN }}