Skip to content

Commit

Permalink
Created new installation script install_arduino_cores.bat/.sh for ins…
Browse files Browse the repository at this point in the history
…talling esp8266 and esp32 support.
  • Loading branch information
end2endzone committed Aug 3, 2024
1 parent c1968f8 commit 1ef6ac2
Show file tree
Hide file tree
Showing 12 changed files with 153 additions and 62 deletions.
5 changes: 5 additions & 0 deletions .github/workflows/build_linux.yml
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,11 @@ jobs:
working-directory: ${{env.GITHUB_WORKSPACE}}
shell: bash
run: ./ci/github/install_arduinocli.sh

- name: Install Arduino cores
working-directory: ${{env.GITHUB_WORKSPACE}}
shell: bash
run: ./ci/github/install_arduino_cores.sh

- name: Install Arduino library dependnecies
working-directory: ${{env.GITHUB_WORKSPACE}}
Expand Down
5 changes: 5 additions & 0 deletions .github/workflows/build_windows.yml
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,11 @@ jobs:
working-directory: ${{env.GITHUB_WORKSPACE}}
shell: cmd
run: call ci\github\install_arduinocli.bat

- name: Install Arduino cores
working-directory: ${{env.GITHUB_WORKSPACE}}
shell: cmd
run: call ci\github\install_arduino_cores.bat

- name: Install Arduino library dependnecies
working-directory: ${{env.GITHUB_WORKSPACE}}
Expand Down
1 change: 1 addition & 0 deletions appveyor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ clone_folder: c:\projects\AnyRtttl
install:
- cmd: call %APPVEYOR_BUILD_FOLDER%\ci\appveyor\install_yamlpath.bat
- cmd: call %APPVEYOR_BUILD_FOLDER%\ci\appveyor\install_arduinocli.bat
- cmd: call %APPVEYOR_BUILD_FOLDER%\ci\appveyor\install_arduino_cores.bat
- cmd: call %APPVEYOR_BUILD_FOLDER%\ci\appveyor\arduino_install_libraries.bat
- cmd: call %APPVEYOR_BUILD_FOLDER%\ci\appveyor\install_this.bat
- cmd: call %APPVEYOR_BUILD_FOLDER%\ci\appveyor\install_googletest.bat
Expand Down
11 changes: 11 additions & 0 deletions ci/appveyor/install_arduino_cores.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
@echo off

:: Validate appveyor's environment
if "%APPVEYOR_BUILD_FOLDER%"=="" (
echo Please define 'APPVEYOR_BUILD_FOLDER' environment variable.
exit /B 1
)

:: Call matching script for windows
call "%APPVEYOR_BUILD_FOLDER%\ci\windows\%~n0.bat"
if %errorlevel% neq 0 exit /b %errorlevel%
15 changes: 15 additions & 0 deletions ci/github/install_arduino_cores.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
@echo off

:: Validate GitHub CI's environment
if "%GITHUB_WORKSPACE%"=="" (
echo Please define 'GITHUB_WORKSPACE' environment variable.
exit /B 1
)

:: Call matching script for windows
call "%GITHUB_WORKSPACE%\ci\windows\%~n0.bat"
if %errorlevel% neq 0 exit /b %errorlevel%

:: Remember installation directory
echo Remember ARDUINO_CLI_INSTALL_DIR as %ARDUINO_CLI_INSTALL_DIR% in %GITHUB_ENV%
echo ARDUINO_CLI_INSTALL_DIR=%ARDUINO_CLI_INSTALL_DIR%>> %GITHUB_ENV%
17 changes: 17 additions & 0 deletions ci/github/install_arduino_cores.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# Any commands which fail will cause the shell script to exit immediately
set -e

# Validate GitHub CI environment
if [ "$GITHUB_WORKSPACE" = "" ]; then
echo "Please define 'GITHUB_WORKSPACE' environment variable.";
exit 1;
fi

# Call matching script for linux
# and execute the script under the current shell instead of loading another one
this_filename=`basename "$0"`
. $GITHUB_WORKSPACE/ci/linux/$this_filename

# Remember installation directory
echo Remember ARDUINO_CLI_INSTALL_DIR as $ARDUINO_CLI_INSTALL_DIR in $GITHUB_ENV
echo ARDUINO_CLI_INSTALL_DIR=$ARDUINO_CLI_INSTALL_DIR>> $GITHUB_ENV
3 changes: 3 additions & 0 deletions ci/linux/arduinocli-core-esp8266.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
board_manager:
additional_urls:
- http://arduino.esp8266.com/stable/package_esp8266com_index.json
41 changes: 41 additions & 0 deletions ci/linux/install_arduino_cores.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
# Any commands which fail will cause the shell script to exit immediately
set -e

# Set arduino-cli config file path
export ARDUINO_CONFIG_PATH="/home/$USER/.arduino15/arduino-cli.yaml"
echo ARDUINO_CONFIG_PATH set to '$ARDUINO_CONFIG_PATH'
cat "$ARDUINO_CONFIG_PATH"
echo.
echo.

echo Adding arduinocli-core-esp8266.yaml to arduino-cli config...
yaml-merge arduinocli-core-esp8266.yaml '$ARDUINO_CONFIG_PATH' --overwrite='$ARDUINO_CONFIG_PATH'
cat "$ARDUINO_CONFIG_PATH"
echo
echo

echo Adding arduinocli-core-esp32.yaml to arduino-cli config...
yaml-merge arduinocli-core-esp32.yaml '$ARDUINO_CONFIG_PATH' --overwrite='$ARDUINO_CONFIG_PATH'
cat "$ARDUINO_CONFIG_PATH"
echo
echo

echo Installing "arduino:avr" core...
arduino-cli core install "arduino:avr"
echo
echo

echo Installing "esp8266:esp8266" core...
arduino-cli core install "esp8266:esp8266"
echo
echo

echo Installing "esp32:esp32" core...
arduino-cli core install "esp32:esp32"
echo
echo

echo Listing all installed cores...
arduino-cli core list
echo
echo
26 changes: 0 additions & 26 deletions ci/linux/install_arduinocli.sh
Original file line number Diff line number Diff line change
Expand Up @@ -36,29 +36,3 @@ echo Initialize configuration file...
arduino-cli config init --overwrite
echo
echo

echo Installing "arduino:avr" core...
arduino-cli core install "arduino:avr"
echo
echo

echo Installing "esp8266:esp8266" core...
arduino-cli core install "esp8266:esp8266"
echo
echo

echo Merging arduino-cli configuration file with temp-esp32.yaml...
yaml-merge temp-esp32.yaml '/home/$USER/.arduino15/arduino-cli.yaml' --overwrite='/home/$USER/.arduino15/arduino-cli.yaml'
cat '/home/$USER/.arduino15/arduino-cli.yaml'
echo
echo

echo Installing "esp32:esp32" core...
arduino-cli core install "esp32:esp32"
echo
echo

echo Listing all installed cores...
arduino-cli core list
echo
echo
3 changes: 3 additions & 0 deletions ci/windows/arduinocli-core-esp8266.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
board_manager:
additional_urls:
- http://arduino.esp8266.com/stable/package_esp8266com_index.json
52 changes: 52 additions & 0 deletions ci/windows/install_arduino_cores.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
@echo off
cd /d %~dp0

:: Set arduino-cli config file path
set ARDUINO_CONFIG_PATH=C:\Users\%USERNAME%\AppData\Local\Arduino15\arduino-cli.yaml
echo ARDUINO_CONFIG_PATH set to '%ARDUINO_CONFIG_PATH%'
type "%ARDUINO_CONFIG_PATH%"
echo.
echo.

echo Adding arduinocli-core-esp8266.yaml to arduino-cli config...
yaml-merge arduinocli-core-esp8266.yaml "%ARDUINO_CONFIG_PATH%" --overwrite="%ARDUINO_CONFIG_PATH%"
if %errorlevel% neq 0 exit /b %errorlevel%
type "%ARDUINO_CONFIG_PATH%"
echo.
echo.

echo Adding arduinocli-core-esp32.yaml to arduino-cli config...
yaml-merge arduinocli-core-esp32.yaml "%ARDUINO_CONFIG_PATH%" --overwrite="%ARDUINO_CONFIG_PATH%"
if %errorlevel% neq 0 exit /b %errorlevel%
type "%ARDUINO_CONFIG_PATH%"
echo.
echo.

echo Installing arduino:avr core...
REM Use `--skip-post-install` on AppVeyor to skip UAC prompt which is blocking the build.
arduino-cli core install arduino:avr --skip-post-install
if %errorlevel% neq 0 exit /b %errorlevel%
echo.
echo.

echo Installing esp8266:esp8266 core...
arduino-cli core install esp8266:esp8266
if %errorlevel% neq 0 exit /b %errorlevel%
echo.
echo.

echo Installing esp32:esp32 core...
arduino-cli core update-index
if %errorlevel% neq 0 exit /b %errorlevel%
arduino-cli board listall
if %errorlevel% neq 0 exit /b %errorlevel%
arduino-cli core install esp32:esp32
if %errorlevel% neq 0 exit /b %errorlevel%
echo.
echo.

echo Listing all installed cores...
arduino-cli core list
if %errorlevel% neq 0 exit /b %errorlevel%
echo.
echo.
36 changes: 0 additions & 36 deletions ci/windows/install_arduinocli.bat
Original file line number Diff line number Diff line change
Expand Up @@ -34,39 +34,3 @@ arduino-cli config init --overwrite
if %errorlevel% neq 0 exit /b %errorlevel%
echo.
echo.

echo Installing arduino:avr core...
REM Use `--skip-post-install` on AppVeyor to skip UAC prompt which is blocking the build.
arduino-cli core install arduino:avr --skip-post-install
if %errorlevel% neq 0 exit /b %errorlevel%
echo.
echo.

echo Installing esp8266:esp8266 core...
arduino-cli core install esp8266:esp8266
if %errorlevel% neq 0 exit /b %errorlevel%
echo.
echo.

echo Merging arduino-cli configuration file with temp-esp32.yaml...
yaml-merge temp-esp32.yaml "C:\Users\%USERNAME%\AppData\Local\Arduino15\arduino-cli.yaml" --overwrite="C:\Users\%USERNAME%\AppData\Local\Arduino15\arduino-cli.yaml"
if %errorlevel% neq 0 exit /b %errorlevel%
type "C:\Users\%USERNAME%\AppData\Local\Arduino15\arduino-cli.yaml"
echo.
echo.

echo Installing esp32:esp32 core...
arduino-cli core update-index
if %errorlevel% neq 0 exit /b %errorlevel%
arduino-cli board listall
if %errorlevel% neq 0 exit /b %errorlevel%
arduino-cli core install esp32:esp32
if %errorlevel% neq 0 exit /b %errorlevel%
echo.
echo.

echo Listing all installed cores...
arduino-cli core list
if %errorlevel% neq 0 exit /b %errorlevel%
echo.
echo.

0 comments on commit 1ef6ac2

Please sign in to comment.