Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add pack generation workflow #2

Merged
merged 2 commits into from
Aug 28, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 33 additions & 0 deletions .github/workflows/pack.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
name: Build 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
if: github.event_name == 'release'
run: |
git fetch --tags --force

- uses: Open-CMSIS-Pack/gen-pack-action@main
with:
doxygen-version: none
packchk-version: 1.4.1
gen-pack-script: ./gen_pack.sh --no-preprocess
gen-pack-output: ./output
130 changes: 130 additions & 0 deletions gen_pack.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,130 @@
#!/usr/bin/env bash
# Version: 3.1
# Date: 2024-04-17
# This bash script generates a CMSIS Software Pack:
#

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.11.1"

# Set default command line arguments
DEFAULT_ARGS=(-c "v")

# Pack warehouse directory - destination
# Default: ./output
#
# PACK_OUTPUT=./output

# Temporary pack build directory,
# Default: ./build
#
# PACK_BUILD=./build

# Specify directory names to be added to pack base directory
# An empty list defaults to all folders next to this script.
# Default: empty (all folders)
#
PACK_DIRS="
drivers
examples
licenses
sensors
shields
"

# Specify file names to be added to pack base directory
# Default: empty
#
PACK_BASE_FILES="
LICENSE
"

# Specify file names to be deleted from pack build directory
# Default: empty
#
# PACK_DELETE_FILES="
# <list files here>
# "

# Specify patches to be applied
# Default: empty
#
# PACK_PATCH_FILES="
# <list patches here>
# "

# Specify addition argument to packchk
# Default: empty
#
# PACKCHK_ARGS=()

# Specify additional dependencies for packchk
# Default: empty
#
PACKCHK_DEPS="
ARM.CMSIS.pdsc
"

# Optional: restrict fallback modes for changelog generation
# Default: full
# Values:
# - full Tag annotations, release descriptions, or commit messages (in order)
# - release Tag annotations, or release descriptions (in order)
# - tag Tag annotations only
#
PACK_CHANGELOG_MODE="tag"

# Specify file patterns to be excluded from the checksum file
# Default: <empty>
# Values:
# - empty All files packaged are included in the checksum file
# - glob pattern One glob pattern per line. Files matching a given pattern are excluded
# from the checksum file
# - "*" The * (match all pattern) can be used to skip checksum file creating completely.
#
# PACK_CHECKSUM_EXCLUDE="
# <list file patterns here>
# "

#
# custom pre-processing steps
#
# usage: preprocess <build>
# <build> The build folder
#
function preprocess() {
# add custom steps here to be executed
# before populating the pack build folder
return 0
}

#
# custom post-processing steps
#
# usage: postprocess <build>
# <build> The build folder
#
function postprocess() {
# add custom steps here to be executed
# after populating the pack build folder
# but before archiving the pack into output folder
return 0
}

############ 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

gen_pack "${DEFAULT_ARGS[@]}" "$@"

exit 0