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/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 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 diff --git a/package.sh b/extras/package.sh similarity index 96% rename from package.sh rename to extras/package.sh index ded181efc..96406ea22 100755 --- a/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/package_full.sh b/extras/package_full.sh similarity index 63% rename from package_full.sh rename to extras/package_full.sh index ac971df4b..16c064ced 100755 --- a/package_full.sh +++ b/extras/package_full.sh @@ -1,7 +1,7 @@ #Get version from git(hub) tag -export VERSION="4.4.1" +export VERSION=$1 -FLAVOURS=`ls *.variables` +FLAVOURS=`find ./extras/variables/*.variables` for flavour in $FLAVOURS; do @@ -11,8 +11,8 @@ 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 --depth=1 https://github.com/arduino/ArduinoCore-API.git ../api/ ln -s ../../../api/api cores/arduino/api -./package.sh $flavour +./extras/package.sh $flavour done 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 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