diff --git a/.github/workflows/eventlist.yml b/.github/workflows/eventlist.yml index 1daf35a..b673d4d 100644 --- a/.github/workflows/eventlist.yml +++ b/.github/workflows/eventlist.yml @@ -16,7 +16,9 @@ on: jobs: build: - if: ${{ github.event_name == 'pull_request' || (github.event_name == 'release') }} + if: | + github.event_name != 'release' || + startsWith(github.ref, 'refs/tags/tools/eventlist/') strategy: matrix: os: [ubuntu-20.04] @@ -32,6 +34,13 @@ jobs: with: go-version: ${{ matrix.go }} + - name: Initialize CodeQL + if: github.event_name != 'release' + uses: github/codeql-action/init@v2 + with: + languages: go + queries: security-and-quality + - name: Create build folder run: mkdir build working-directory: ./tools/eventlist @@ -43,6 +52,10 @@ jobs: GOOS=windows GOARCH=amd64 go build -o windows64/eventlist.exe ./.. working-directory: ./tools/eventlist/build + - name: Perform CodeQL Analysis + if: github.event_name != 'release' + uses: github/codeql-action/analyze@v2 + - name: Archive eventlist uses: actions/upload-artifact@v2 with: @@ -68,6 +81,7 @@ jobs: if-no-files-found: error lint: + if: github.event_name == 'pull_request' name: Lint timeout-minutes: 10 strategy: @@ -92,6 +106,7 @@ jobs: working-directory: ./tools/eventlist format: + if: github.event_name != 'pull_request' name: Format strategy: matrix: @@ -119,10 +134,8 @@ jobs: test: if: | - ${{ - github.event_name == 'pull_request' || - github.event_name == 'release' - }} + github.event_name != 'release' || + startsWith(github.ref, 'refs/tags/tools/eventlist/') needs: [ build ] strategy: matrix: @@ -191,11 +204,8 @@ jobs: coverage: if: | - ${{ - github.event_name == 'pull_request' || - github.event_name == 'push' || - github.event_name == 'release' - }} + github.event_name != 'release' || + startsWith(github.ref, 'refs/tags/tools/eventlist/') needs: [ build ] strategy: matrix: @@ -224,7 +234,7 @@ jobs: release: needs: [ build, test, coverage ] - if: github.event_name == 'release' + if: github.event_name == 'release' && startsWith(github.ref, 'refs/tags/tools/eventlist/') runs-on: ubuntu-latest steps: - name: Checkout devtools diff --git a/.github/workflows/build.yaml b/.github/workflows/pack.yaml similarity index 80% rename from .github/workflows/build.yaml rename to .github/workflows/pack.yaml index f9fc770..e2b144d 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/pack.yaml @@ -3,12 +3,32 @@ on: workflow_dispatch: push: branches: [ main ] + paths: + - '.github/workflows/pack.yml' + - '.github/doxygen.json' + - '.github/linkchecker.json' + - '.github/packchk.json' + - 'Documentation/**' + - 'Doxygen/**' + - 'EventRecorder/**' pull_request: branches: [ main ] + paths: + - '.github/workflows/pack.yml' + - '.github/doxygen.json' + - '.github/linkchecker.json' + - '.github/packchk.json' + - 'Documentation/**' + - 'Doxygen/**' + - 'EventRecorder/**' release: types: [published] + jobs: pack: + if: | + github.event_name != 'release' || + (github.event_name == 'release' && startsWith(github.ref, 'refs/tags/pack/')) name: Generate pack runs-on: ubuntu-20.04 steps: @@ -17,7 +37,7 @@ jobs: fetch-depth: 0 - name: Fetch tags - if: ${{ github.event_name == 'release' }} + if: github.event_name == 'release' run: | git fetch --tags --force @@ -58,7 +78,7 @@ jobs: working-directory: ./Documentation - name: Archive documentation - if: ${{ github.event_name == 'pull_request' }} + if: github.event_name == 'pull_request' uses: actions/upload-artifact@v2 with: name: documentation @@ -82,7 +102,7 @@ jobs: echo "::remove-matcher owner=packchk::" - name: Archive pack - if: ${{ github.event_name != 'release' }} + if: github.event_name != 'release' uses: actions/upload-artifact@v2 with: path: output/*.pack @@ -90,7 +110,7 @@ jobs: if-no-files-found: error - name: Attach pack to release assets - if: ${{ github.event_name == 'release' }} + if: github.event_name == 'release' uses: svenstaro/upload-release-action@v2 with: repo_token: ${{ secrets.GITHUB_TOKEN }} @@ -100,7 +120,7 @@ jobs: overwrite: true - name: Update release description - if: ${{ github.event_name == 'release' }} + if: github.event_name == 'release' run: | CURRENT="$(gh release view ${{ github.ref }} --json body -t "{{.body}}")" if [[ -z "$CURRENT" ]]; then @@ -109,12 +129,12 @@ jobs: fi - uses: actions/checkout@v2 - if: ${{ github.event_name == 'release' || github.event_name == 'push' || github.event_name == 'workflow_dispatch' }} + if: github.event_name == 'release' || 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' }} + if: github.event_name == 'push' || github.event_name == 'workflow_dispatch' run: | rm -rf main mkdir main @@ -129,7 +149,7 @@ jobs: git push - name: Publish documentation - if: ${{ github.event_name == 'release' }} + if: github.event_name == 'release' run: | RELEASE=$(echo $GITHUB_REF | sed 's/refs\/tags\///') rm -rf ${RELEASE} diff --git a/Doxygen/gen_doc.sh b/Doxygen/gen_doc.sh index 4cf8362..a4879a1 100755 --- a/Doxygen/gen_doc.sh +++ b/Doxygen/gen_doc.sh @@ -1,19 +1,19 @@ #!/bin/bash -# Version: 1.0 -# Date: 2022-01-12 -# This bash script generates IoT Socket documentation +# Version: 2.0 +# Date: 2022-08-30 +# This bash script generates CMSIS-View documentation # # Pre-requisites: # - bash shell (for Windows: install git for Windows) # - doxygen 1.9.2 - set -o pipefail +# Set version of gen pack library +REQUIRED_GEN_PACK_LIB="0.2.0" + DIRNAME=$(dirname $(readlink -f $0)) DOXYGEN=$(which doxygen 2>/dev/null) -DESCRIBE=$(readlink -f "${DIRNAME}/../Scripts/git_describe.sh") -CHANGELOG=$(readlink -f "${DIRNAME}/../Scripts/gen_changelog.sh") REQ_DXY_VERSION="1.9.2" if [[ ! -f "${DOXYGEN}" ]]; then @@ -29,8 +29,38 @@ else fi fi +############ DO NOT EDIT BELOW ########### + +function install_lib() { + local URL="https://github.com/Open-CMSIS-Pack/gen-pack/archive/refs/tags/v$1.tar.gz" + echo "Downloading gen_pack lib to '$2'" + mkdir -p "$2" + curl -L "${URL}" -s | tar -xzf - --strip-components 1 -C "$2" || exit 1 +} + +function load_lib() { + local GLOBAL_LIB="/usr/local/share/gen-pack/${REQUIRED_GEN_PACK_LIB}" + local USER_LIB="${HOME}/.local/share/gen-pack/${REQUIRED_GEN_PACK_LIB}" + if [[ ! -d "${GLOBAL_LIB}" && ! -d "${USER_LIB}" ]]; then + echo "Required gen-pack lib not found!" >&2 + install_lib "${REQUIRED_GEN_PACK_LIB}" "${USER_LIB}" + fi + + if [[ -d "${GLOBAL_LIB}" ]]; then + . "${GLOBAL_LIB}/gen-pack" + elif [[ -d "${USER_LIB}" ]]; then + . "${USER_LIB}/gen-pack" + else + echo "Required gen-pack lib is not installed!" >&2 + exit 1 + fi +} + +load_lib +find_git + if [ -z $VERSION ]; then - VERSION_FULL=$(/bin/bash ${DESCRIBE}) + VERSION_FULL=$(git_describe "pack/") VERSION=${VERSION_FULL%+*} fi @@ -40,8 +70,7 @@ echo "Generating documentation ..." sed -e "s/{projectNumber}/${VERSION}/" view.dxy.in > view.dxy -echo "\"${CHANGELOG}\" -f html > src/history.md" -"${CHANGELOG}" -f html > src/history.md +git_changelog -f html -p "pack/" > src/history.txt echo "\"${DOXYGEN}\" view.dxy" "${DOXYGEN}" view.dxy diff --git a/Doxygen/src/main.md b/Doxygen/src/main.md index df6afeb..9599d39 100644 --- a/Doxygen/src/main.md +++ b/Doxygen/src/main.md @@ -19,7 +19,7 @@ The debugger can load multiple *.SCVD files as typically each software component # Content {#content} This user's guide contains the following chapters: - - \subpage er_rev_history : lists CMSIS-View releases + - \subpage rev_hist : lists CMSIS-View releases - \subpage evr : explores the features and operation of the **Event Recorder** including configuration, technical data, and theory of operation. - \subpage ev_stat : describes how to use Event Statistics to create statistical data on code execution and power consumption. diff --git a/Doxygen/view.dxy.in b/Doxygen/view.dxy.in index a3b8826..e5627b8 100644 --- a/Doxygen/view.dxy.in +++ b/Doxygen/view.dxy.in @@ -887,7 +887,7 @@ WARN_LOGFILE = # Note: If this tag is empty the current directory is searched. INPUT = src/main.md \ - src/history.md \ + src/history.txt \ src/EventRecorder.md \ src/ev_stat.md \ src/cmp_viewer.md \ diff --git a/Scripts/gen_changelog.sh b/Scripts/gen_changelog.sh deleted file mode 100755 index f1eeb0a..0000000 --- a/Scripts/gen_changelog.sh +++ /dev/null @@ -1,167 +0,0 @@ -#!/bin/bash - -DIRNAME=$(dirname $(readlink -f $0)) -DESCRIBE=$(readlink -f "${DIRNAME}/git_describe.sh") - -function usage { - echo "$(basename $0) [-h|--help] [-f|--format ] [tag-prefix]" - echo "" - echo "Arguments:" - echo " -h|--help Print this usage message and exit." - echo " -f|--format Print changelog in given format." - echo " text Release notes in plain text." - echo " pdsc Release notes for PDSC" - echo " dxy Release notes for Doxygen" - echo " html Release notes for HTML" - echo " -p|--pre Include latest pre-release." - echo " tag-prefix Prefix to filter tags." - echo "" -} - -function print_text_head { - true -} - -function print_text { - if [ -z "$2" ]; then - echo "$1" - else - echo "$1 ($2)" - fi - - echo -e "$3" -} - -function print_text_tail { - true -} - -function print_pdsc_head { - echo "" -} - -function print_pdsc { - echo -n " " - echo -e "$3" | \ - sed "s/^/ /" | \ - sed "s/
//" | \ - sed "s/
    //" | \ - sed "s/<\/ul>//" | \ - sed "s/
  • /- /" | \ - sed "s/<\/li>//" | \ - sed "s/[ ]*$//" | \ - sed "/^$/d" - echo -e " " -} - -function print_pdsc_tail { - echo "" -} - -function print_dxy_head { - echo "\page er_rev_history Revision History" - echo "" - echo "Table below provides revision history for CMSIS-View software component." - echo "" - echo "Version | Description" - echo ":-----------|:------------------------------------------" -} - -function print_dxy { - printf "v%-10s | %s\n" "$1" "$3" -} - -function print_dxy_tail { - echo "" -} - -function print_html_head { - echo "\page er_rev_history Revision History" - echo "" - echo "Table below provides revision history for CMSIS-View software component." - echo "" - echo "" - echo "" - echo " " - echo " " - echo "" -} - -function print_html { - echo "" - echo " " - echo " " - echo "" -} - -function print_html_tail { - echo "
    VersionDescription
    v$1" - echo -e "$3" | sed "s/^/ /" - echo "
    " - echo "" -} - -POSITIONAL=() -FORMAT="text" -PRERELEASE=0 -while [[ $# -gt 0 ]] -do - key="$1" - - case $key in - '-h'|'--help') - usage - exit 1 - ;; - '-f'|'--format') - shift - FORMAT=$1 - shift - ;; - '-p'|'--pre') - PRERELEASE=1 - shift - ;; - *) # unknown option - POSITIONAL+=("$1") # save it in an array for later - shift # past argument - ;; - esac -done -set -- "${POSITIONAL[@]}" # restore positional parameters - -echo "Generating changelog ..." >&2 - -PREFIX="" -if [ -n "$1" ]; then - PREFIX=$1 -fi -TAGS=$(git for-each-ref --format "%(objecttype) %(refname)" --sort="-v:refname" "refs/tags/${PREFIX}*" 2>/dev/null | cut -d\ -f2) -LATEST=$(/bin/bash "${DESCRIBE}" "${PREFIX}") - -print_${FORMAT}_head - -if [[ $PRERELEASE != 0 ]] && ! git rev-list "${PREFIX}${LATEST}" 1>/dev/null 2>/dev/null; then - print_$FORMAT "${LATEST}" "" "Active development ..." -fi - -for TAG in $TAGS; do - TAG="${TAG#refs/tags/}" - DESC=$(git tag -l -n99 --format "%(contents)" ${TAG} 2>/dev/null) - DATE=$(git tag -l -n99 --format "%(taggerdate:short)" ${TAG} 2>/dev/null) - if [[ -z "$DATE" ]]; then - DATE=$(git tag -l -n99 --format "%(committerdate:short)" ${TAG} 2>/dev/null) - fi - print_$FORMAT "${TAG#${PREFIX}}" "${DATE}" "${DESC}" "${TAG}" -done - -print_${FORMAT}_tail - -exit 0 diff --git a/Scripts/git-configure.sh b/Scripts/git-configure.sh deleted file mode 100755 index da14d11..0000000 --- a/Scripts/git-configure.sh +++ /dev/null @@ -1,9 +0,0 @@ -#!/bin/bash - -DIRNAME=$(git rev-parse --show-toplevel) - -if ! git config --local -l | egrep -q include.path=../.gitconfig$; then - git config --local --add include.path ../.gitconfig - rm ${DIRNAME}/.git/index - git checkout HEAD -- ${DIRNAME} -fi diff --git a/Scripts/git-version.clean b/Scripts/git-version.clean deleted file mode 100644 index acedf90..0000000 --- a/Scripts/git-version.clean +++ /dev/null @@ -1,4 +0,0 @@ -#!/bin/bash - -sed -e "s/release version=\"[^\"]*\"/release version=\"0.0.0\"/" | \ - sed -e "s/Cversion=\"[^\"]*\"/Cversion=\"0.0.0\"/" diff --git a/Scripts/git-version.smudge b/Scripts/git-version.smudge deleted file mode 100644 index 44e2e55..0000000 --- a/Scripts/git-version.smudge +++ /dev/null @@ -1,8 +0,0 @@ -#!/bin/bash - -DIRNAME=$(dirname $(readlink -f $0)) -DESCRIBE=$(readlink -f ${DIRNAME}/git_describe.sh) -VERSION=$(${DESCRIBE} v) - -sed -e "s/release version=\"0.0.0\"/release version=\"${VERSION}\"/" | \ - sed -e "s/Cversion=\"0.0.0\"/Cversion=\"${VERSION}\"/" diff --git a/Scripts/git_describe.sh b/Scripts/git_describe.sh deleted file mode 100755 index 1cecb76..0000000 --- a/Scripts/git_describe.sh +++ /dev/null @@ -1,21 +0,0 @@ -#!/bin/bash - -PREFIX="$1" - -if git rev-parse --git-dir 2>&1 >/dev/null; then - gitversion=$(git describe --tags --long --match "${PREFIX}*" --abbrev=7 || echo "0.0.0-dirty-0-g$(git describe --tags --match "${PREFIX}*" --always --abbrev=7 2>/dev/null)") - patch=$(sed -r -e 's/[0-9]+\.[0-9]+\.([0-9]+).*/\1/' <<< ${gitversion#${PREFIX}}) - qualifier=$(sed -r -e 's/[0-9]+\.[0-9]+\.[0-9]+-[^0-9\-]+([0-9]*).*/\1/' <<< ${gitversion#${PREFIX}}) - let patch+=1 - let qualifier+=1 2>/dev/null - version=$(sed -r -e 's/-0-(g[0-9a-f]{7})//' <<< ${gitversion#${PREFIX}}) - version=$(sed -r -e "s/\.[0-9]+-([0-9]+)-(g[0-9a-f]{7})/.${patch}-dev\1+\2/" <<< ${version}) - version=$(sed -r -e "s/-([^0-9]+)[0-9]*-([0-9]+)-(g[0-9a-f]{7})/-\1${qualifier}-dev\2+\3/" <<< ${version}) - echo "Git version: '$version'" >&2 - echo $version -else - echo "No Git repository: '0.0.0-nogit'" >&2 - echo "0.0.0-nogit" -fi - -exit 0 diff --git a/gen_pack.sh b/gen_pack.sh index b9e912d..f438e20 100755 --- a/gen_pack.sh +++ b/gen_pack.sh @@ -9,9 +9,8 @@ set -o pipefail # Set version of gen pack library REQUIRED_GEN_PACK_LIB="0.2.0" - # Set default command line arguments -DEFAULT_ARGS=(-c "") +DEFAULT_ARGS=(-c "pack/") # Pack warehouse directory - destination PACK_OUTPUT=./output @@ -37,6 +36,9 @@ PACK_DELETE_FILES=" # Specify patches to be applied PACK_PATCH_FILES="" +# Specify addition argument to packchk +PACKCHK_ARGS=() + ############ DO NOT EDIT BELOW ########### function install_lib() {