Skip to content

Commit ce2d461

Browse files
[CTOR-179] Include orthograph/syntax checks in CI for MC documentation (centreon#4788)
Co-authored-by: Sophie Depassio <[email protected]>
1 parent 40b0b49 commit ce2d461

3 files changed

Lines changed: 81 additions & 0 deletions

File tree

.github/scripts/pod_spell_check.t

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
use strict;
2+
use warnings;
3+
4+
use Test::More;
5+
use Test::Spelling;
6+
7+
if (!@ARGV) {
8+
die "Missing perl file to check.";
9+
}
10+
11+
my $stopword_filename='.github/scripts/stopwords.t';
12+
if(defined($ARGV[1])){
13+
$stopword_filename=$ARGV[1];
14+
}
15+
open(FILE, "<", $stopword_filename)
16+
or die "Could not open $stopword_filename";
17+
printf("stopword file use : ".$stopword_filename." \n");
18+
19+
add_stopwords(<FILE>);
20+
set_spell_cmd('hunspell -l');
21+
all_pod_files_spelling_ok($ARGV[0]);
22+
close(FILE);

.github/scripts/stopwords.t

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
--force-counters32
2+
OID
3+
oneaccess-sys-mib
4+
SNMP
5+
SSH

.github/workflows/spellchecker.yml

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
name: spell-checker
2+
3+
concurrency:
4+
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
5+
cancel-in-progress: true
6+
7+
on:
8+
workflow_dispatch:
9+
pull_request:
10+
paths:
11+
- '.github/workflows/spellchecker.yml'
12+
- 'src/**'
13+
- '.github/scripts/pod_spell_check.t'
14+
15+
jobs:
16+
pod-spell-check:
17+
if: ${{ !contains(github.event.pull_request.labels.*.name, 'do-not-spell-check') }}
18+
runs-on: ubuntu-22.04
19+
20+
steps:
21+
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
22+
23+
- uses: dorny/paths-filter@4512585405083f25c027a35db413c2b3b9006d50 # v2.11.1
24+
id: filter
25+
with:
26+
base: ${{ github.ref }}
27+
list-files: shell
28+
filters: |
29+
plugins:
30+
- added|modified: src/**
31+
32+
- name: Install CPAN Libraries
33+
uses: shogo82148/actions-setup-perl@ea0507898383e7dbce382138da0c21af1849eb9e # v1.27.0
34+
with:
35+
perl-version: '5.34'
36+
install-modules-with: cpm
37+
install-modules: Test::More Test::Spelling
38+
39+
- name: Install librairies
40+
continue-on-error: true
41+
run: |
42+
sudo apt-get update
43+
sudo apt-get install -y hunspell
44+
shell: bash
45+
46+
- name: Run spell check
47+
id: run_check
48+
run: |
49+
set +e
50+
for f in ${{ steps.filter.outputs.plugins_files }}; do
51+
echo "perl .github/scripts/pod_spell_check.t $f"
52+
output=$(perl .github/scripts/pod_spell_check.t $f)
53+
done
54+
shell: bash

0 commit comments

Comments
 (0)