Skip to content

Commit

Permalink
Cleanup workflows.
Browse files Browse the repository at this point in the history
  • Loading branch information
JonatanAntoni committed Aug 30, 2022
1 parent 4bd92d7 commit b367006
Show file tree
Hide file tree
Showing 11 changed files with 93 additions and 241 deletions.
32 changes: 21 additions & 11 deletions .github/workflows/eventlist.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand All @@ -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
Expand All @@ -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:
Expand All @@ -68,6 +81,7 @@ jobs:
if-no-files-found: error

lint:
if: github.event_name == 'pull_request'
name: Lint
timeout-minutes: 10
strategy:
Expand All @@ -92,6 +106,7 @@ jobs:
working-directory: ./tools/eventlist

format:
if: github.event_name != 'pull_request'
name: Format
strategy:
matrix:
Expand Down Expand Up @@ -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:
Expand Down Expand Up @@ -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:
Expand Down Expand Up @@ -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
Expand Down
36 changes: 28 additions & 8 deletions .github/workflows/build.yaml → .github/workflows/pack.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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
Expand Down Expand Up @@ -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
Expand All @@ -82,15 +102,15 @@ 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
retention-days: 1
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 }}
Expand All @@ -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
Expand All @@ -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
Expand All @@ -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}
Expand Down
47 changes: 38 additions & 9 deletions Doxygen/gen_doc.sh
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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

Expand All @@ -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
Expand Down
2 changes: 1 addition & 1 deletion Doxygen/src/main.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
2 changes: 1 addition & 1 deletion Doxygen/view.dxy.in
Original file line number Diff line number Diff line change
Expand Up @@ -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 \
Expand Down
Loading

0 comments on commit b367006

Please sign in to comment.