Skip to content

Commit

Permalink
Updated pack and doc build flows (#93)
Browse files Browse the repository at this point in the history
Pack generation is updated to gen-pack lib v0.9.1 and is aligned with
CMSIS 6.
Documentation is updated to Doxygen 1.9.6 and newer layout.
  • Loading branch information
vovamarch authored Jan 11, 2024
1 parent c9c8b3d commit e32a449
Show file tree
Hide file tree
Showing 51 changed files with 3,282 additions and 2,368 deletions.
8 changes: 8 additions & 0 deletions .github/dependabot.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
version: 2
updates:
- package-ecosystem: github-actions
directory: "/"
schedule:
interval: "weekly"
open-pull-requests-limit: 10
rebase-strategy: disabled
54 changes: 0 additions & 54 deletions .github/workflows/build.yaml

This file was deleted.

8 changes: 4 additions & 4 deletions .github/workflows/gh-pages.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,17 +30,17 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Setup Pages
uses: actions/configure-pages@v3
uses: actions/configure-pages@v4

- name: Upload artifact
uses: actions/upload-pages-artifact@v1
uses: actions/upload-pages-artifact@v3
with:
# Upload entire repository
path: '.'

- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v1
uses: actions/deploy-pages@v4
35 changes: 35 additions & 0 deletions .github/workflows/pack.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
name: Build documentation and pack
on:
workflow_dispatch:
pull_request:
push:
branches: [main]
release:
types: [published]

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
pack:
name: Generate pack
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Fetch tags
run: |
git fetch --tags --force
- uses: Open-CMSIS-Pack/gen-pack-action@main
with:
doxygen-version: 1.9.6
packchk-version: 1.4.1
gen-doc-script: ./Documentation/Doxygen/gen_doc.sh
doc-path: ./Documentation/html
gen-pack-script: ./gen_pack.sh --no-preprocess
gen-pack-output: ./output
gh-pages-branch: gh-pages
9 changes: 6 additions & 3 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,11 @@ Tests/UnitTest/PregeneratedData/*
Tests/UnitTest/Output/*
Tests/UnitTest/Unity/*
Documentation/html/*
DoxyGen/history.txt
DoxyGen/nn.dxy
Documentation/DoxyGen/src/history.txt
Documentation/DoxyGen/nn.dxy
build
output
__pycache__
__pycache__
*.bak
# Output of the linkchecker tool
linkchecker-out.csv
3 changes: 2 additions & 1 deletion ARM.CMSIS-NN.pdsc
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,9 @@
<name>CMSIS-NN</name>
<description>CMSIS NN software library of efficient neural network kernels</description>
<vendor>ARM</vendor>
<!-- <license>license.txt</license> -->
<license>LICENSE</license>
<url>https://www.keil.com/pack/</url>
<repository type="git">https:/github.com/arm-software/CMSIS-NN.git</repository>

<releases>
<release version="0.0.0">
Expand Down
120 changes: 120 additions & 0 deletions Documentation/Doxygen/gen_doc.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,120 @@
#!/usr/bin/env bash
#
# SPDX-FileCopyrightText: Copyright 2022-2024 Arm Limited and/or its affiliates <[email protected]>
#
# SPDX-License-Identifier: Apache-2.0
#
# Licensed under the Apache License, Version 2.0 (the License); you may
# not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an AS IS BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
# Version: 3.0
# Date: 2024-01-09
# This bash script generates CMSIS-NN Documentation:
#
# Pre-requisites:
# - bash shell (for Windows: install git for Windows)
# - doxygen 1.9.6
# - linkchecker (can be skipped with -s)

set -o pipefail

# Set version of gen pack library
# For available versions see https://github.com/Open-CMSIS-Pack/gen-pack/tags.
# Use the tag name without the prefix "v", e.g., 0.7.0
REQUIRED_GEN_PACK_LIB="0.9.1"

DIRNAME=$(dirname "$(readlink -f "$0")")
GENDIR=../html
REQ_DXY_VERSION="1.9.6"

RUN_LINKCHECKER=1

function usage() {
echo "Usage: $(basename "$0") [-h] [-s] [-c <comp>]"
echo " -h,--help Show usage"
echo " -s,--no-linkcheck Skip linkcheck"
echo " Can be given multiple times. Defaults to all components."
}

while [[ $# -gt 0 ]]; do
case $1 in
'-h'|'help')
usage
exit 1
;;
'-s'|'--no-linkcheck')
RUN_LINKCHECKER=0
;;
*)
echo "Invalid command line argument: $1" >&2
usage
exit 1
;;
esac
shift # past argument
done

############ DO NOT EDIT BELOW ###########

# Set GEN_PACK_LIB_PATH to use a specific gen-pack library root
# ... instead of bootstrap based on REQUIRED_GEN_PACK_LIB
if [[ -f "${GEN_PACK_LIB_PATH}/gen-pack" ]]; then
. "${GEN_PACK_LIB_PATH}/gen-pack"
else
. <(curl -sL "https://raw.githubusercontent.com/Open-CMSIS-Pack/gen-pack/main/bootstrap")
fi

find_git
find_doxygen "${REQ_DXY_VERSION}"
[[ ${RUN_LINKCHECKER} != 0 ]] && find_linkchecker

if [ -z "${VERSION_FULL}" ]; then
VERSION_FULL=$(git_describe "v")
fi

pushd "${DIRNAME}" > /dev/null || exit 1

echo "Generating documentation ..."

projectName=$(grep -E "PROJECT_NAME\s+=" nn.dxy.in | sed -r -e 's/[^"]*"([^"]+)".*/\1/')
projectNumberFull="${VERSION_FULL}"
projectNumber="${projectNumberFull%+*}"
datetime=$(date -u +'%a %b %e %Y %H:%M:%S')
year=$(date -u +'%Y')

sed -e "s/{projectNumber}/${projectNumber}/" nn.dxy.in \
| sed -e "s/{cmsisProjectNumber}/${cmsisProjectNumber}/" \
> nn.dxy

git_changelog -f html -p "v" > src/history.txt

echo_log "\"${UTILITY_DOXYGEN}\" nn.dxy"
"${UTILITY_DOXYGEN}" nn.dxy

mkdir -p "${DIRNAME}/${GENDIR}/search/"
cp -f "${DIRNAME}/style_template/search.css" "${DIRNAME}/${GENDIR}/search/"
cp -f "${DIRNAME}/style_template/navtree.js" "${DIRNAME}/${GENDIR}/"
cp -f "${DIRNAME}/style_template/resize.js" "${DIRNAME}/${GENDIR}/"

sed -e "s/{datetime}/${datetime}/" "${DIRNAME}/style_template/footer.js.in" \
| sed -e "s/{year}/${year}/" \
| sed -e "s/{projectName}/${projectName}/" \
| sed -e "s/{projectNumber}/${projectNumber}/" \
| sed -e "s/{projectNumberFull}/${projectNumberFull}/" \
> "${DIRNAME}/${GENDIR}/footer.js"

popd > /dev/null || exit 1

[[ ${RUN_LINKCHECKER} != 0 ]] && check_links "${DIRNAME}/../html/index.html" "${DIRNAME}"


exit 0
12 changes: 12 additions & 0 deletions Documentation/Doxygen/linkchecker.rc
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
[output]
ignoreerrors=
mag.svg
mag_sel.svg
mag_d.svg
mag_seld.svg
../tab_a.png
../tab_ad.png

[filtering]
ignorewarnings=
http-redirected
Loading

0 comments on commit e32a449

Please sign in to comment.