GitHub: Add LinkChecker for DoxyGen.
diff --git a/.github/linkchecker.json b/.github/linkchecker.json
new file mode 100644
index 0000000..52dee56
--- /dev/null
+++ b/.github/linkchecker.json
@@ -0,0 +1,16 @@
+{
+ "problemMatcher": [
+ {
+ "owner": "fileheader",
+ "severity": "error",
+ "pattern": [
+ {
+ "regexp": "^(.*):(\\d+);(.*);(.*)$",
+ "file": 1,
+ "line": 2,
+ "message": 4
+ }
+ ]
+ }
+ ]
+}
diff --git a/.github/workflows/codeql-analysis.yml b/.github/workflows/codeql-analysis.yml
index 63c9512..79370da 100644
--- a/.github/workflows/codeql-analysis.yml
+++ b/.github/workflows/codeql-analysis.yml
@@ -4,10 +4,19 @@
workflow_dispatch:
push:
branches: [ develop ]
+ paths:
+ - 'CMSIS/Core/**'
+ - 'CMSIS/Core_A/**'
+ - 'CMSIS/CoreValidation/**'
+ - 'Device/ARM/**'
pull_request:
- # The branches below must be a subset of the branches above
branches: [ develop ]
-
+ paths:
+ - '.github/workflows/codeql-analysis.yml'
+ - 'CMSIS/Core/**'
+ - 'CMSIS/Core_A/**'
+ - 'CMSIS/CoreValidation/**'
+ - 'Device/ARM/**'
jobs:
analyze:
name: Analyze
diff --git a/.github/workflows/gh-pages.yaml b/.github/workflows/gh-pages.yaml
index 4a6eda8..2fba93a 100644
--- a/.github/workflows/gh-pages.yaml
+++ b/.github/workflows/gh-pages.yaml
@@ -1,10 +1,17 @@
name: Publish Documentation
on:
workflow_dispatch:
- push:
- branches:
- - develop
+ pull_request:
+ branches: [ develop ]
paths:
+ - '.github/workflows/gh-pages.yaml'
+ - 'CMSIS/Utilities/check_links.sh'
+ - 'CMSIS/DoxyGen/**'
+ push:
+ branches: [ develop ]
+ paths:
+ - '.github/workflows/gh-pages.yaml'
+ - 'CMSIS/Utilities/check_links.sh'
- 'CMSIS/DoxyGen/**'
jobs:
docs:
@@ -21,16 +28,31 @@
run: |
sudo apt-get update
sudo apt-get install --no-install-recommends -y mscgen=0.20-12
+ - name: Install linkchecker
+ run: |
+ sudo pip install LinkChecker
- name: Generate doxygen
run: CMSIS/DoxyGen/gen_doc.sh
+ - name: Run linkchecker
+ run: |
+ echo "::add-matcher::.github/linkchecker.json"
+ CMSIS/Utilities/check_links.sh CMSIS/Documentation/index.html
+ - name: Upload documentation
+ if: ${{ github.event_name == 'pull_request' }}
+ uses: actions/upload-artifact@v2
+ with:
+ path: CMSIS/Documentation/**
- name: Archive documentation
+ if: ${{ github.event_name == 'push' || github.event_name == 'workflow_dispatch' }}
run: |
cd CMSIS/Documentation
tar -cvjf /tmp/doc.tbz2 .
- uses: actions/checkout@v2
+ if: ${{ github.event_name == 'push' || github.event_name == 'workflow_dispatch' }}
with:
ref: gh-pages
- name: Publish documentation
+ if: ${{ github.event_name == 'push' || github.event_name == 'workflow_dispatch' }}
run: |
rm -r develop
mkdir develop
diff --git a/CMSIS/Utilities/check_links.sh b/CMSIS/Utilities/check_links.sh
new file mode 100755
index 0000000..d918e45
--- /dev/null
+++ b/CMSIS/Utilities/check_links.sh
@@ -0,0 +1,25 @@
+#!/bin/bash
+
+linkchecker -F csv --check-extern $1
+
+OFS=$IFS
+IFS=$'\n'
+
+for line in $(grep -E '^[^#]' linkchecker-out.csv | tail -n +2); do
+ link=$(echo $line | cut -d';' -f 1)
+ file=$(echo $line | cut -d';' -f 2)
+ msg=$(echo $line | cut -d';' -f 4)
+ src=$(echo $file | sed -E 's/file:\/\/(.*)\/Documentation\/(\w+)\/.*/\1\/DoxyGen\/\2/')
+ if [ -d $src ]; then
+ origin=$(grep -Ern "href=['\"]${link}['\"]" $src/src/)
+ for o in $origin; do
+ ofile=$(echo $o | cut -d':' -f 1)
+ oline=$(echo $o | cut -d':' -f 2)
+ echo "${ofile}:${oline};${link};${msg}" >&2
+ done
+ fi
+done
+
+IFS=$OFS
+
+exit 0