From b210d8cfa7bc399f07978874c60bf2e25c06e705 Mon Sep 17 00:00:00 2001 From: pennam Date: Fri, 14 Nov 2025 09:05:15 +0100 Subject: [PATCH 1/9] ci: move variants variable into a dedicated folder --- edge.variables => extras/variables/edge.variables | 0 giga.variables => extras/variables/giga.variables | 0 nano.variables => extras/variables/nano.variables | 0 nicla.variables => extras/variables/nicla.variables | 0 opta.variables => extras/variables/opta.variables | 0 portenta.variables => extras/variables/portenta.variables | 0 rp2040.variables => extras/variables/rp2040.variables | 0 stella.variables => extras/variables/stella.variables | 0 8 files changed, 0 insertions(+), 0 deletions(-) rename edge.variables => extras/variables/edge.variables (100%) rename giga.variables => extras/variables/giga.variables (100%) rename nano.variables => extras/variables/nano.variables (100%) rename nicla.variables => extras/variables/nicla.variables (100%) rename opta.variables => extras/variables/opta.variables (100%) rename portenta.variables => extras/variables/portenta.variables (100%) rename rp2040.variables => extras/variables/rp2040.variables (100%) rename stella.variables => extras/variables/stella.variables (100%) diff --git a/edge.variables b/extras/variables/edge.variables similarity index 100% rename from edge.variables rename to extras/variables/edge.variables diff --git a/giga.variables b/extras/variables/giga.variables similarity index 100% rename from giga.variables rename to extras/variables/giga.variables diff --git a/nano.variables b/extras/variables/nano.variables similarity index 100% rename from nano.variables rename to extras/variables/nano.variables diff --git a/nicla.variables b/extras/variables/nicla.variables similarity index 100% rename from nicla.variables rename to extras/variables/nicla.variables diff --git a/opta.variables b/extras/variables/opta.variables similarity index 100% rename from opta.variables rename to extras/variables/opta.variables diff --git a/portenta.variables b/extras/variables/portenta.variables similarity index 100% rename from portenta.variables rename to extras/variables/portenta.variables diff --git a/rp2040.variables b/extras/variables/rp2040.variables similarity index 100% rename from rp2040.variables rename to extras/variables/rp2040.variables diff --git a/stella.variables b/extras/variables/stella.variables similarity index 100% rename from stella.variables rename to extras/variables/stella.variables From 839f7519cafa33ba0c3a035f9103b964265e839b Mon Sep 17 00:00:00 2001 From: pennam Date: Fri, 14 Nov 2025 09:06:12 +0100 Subject: [PATCH 2/9] ci: move json templates in a dedicated folder --- extras/{ => json}/mbed_edge-tag.template.json | 0 extras/{ => json}/mbed_giga-tag.template.json | 0 extras/{ => json}/mbed_nano-tag.template.json | 0 extras/{ => json}/mbed_nicla-tag.template.json | 0 extras/{ => json}/mbed_opta-tag.template.json | 0 extras/{ => json}/mbed_portenta-tag.template.json | 0 extras/{ => json}/mbed_rp2040-tag.template.json | 0 extras/{ => json}/mbed_stella-tag.template.json | 0 8 files changed, 0 insertions(+), 0 deletions(-) rename extras/{ => json}/mbed_edge-tag.template.json (100%) rename extras/{ => json}/mbed_giga-tag.template.json (100%) rename extras/{ => json}/mbed_nano-tag.template.json (100%) rename extras/{ => json}/mbed_nicla-tag.template.json (100%) rename extras/{ => json}/mbed_opta-tag.template.json (100%) rename extras/{ => json}/mbed_portenta-tag.template.json (100%) rename extras/{ => json}/mbed_rp2040-tag.template.json (100%) rename extras/{ => json}/mbed_stella-tag.template.json (100%) diff --git a/extras/mbed_edge-tag.template.json b/extras/json/mbed_edge-tag.template.json similarity index 100% rename from extras/mbed_edge-tag.template.json rename to extras/json/mbed_edge-tag.template.json diff --git a/extras/mbed_giga-tag.template.json b/extras/json/mbed_giga-tag.template.json similarity index 100% rename from extras/mbed_giga-tag.template.json rename to extras/json/mbed_giga-tag.template.json diff --git a/extras/mbed_nano-tag.template.json b/extras/json/mbed_nano-tag.template.json similarity index 100% rename from extras/mbed_nano-tag.template.json rename to extras/json/mbed_nano-tag.template.json diff --git a/extras/mbed_nicla-tag.template.json b/extras/json/mbed_nicla-tag.template.json similarity index 100% rename from extras/mbed_nicla-tag.template.json rename to extras/json/mbed_nicla-tag.template.json diff --git a/extras/mbed_opta-tag.template.json b/extras/json/mbed_opta-tag.template.json similarity index 100% rename from extras/mbed_opta-tag.template.json rename to extras/json/mbed_opta-tag.template.json diff --git a/extras/mbed_portenta-tag.template.json b/extras/json/mbed_portenta-tag.template.json similarity index 100% rename from extras/mbed_portenta-tag.template.json rename to extras/json/mbed_portenta-tag.template.json diff --git a/extras/mbed_rp2040-tag.template.json b/extras/json/mbed_rp2040-tag.template.json similarity index 100% rename from extras/mbed_rp2040-tag.template.json rename to extras/json/mbed_rp2040-tag.template.json diff --git a/extras/mbed_stella-tag.template.json b/extras/json/mbed_stella-tag.template.json similarity index 100% rename from extras/mbed_stella-tag.template.json rename to extras/json/mbed_stella-tag.template.json From c368498de5a7d482553d09c51589ad5abb4445d3 Mon Sep 17 00:00:00 2001 From: pennam Date: Fri, 14 Nov 2025 09:07:11 +0100 Subject: [PATCH 3/9] ci: move package scripts in extra folder --- package.sh => extras/package.sh | 0 package_full.sh => extras/package_full.sh | 0 2 files changed, 0 insertions(+), 0 deletions(-) rename package.sh => extras/package.sh (100%) rename package_full.sh => extras/package_full.sh (100%) diff --git a/package.sh b/extras/package.sh similarity index 100% rename from package.sh rename to extras/package.sh diff --git a/package_full.sh b/extras/package_full.sh similarity index 100% rename from package_full.sh rename to extras/package_full.sh From e374da28f251677776375aea5fc591418f58b9ce Mon Sep 17 00:00:00 2001 From: pennam Date: Fri, 14 Nov 2025 09:30:05 +0100 Subject: [PATCH 4/9] ci: adapt script to run from a different folder --- extras/package.sh | 2 +- extras/package_full.sh | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/extras/package.sh b/extras/package.sh index ded181efc..96406ea22 100755 --- a/extras/package.sh +++ b/extras/package.sh @@ -82,7 +82,7 @@ FLAVOUR_TAG=${FLAVOUR^^}_ FLAVOUR_NAME=${FLAVOUR,,} VERSION_NAME=${VERSION//./-} -cat ArduinoCore-mbed/extras/mbed_$FLAVOUR_NAME-tag.template.json | +cat ArduinoCore-mbed/extras/json/mbed_$FLAVOUR_NAME-tag.template.json | sed "s/%%VERSION%%/${VERSION}/" | sed "s/%%${FLAVOUR_TAG}FILENAME%%/${FILENAME}/" | sed "s/%%${FLAVOUR_TAG}CHECKSUM%%/${CHKSUM}/" | diff --git a/extras/package_full.sh b/extras/package_full.sh index ac971df4b..5735e5762 100755 --- a/extras/package_full.sh +++ b/extras/package_full.sh @@ -1,7 +1,7 @@ #Get version from git(hub) tag export VERSION="4.4.1" -FLAVOURS=`ls *.variables` +FLAVOURS=`find ./extras/variables/*.variables` for flavour in $FLAVOURS; do @@ -13,6 +13,6 @@ git clean -dxf # Clone ArduinoCore-api in parent folder and create symlinks git clone git@github.com:arduino/ArduinoCore-API.git ../api/ ln -s ../../../api/api cores/arduino/api -./package.sh $flavour +./extras/package.sh $flavour done From 392793140f58444074a30054ab549bd86726d768 Mon Sep 17 00:00:00 2001 From: pennam Date: Fri, 14 Nov 2025 10:26:45 +0100 Subject: [PATCH 5/9] ci: remove unused script --- extras/pack.release.bash | 56 ---------------------------------------- 1 file changed, 56 deletions(-) delete mode 100755 extras/pack.release.bash diff --git a/extras/pack.release.bash b/extras/pack.release.bash deleted file mode 100755 index 3321340bc..000000000 --- a/extras/pack.release.bash +++ /dev/null @@ -1,56 +0,0 @@ -#!/bin/bash -ex - -# pack.*.bash - Bash script to help packaging samd core releases. -# Copyright (c) 2015 Arduino LLC. All right reserved. -# -# This library is free software; you can redistribute it and/or -# modify it under the terms of the GNU Lesser General Public -# License as published by the Free Software Foundation; either -# version 2.1 of the License, or (at your option) any later version. -# -# This library is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -# Lesser General Public License for more details. -# -# You should have received a copy of the GNU Lesser General Public -# License along with this library; if not, write to the Free Software -# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - -# Version check removed because version string passed from jenkins was incorrect -VERSION_FROM_TAG=$1 -CORE_NAME=$2 -echo $VERSION_FROM_TAG -echo $CORE_NAME -VERSION=`grep version= platform.txt | sed 's/version=//g'` -echo $VERSION - -if [ $VERSION != $VERSION_FROM_TAG ]; then - exit 0 -fi - -PWD=`pwd` -FOLDERNAME=`basename $PWD` -THIS_SCRIPT_NAME=`basename $0` -FILENAME=core-$CORE_NAME-$VERSION.tar.bz2 -echo $FILENAME - -rm -f *.tar.bz2 -rm -f *.json - -cd .. -tar --exclude=extras/** --exclude=.git* --exclude=.idea -cjhf $FILENAME $FOLDERNAME -cd - - -mv ../$FILENAME . - -CHKSUM=`sha256sum $FILENAME | awk '{ print $1 }'` -SIZE=`wc -c $FILENAME | awk '{ print $1 }'` - -cat extras/package_index.json.NewTag.template | -# sed "s/%%BUILD_NUMBER%%/${BUILD_NUMBER}/" | -# sed "s/%%CURR_TIME%%/${CURR_TIME_SED}/" | -sed "s/%%VERSION%%/${VERSION}/" | -sed "s/%%FILENAME%%/${FILENAME}/" | -sed "s/%%CHECKSUM%%/${CHKSUM}/" | -sed "s/%%SIZE%%/${SIZE}/" > package_${CORE_NAME}_${VERSION}_index.json \ No newline at end of file From b9e0f367abec88ecf0ec598afcdd36490681176c Mon Sep 17 00:00:00 2001 From: pennam Date: Fri, 14 Nov 2025 11:17:58 +0100 Subject: [PATCH 6/9] ci: use https to access arduino core api repo --- extras/package_full.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/extras/package_full.sh b/extras/package_full.sh index 5735e5762..ed00ade26 100755 --- a/extras/package_full.sh +++ b/extras/package_full.sh @@ -11,7 +11,7 @@ git reset --hard git clean -dxf # Clone ArduinoCore-api in parent folder and create symlinks -git clone git@github.com:arduino/ArduinoCore-API.git ../api/ +git clone https://github.com/arduino/ArduinoCore-API.git ../api/ ln -s ../../../api/api cores/arduino/api ./extras/package.sh $flavour From 75bf6051d0df9d9eb751c55c5c33a9c42920867e Mon Sep 17 00:00:00 2001 From: pennam Date: Fri, 14 Nov 2025 12:53:16 +0100 Subject: [PATCH 7/9] ci: add requirements file --- extras/requirements.txt | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 extras/requirements.txt diff --git a/extras/requirements.txt b/extras/requirements.txt new file mode 100644 index 000000000..ba57f92e9 --- /dev/null +++ b/extras/requirements.txt @@ -0,0 +1,27 @@ +colorama==0.3.9 +urllib3[secure]>=1.26.5 +junit-xml==1.8 +PyYAML>=5.4 +jsonschema==2.6.0 +future>=0.18.0,<1.0 +six==1.12.0 +requests>=2.20,<3 +idna>=2,<2.8 +pyserial>=3,<=3.4 +jinja2>=2.11.3 +intelhex>=2.3.0,<3.0.0 +mbed-ls>=1.5.1,<2.0 +mbed-host-tests>=1.4.4,<2.0 +mbed-greentea>=0.2.24,<2.0 +beautifulsoup4>=4,<=4.6.3 +pyelftools>=0.27,<=0.28 +pycryptodome>=3.9.3,<4 +pyusb>=1.0.0,<2.0.0 +hidapi>=0.7.99,<0.8.0;platform_system!="Linux" +cmsis-pack-manager>=0.2.3,<0.3.0 +pywin32>=301;platform_system=='Windows' +wmi==1.4.9;platform_system=='Windows' +psutil==5.6.7 +cryptography>=3.2,<4 +Click>=7.0,<8 +cbor>=1.0.0 From ed8074186898d2ac4014730a2c5d66141e6f0c16 Mon Sep 17 00:00:00 2001 From: pennam Date: Fri, 21 Nov 2025 10:56:39 +0100 Subject: [PATCH 8/9] package: take version as argument --- extras/package_full.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/extras/package_full.sh b/extras/package_full.sh index ed00ade26..130059df7 100755 --- a/extras/package_full.sh +++ b/extras/package_full.sh @@ -1,5 +1,5 @@ #Get version from git(hub) tag -export VERSION="4.4.1" +export VERSION=$1 FLAVOURS=`find ./extras/variables/*.variables` From 97a11553a75ac8e627d2b9e0b3bf3b6fb42d8be4 Mon Sep 17 00:00:00 2001 From: pennam Date: Fri, 14 Nov 2025 11:22:24 +0100 Subject: [PATCH 9/9] ci: release workflow fix --- .github/workflows/release.yaml | 107 +++++++++------------------------ extras/package_full.sh | 2 +- 2 files changed, 28 insertions(+), 81 deletions(-) diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index d7e23178f..2a371a6a5 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -6,102 +6,49 @@ on: - "[0-9]+.[0-9]+.[0-9]+*" jobs: - core-pre-release-from-tag: + core-release-from-tag: runs-on: ubuntu-latest steps: - name: Checkout repository uses: actions/checkout@v2 - - name: Checkout ArduinoCore-API - uses: actions/checkout@v2 - with: - repository: arduino/ArduinoCore-API - path: extras/ArduinoCore-API - - - name: Check if API should be compiled in the core - id: checkapi + - name : Get the toolchain run: | - if [[ $(grep -r api platform.txt) ]]; then echo "::set-output name=IS_API::true"; fi + wget -O /opt/gcc-arm-none-eabi-9-2019-q4-major-x86_64-linux.tar.bz2 https://developer.arm.com/-/media/files/downloads/gnu-rm/9-2019q4/gcc-arm-none-eabi-9-2019-q4-major-x86_64-linux.tar.bz2 + tar -xjf /opt/gcc-arm-none-eabi-9-2019-q4-major-x86_64-linux.tar.bz2 -C /opt/ - - name: Checkout latest tag of ArduinoCore-API and add it to the core + - name: Setup build tools run: | - cd extras/ArduinoCore-API - git fetch --tags - git checkout $(git describe --tags $(git rev-list --tags --max-count=1)) - cd ../.. - mv "$GITHUB_WORKSPACE/extras/ArduinoCore-API/api" "$GITHUB_WORKSPACE/cores/arduino" - if: steps.checkapi.outputs.IS_API == 'true' - - - name: Remove ArduinoCore-API - run: rm -r "$GITHUB_WORKSPACE/extras/ArduinoCore-API" - - - name: Set env + sudo apt-get install -y python3 python3-pip git mercurial + mkdir /opt/mbed_env + python -m venv /opt/mbed_env/ + source /opt/mbed_env/bin/activate + python3 -m pip install -r extras/requirements.txt + python3 -m pip install mbed-cli setuptools + python3 -m pip install --upgrade six + mbed config -G GCC_ARM_PATH /opt/gcc-arm-none-eabi-9-2019-q4-major/bin/ + + - name: Set core version run: echo "TAG_VERSION=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV - name: Get repo name run: echo "REPOSITORY_NAME=$(echo ${{ github.repository }} | cut -d "/" -f2-)" >> $GITHUB_ENV - - name: Package the new core - run: | - extras/pack.release.bash $TAG_VERSION $REPOSITORY_NAME - cd extras - mkdir staging - echo $PWD - mv ../*.json staging/ - mv ../*.tar.bz2 staging/ - cd .. - - - name: Get architecture name + - name: Build the core run: | - echo "ARCHITECTURE=$(cat extras/package_index.json.NewTag.template | jq ".packages[0].platforms[0].architecture" | sed 's/\"//g')" >> $GITHUB_ENV + source /opt/mbed_env/bin/activate + export PATH=$PATH:/opt/gcc-arm-none-eabi-9-2019-q4-major/bin/ + extras/package_full.sh $TAG_VERSION - - name: Upload package_*_index.json and *.tar.bz2 file to Arduino downloads servers - env: - AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} - AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} - run: | - aws s3 sync extras/staging/ s3://${{ secrets.ARDUINO_DOWNLOADS_BUCKET }}/packages/staging/ --exclude "*" --include *.json - aws s3 sync extras/staging/ s3://${{ secrets.ARDUINO_DOWNLOADS_BUCKET }}/cores/staging/ --exclude "*" --include *.tar.bz2 - - - name: Checkout Basic examples - uses: actions/checkout@v2 + - name: Save core packages as artifact + uses: actions/upload-artifact@v4 with: - repository: arduino/arduino-examples - path: extras/arduino-examples + name: ArduinoCore-mbed-packages + path: /home/runner/work/ArduinoCore-mbed/*.tar.bz2 - - name: Install Arduino CLI - uses: arduino/setup-arduino-cli@v1.1.1 + - name: Save core json as artifact + uses: actions/upload-artifact@v4 with: - version: "0.14.0" - - - name: Download and verify new core - run: | - export PATH=$PATH:$PWD - arduino-cli version - cp extras/staging/package_${REPOSITORY_NAME}_${TAG_VERSION}_index.json . - export ARDUINO_DIRECTORIES_DATA=$PWD - export ARDUINO_BOARD_MANAGER_ADDITIONAL_URLS=file://$PWD/package_${REPOSITORY_NAME}_${TAG_VERSION}_index.json - arduino-cli config init - arduino-cli config dump -v - arduino-cli core update-index -v - arduino-cli core install arduino:${ARCHITECTURE}@${TAG_VERSION} - INDEX=0 - arduino-cli board listall --format=json > boardlist.json - N=$(jq '.boards | length' boardlist.json) - let N=N-1 - echo $N - for INDEX in $(seq 0 1 $N); do arduino-cli compile --fqbn $(cat boardlist.json | jq ".boards[$INDEX].FQBN" | sed 's/\"//g') $PWD/extras/arduino-examples/examples/01.Basics/Blink; done - - # See: https://github.com/rtCamp/action-slack-notify - - name: Slack notification of core pre-release - uses: rtCamp/action-slack-notify@v2.1.0 - env: - SLACK_CHANNEL: core_releases - SLACK_COLOR: good - SLACK_USERNAME: ArduinoBot - SLACK_ICON: https://github.com/arduino.png?size=48 - SLACK_TITLE: Arduino core pre-release - SLACK_MESSAGE: 'Version ${{ env.TAG_VERSION }} of core ${{ env.REPOSITORY_NAME }} is now available' - SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK }} - MSG_MINIMAL: true \ No newline at end of file + name: ArduinoCore-mbed-json + path: /home/runner/work/ArduinoCore-mbed/*.json diff --git a/extras/package_full.sh b/extras/package_full.sh index 130059df7..16c064ced 100755 --- a/extras/package_full.sh +++ b/extras/package_full.sh @@ -11,7 +11,7 @@ git reset --hard git clean -dxf # Clone ArduinoCore-api in parent folder and create symlinks -git clone https://github.com/arduino/ArduinoCore-API.git ../api/ +git clone --depth=1 https://github.com/arduino/ArduinoCore-API.git ../api/ ln -s ../../../api/api cores/arduino/api ./extras/package.sh $flavour