Skip to content

Commit

Permalink
Small maintenance script improuvements (#298)
Browse files Browse the repository at this point in the history
* Don' update cube version if tag was not retrieved
* Take repos url from family source file if specified
* Set WB0 serie
  • Loading branch information
xanthio authored Aug 14, 2024
1 parent 3700022 commit 36bab78
Show file tree
Hide file tree
Showing 2 changed files with 40 additions and 10 deletions.
48 changes: 38 additions & 10 deletions .github/workflows/maintenance.yml
Original file line number Diff line number Diff line change
Expand Up @@ -51,33 +51,61 @@ jobs:
- name: Print Job
run: echo "Updating ${{ matrix.family }} Family with latest ST tags"

- name: Prepare Env variables
id: prepare_env
run: |
family_src_file=${GITHUB_WORKSPACE}/$(grep -lr -E "stm32_util_create_family_targets\(\s?${{ matrix.family }}(\s\w+)?\)" cmake/stm32/)
family_l=$(echo "${{ matrix.family }}" | tr '[:upper:]' '[:lower:]')
cube=$(sed -nr "s/set\(CUBE_${{ matrix.family }}_URL\s+(.*)\)/\1/p" ${family_src_file})
if [[ -z ${cube} ]]; then
cube="STMicroelectronics/STM32Cube${{ matrix.family }}"
else
cube="$(echo ${cube} | sed -rn 's@((https?://)?github\.com/)?(.*)@\3@p'"
fi
cmsis=$(sed -nr "s/set\(CMSIS_${{ matrix.family }}_URL\s+(.*)\)/\1/p" ${family_src_file})
if [[ -z ${cmsis} ]]; then
cmsis="STMicroelectronics/cmsis_device_${family_l}"
else
cmsis="$(echo ${cmsis} | sed -rn 's@((https?://)?github\.com/)?(.*)@\3@p'"
fi
hal=$(sed -nr "s/set\(HAL_${{ matrix.family }}_URL\s+(.*)\)/\1/p" ${family_src_file})
if [[ -z ${hal} ]]; then
hal="STMicroelectronics/stm32${family_l}xx_hal_driver"
else
hal="$(echo ${hal} | sed -rn 's@((https?://)?github\.com/)?(.*)@\3@p'"
fi
{
echo "FAMILY_SRC_FILE=${family_src_file}"
echo "CUBE_REPO=${cube}"
echo "CMSIS_REPO=${cmsis}"
echo "HAL_REPO=${hal}"
} >> $GITHUB_OUTPUT
- name: Get Cube version
id: get-latest-cube
if: ${{ steps.prepare_env.outputs.CUBE_REPO }}
uses: './.github/actions/getLatestTag'
with:
repository: STMicroelectronics/STM32Cube${{ matrix.family }}
repository: ${{ steps.prepare_env.outputs.CUBE_REPO }}

- name: Get CMSIS version
id: get-latest-cmsis
if: ${{ steps.prepare_env.outputs.CMSIS_REPO }}
uses: './.github/actions/getLatestTag'
with:
repository: STMicroelectronics/cmsis_device_${{ matrix.family }}
repository: ${{ steps.prepare_env.outputs.CMSIS_REPO }}

- name: Get HAL version
id: get-latest-hal
if: ${{ steps.prepare_env.outputs.HAL_REPO }}
uses: './.github/actions/getLatestTag'
with:
repository: STMicroelectronics/stm32${{ matrix.family }}xx_hal_driver

- name: Prepare Env variables
id: find-family-src-file
run: |
family_src_file=${GITHUB_WORKSPACE}/$(grep -lr -E "stm32_util_create_family_targets\(\s?${{ matrix.family }}(\s\w+)?\)" cmake/stm32/)
echo "FAMILY_SRC_FILE=${family_src_file}" >> $GITHUB_OUTPUT
repository: ${{ steps.prepare_env.outputs.HAL_REPO }}

- name: Update Cube with latest version
if: ${{ steps.get-latest-cube.outputs.TAG }}
env:
FAMILY_SRC_FILE: ${{ steps.find-family-src-file.outputs.FAMILY_SRC_FILE }}
FAMILY_SRC_FILE: ${{ steps.prepare_env.outputs.FAMILY_SRC_FILE }}
run:
sed -ri 's@(set\(CUBE_${{ matrix.family }}_VERSION(\s+))(.*)(\))@\1${{ steps.get-latest-cube.outputs.TAG }}\4@g' ${FAMILY_SRC_FILE}

Expand Down
2 changes: 2 additions & 0 deletions cmake/stm32/wb0.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,8 @@ list(APPEND STM32_FETCH_FAMILIES WB0)

set(HAL_WB0_URL https://github.com/STMicroelectronics/stm32wb0x_hal_driver)

# SERIE SS2337

set(CUBE_WB0_VERSION v1.0.0)
set(CMSIS_WB0_VERSION v1.0.0)
set(HAL_WB0_VERSION v1.0.0)

0 comments on commit 36bab78

Please sign in to comment.