-
Notifications
You must be signed in to change notification settings - Fork 341
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Huge refactoring to ease project maintenance
- Loading branch information
Showing
33 changed files
with
2,001 additions
and
1,467 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
name: MatrixCreator | ||
|
||
run-name: "Creates supported target matrix for other jobs" | ||
|
||
on: | ||
workflow_call: | ||
inputs: | ||
labelname: | ||
required: true | ||
type: string | ||
color: | ||
required: false | ||
default: "03234B" | ||
type: string | ||
|
||
jobs: | ||
CreateLabel: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout repo | ||
uses: actions/checkout@v4 | ||
|
||
- name: Print Job | ||
run: echo "Create ${{ inputs.labelname }} labels" | ||
|
||
- name: Create tag if doesn't exists | ||
env: | ||
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
run: | | ||
exists=$(gh label list --search ${{ inputs.labelname }} --json name --jq '.[0].name' | wc -l) | ||
if [ "x$exists" == "x0" ]; then | ||
gh label create ${{ inputs.labelname }} --color ${{ inputs.color }} | ||
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
name: MatrixCreator | ||
|
||
run-name: "Creates supported target matrix for other jobs" | ||
|
||
on: | ||
workflow_call: | ||
outputs: | ||
matrix: | ||
description: "Supported targets for job matrixing" | ||
value: ${{ jobs.CreateMatrix.outputs.matrix }} | ||
|
||
jobs: | ||
CreateMatrix: | ||
runs-on: ubuntu-latest | ||
outputs: | ||
matrix: ${{ steps.create-matrix.outputs.matrix }} | ||
steps: | ||
- name: Checkout repo | ||
id: checkout | ||
uses: actions/checkout@v4 | ||
|
||
- name: Create matrix | ||
id: create-matrix | ||
run: | | ||
files=$(find cmake/stm32/ -name '*.cmake' -exec sh -c "basename {} | cut -f1 -d '.' | tr a-z A-Z" \; | sort) | ||
deletes="COMMON DEVICES LINKER_LD" | ||
for del in $deletes; do | ||
files=(${files[@]/$del}) | ||
done | ||
echo "matrix={\"family\":$(jq --compact-output --null-input '$ARGS.positional' --args -- ${files[@]})}" >> $GITHUB_OUTPUT |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,103 @@ | ||
name: Dependency Check | ||
|
||
run-name: "Periodic check for dependency updates" | ||
|
||
on: | ||
schedule: | ||
- cron: '17 4 * * *' | ||
|
||
jobs: | ||
RetrieveTargetsMatrix: | ||
uses: ./.github/workflows/create-matrix.yml | ||
|
||
CheckForSTReposRelease: | ||
runs-on: ubuntu-latest | ||
needs: RetrieveTargetsMatrix | ||
strategy: | ||
matrix: ${{ fromJSON(needs.RetrieveTargetsMatrix.outputs.matrix) }} | ||
fail-fast: false | ||
env: | ||
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
steps: | ||
- name: Checkout repo | ||
uses: actions/checkout@v4 | ||
|
||
- name: Print Job | ||
run: echo "Updating ${{ matrix.family }} Family with latest ST tags" | ||
|
||
- name: Get Cube version | ||
id: get-latest-cube | ||
run: | | ||
http_code=$(curl --request GET \ | ||
--silent --write-out "%{http_code}" \ | ||
--url "https://api.github.com/repos/STMicroelectronics/STM32Cube${{matrix.family}}/tags" \ | ||
--header "Accept: application/vnd.github+json" \ | ||
--header "Authorization: Bearer $GH_TOKEN" \ | ||
-o body.json ); | ||
if [ "${http_code}" -ne "200" ]; then | ||
echo "Failed (${http_code}) to get https://api.github.com/repos/STMicroelectronics/STM32Cube${{matrix.family}}/tags"; | ||
exit 1; | ||
else | ||
latest_cube_version=$(jq '.[0].name' body.json | sed -rn 's@\"@@gp' ); | ||
echo "Latest Cube Version: ${latest_cube_version}"; | ||
fi | ||
echo "VERSION=${latest_cube_version}" >> $GITHUB_OUTPUT | ||
- name: Get CMSIS version | ||
id: get-latest-cmsis | ||
run: | | ||
FAMILY_L=$(echo "${{matrix.family}}" | tr '[:upper:]' '[:lower:]'); | ||
http_code=$(curl --request GET \ | ||
--silent --write-out "%{http_code}" \ | ||
--url "https://api.github.com/repos/STMicroelectronics/cmsis_device_${FAMILY_L}/tags" \ | ||
--header "Accept: application/vnd.github+json" \ | ||
--header "Authorization: Bearer $GH_TOKEN" \ | ||
-o body.json ); \ | ||
if [ "${http_code}" -ne "200" ]; then | ||
echo "Failed (${http_code}) to get https://api.github.com/repos/STMicroelectronics/cmsis_device_${FAMILY_L}/tags"; | ||
echo "Assume we can use the one from cube"; | ||
latest_cmsis_version="cube"; | ||
else | ||
latest_cmsis_version=$(jq '.[0].name' body.json | sed -rn 's@\"@@gp' ); | ||
fi | ||
echo "Latest CMSIS Version: ${latest_cmsis_version}"; | ||
echo "VERSION=${latest_cmsis_version}" >> $GITHUB_OUTPUT | ||
- name: Get HAL version | ||
id: get-latest-hal | ||
run: | | ||
FAMILY_L=$(echo "${{matrix.family}}" | tr '[:upper:]' '[:lower:]'); | ||
http_code=$(curl --request GET \ | ||
--silent --write-out "%{http_code}" \ | ||
--url "https://api.github.com/repos/STMicroelectronics/stm32${FAMILY_L}xx_hal_driver/tags" \ | ||
--header "Accept: application/vnd.github+json" \ | ||
--header "Authorization: Bearer $GH_TOKEN" \ | ||
-o body.json ); \ | ||
if [ "${http_code}" -ne "200" ]; then | ||
echo "Failed (${http_code}) to get https://api.github.com/repos/STMicroelectronics/stm32${FAMILY_L}xx_hal_driver/tags"; | ||
echo "Assume we can use the one from cube"; | ||
latest_hal_version="cube"; | ||
else | ||
latest_hal_version=$(jq '.[0].name' body.json | sed -rn 's@\"@@gp' ); | ||
fi | ||
echo "Latest HAL Version: ${latest_hal_version}"; | ||
echo "VERSION=${latest_hal_version}" >> $GITHUB_OUTPUT | ||
- name: Update family file with latest values | ||
run: | | ||
family_src_file=${GITHUB_WORKSPACE}/cmake/stm32/$(echo "${{ matrix.family }}" | tr '[:upper:]' '[:lower:]').cmake | ||
sed -ri 's@(set\(CUBE_${{ matrix.family }}_VERSION(\s+))(.*)(\))@\1${{ steps.get-latest-cube.outputs.VERSION }}\4@g' $family_src_file | ||
sed -ri 's@(set\(CMSIS_${{ matrix.family }}_VERSION(\s+))(.*)(\))@\1${{ steps.get-latest-cmsis.outputs.VERSION }}\4@g' $family_src_file | ||
sed -ri 's@(set\(HAL_${{ matrix.family }}_VERSION(\s+))(.*)(\))@\1${{ steps.get-latest-hal.outputs.VERSION }}\4@g' $family_src_file | ||
- name: Create Dependancy update Pull Request | ||
uses: peter-evans/create-pull-request@v6 | ||
with: | ||
add-paths: cmake/stm32/ | ||
commit-message: Update ${{ matrix.family }} dependencies | ||
branch: maintenance/${{ matrix.family }}-dependencies-update | ||
delete-branch: true | ||
title: Update ${{ matrix.family }} dependencies | ||
labels: dependency-update, ${{ matrix.family }} | ||
body: | | ||
Update ${{ matrix.family }} to use latest ST Repos |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
name: Manage Labels | ||
|
||
run-name: "Dynamically create new Labels" | ||
|
||
on: | ||
push | ||
|
||
jobs: | ||
CreateProjectManagementLabel: | ||
strategy: | ||
matrix: | ||
label: [ missing-devices, dependency-update ] | ||
fail-fast: false | ||
uses: ./.github/workflows/create-label.yml | ||
with: | ||
labelname: ${{ matrix.label }} | ||
|
||
RetrieveTargetsMatrix: | ||
uses: ./.github/workflows/create-matrix.yml | ||
|
||
CreateFamilyLabel: | ||
needs: RetrieveTargetsMatrix | ||
strategy: | ||
matrix: ${{ fromJSON(needs.RetrieveTargetsMatrix.outputs.matrix) }} | ||
fail-fast: false | ||
uses: ./.github/workflows/create-label.yml | ||
with: | ||
labelname: ${{ matrix.family }} | ||
color: "FFD200" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,85 @@ | ||
name: Missing device check | ||
|
||
run-name: "Periodic check for new devices" | ||
|
||
on: | ||
schedule: | ||
- cron: '17 4 * * *' | ||
|
||
jobs: | ||
RetrieveTargetsMatrix: | ||
uses: ./.github/workflows/create-matrix.yml | ||
|
||
CheckForMissingTargets: | ||
runs-on: ubuntu-latest | ||
needs: RetrieveTargetsMatrix | ||
strategy: | ||
matrix: ${{ fromJSON(needs.RetrieveTargetsMatrix.outputs.matrix) }} | ||
fail-fast: false | ||
steps: | ||
- name: Checkout repo | ||
uses: actions/checkout@v4 | ||
|
||
- name: Print Job | ||
run: echo "Looking for possible missing ${{ matrix.family }} devices" | ||
|
||
- name: Get Serie (Family) number from ST website | ||
id: get-ss-id | ||
run: | | ||
FAMILY_L=$(echo "${{ matrix.family }}" | tr '[:upper:]' '[:lower:]') | ||
URL=https://www.st.com/en/microcontrollers-microprocessors/stm32${FAMILY_L}-series.html | ||
serie=$(curl --request GET \ | ||
--silent --url ${URL} \ | ||
--header "User-Agent: Firefox/9000" \ | ||
| sed -rne "s@(.*)(data-associated-to=\")(SS[0-9]{4,})(\".*)@\3@p") | ||
[[ -z "${serie}" ]] && echo "Failed to find serie " && exit 0 | ||
echo "${{ matrix.family }} is ST ${serie} serie" | ||
echo "SERIE=$serie" >> $GITHUB_OUTPUT | ||
- name: Retrieve Serie (Family) JSON file | ||
id: get-json-file | ||
run: | | ||
URL=https://www.st.com/bin/st/selectors/cxst/en.cxst-ps-grid.html/${{ steps.get-ss-id.outputs.SERIE }}.json | ||
curl --request GET \ | ||
--silent --url ${URL} \ | ||
--header "User-Agent: Firefox/9000" >> data.json | ||
- name: Get missing components list | ||
id: get-missings | ||
run: | | ||
FAMILY_L=$(echo "${{ matrix.family }}" | tr '[:upper:]' '[:lower:]') | ||
family_src_file=${GITHUB_WORKSPACE}/cmake/stm32/${FAMILY_L}.cmake | ||
cat data.json | jq -r '.rows[].cells[0].value' | while read -r dev; do | ||
d=${dev#*STM32} | ||
if [ "0" -eq $(sed -rn "s@(\s+)(${d})@found@p" ${family_src_file} | wc -m) ]; then | ||
echo "${dev} is missing from ${family_src_file}" | ||
echo "- [ ] ${d}" >> missings | ||
else | ||
echo "${dev} found" | ||
fi | ||
done | ||
- name: Manage issues | ||
env: | ||
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
run: | | ||
LABELS="${{ matrix.family }},missing-devices" | ||
existing=$(gh issue list \ | ||
--label "${LABELS}" \ | ||
--state open \ | ||
--json number \ | ||
--jq '.[0].number') | ||
if [ ! -f missings ] && [ ! -z ${existing} ]; then | ||
echo "Closing existing issue ${existing}" | ||
gh issue close "${existing}" \ | ||
--comment "${{ matrix.family }} has all its devices supported now" | ||
fi | ||
if [ -f missings ] && [ -z ${existing} ]; then | ||
echo "Creating issue to report missing devices" | ||
BODY="Not supported yet devices list:" | ||
BODY="${BODY}"$'\n'"$(cat missings)" | ||
gh issue create \ | ||
--title "${{ matrix.family }} has devices not supported" \ | ||
--label "${LABELS}" \ | ||
--body "$BODY" | ||
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.