Skip to content

Commit

Permalink
Added install script for yamlpath
Browse files Browse the repository at this point in the history
Updated scripts to install esp8266 and esp32 arduino cores.
  • Loading branch information
end2endzone committed Aug 2, 2024
1 parent b0086da commit c1968f8
Show file tree
Hide file tree
Showing 12 changed files with 212 additions and 3 deletions.
5 changes: 5 additions & 0 deletions .github/workflows/build_linux.yml
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,11 @@ jobs:
gist_file_name: ${{env.GIT_REPOSITORY}}.${{env.GIT_BRANCH}}.${{env.GITHUB_WORKFLOW}}.json
file_path: ./ci/github/tests_not_available.badge.json

- name: Install yamlpath
working-directory: ${{env.GITHUB_WORKSPACE}}
shell: bash
run: ./ci/github/install_yamlpath.sh

- name: Install Arduino CLI
working-directory: ${{env.GITHUB_WORKSPACE}}
shell: bash
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 @@ -57,6 +57,11 @@ jobs:
gist_file_name: ${{env.GIT_REPOSITORY}}.${{env.GIT_BRANCH}}.${{env.GITHUB_WORKFLOW}}.json
file_path: ./ci/github/tests_not_available.badge.json

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

- name: Install Arduino CLI
working-directory: ${{env.GITHUB_WORKSPACE}}
shell: cmd
Expand Down
1 change: 1 addition & 0 deletions appveyor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ clone_folder: c:\projects\AnyRtttl

# scripts that run after cloning repository
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\arduino_install_libraries.bat
- cmd: call %APPVEYOR_BUILD_FOLDER%\ci\appveyor\install_this.bat
Expand Down
11 changes: 11 additions & 0 deletions ci/appveyor/install_yamlpath.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%
11 changes: 11 additions & 0 deletions ci/github/install_yamlpath.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
@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%
13 changes: 13 additions & 0 deletions ci/github/install_yamlpath.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# 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
3 changes: 3 additions & 0 deletions ci/linux/arduinocli-core-esp32.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
board_manager:
additional_urls:
- https://raw.githubusercontent.com/espressif/arduino-esp32/gh-pages/package_esp32_index.json
35 changes: 33 additions & 2 deletions ci/linux/install_arduinocli.sh
Original file line number Diff line number Diff line change
Expand Up @@ -13,21 +13,52 @@ fi
echo Downloading file https://downloads.arduino.cc/arduino-cli/$ARDUINO_CLI_FILENAME
wget --no-verbose https://downloads.arduino.cc/arduino-cli/$ARDUINO_CLI_FILENAME
echo
echo

# Installing
export ARDUINO_CLI_INSTALL_DIR=$HOME/arduino-cli
echo Installing Arduino CLI to directory: $ARDUINO_CLI_INSTALL_DIR
mkdir -p $ARDUINO_CLI_INSTALL_DIR
tar xf $ARDUINO_CLI_FILENAME --directory $ARDUINO_CLI_INSTALL_DIR
echo
echo

# Verify
echo Searching for arduino cli executable...
export PATH=$PATH:$ARDUINO_CLI_INSTALL_DIR
which arduino-cli
arduino-cli version
echo
echo

echo Initialize configuration file...
# Expecting something like: Config file written: /home/$USER/.arduino15/arduino-cli.yaml
arduino-cli config init --overwrite
echo
echo

echo Installing arduino:avr core...
arduino-cli core install arduino:avr
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
53 changes: 53 additions & 0 deletions ci/linux/install_yamlpath.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
# Any commands which fail will cause the shell script to exit immediately
set -e

# Set download filename
export ARDUINO_CLI_FILENAME=""
if [ "$RUNNER_OS" = "Linux" ]; then
export ARDUINO_CLI_FILENAME=arduino-cli_latest_Linux_64bit.tar.gz
elif [ "$RUNNER_OS" = "macOS" ]; then
export ARDUINO_CLI_FILENAME=arduino-cli_latest_macOS_64bit.tar.gz
fi

# Download
echo Downloading file https://downloads.arduino.cc/arduino-cli/$ARDUINO_CLI_FILENAME
wget --no-verbose https://downloads.arduino.cc/arduino-cli/$ARDUINO_CLI_FILENAME
echo
echo

# Installing
export ARDUINO_CLI_INSTALL_DIR=$HOME/arduino-cli
echo Installing Arduino CLI to directory: $ARDUINO_CLI_INSTALL_DIR
mkdir -p $ARDUINO_CLI_INSTALL_DIR
tar xf $ARDUINO_CLI_FILENAME --directory $ARDUINO_CLI_INSTALL_DIR
echo
echo

# Verify
echo Searching for arduino cli executable...
export PATH=$PATH:$ARDUINO_CLI_INSTALL_DIR
which arduino-cli
arduino-cli version
echo
echo

echo Initialize configuration file
# Expecting something like: Config file written: /home/$USER/.arduino15/arduino-cli.yaml
arduino-cli config init
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

if %errorlevel% neq 0 exit /b %errorlevel%


# Also install esp32:esp32 ?
3 changes: 3 additions & 0 deletions ci/windows/arduinocli-core-esp32.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
board_manager:
additional_urls:
- https://raw.githubusercontent.com/espressif/arduino-esp32/gh-pages/package_esp32_index.json
43 changes: 42 additions & 1 deletion ci/windows/install_arduinocli.bat
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,14 @@ echo Downloading file https://downloads.arduino.cc/arduino-cli/%ARDUINO_CLI_FILE
curl -fsSL -o "%TEMP%\%ARDUINO_CLI_FILENAME%" "https://downloads.arduino.cc/arduino-cli/%ARDUINO_CLI_FILENAME%"
if %errorlevel% neq 0 exit /b %errorlevel%
echo.
echo.

:: Installing
set ARDUINO_CLI_INSTALL_DIR=%USERPROFILE%\Desktop\arduino-cli
echo Installing Arduino CLI to directory: %ARDUINO_CLI_INSTALL_DIR%
7z x "%TEMP%\%ARDUINO_CLI_FILENAME%" "-o%ARDUINO_CLI_INSTALL_DIR%"
7z x -y "%TEMP%\%ARDUINO_CLI_FILENAME%" "-o%ARDUINO_CLI_INSTALL_DIR%"
if %errorlevel% neq 0 exit /b %errorlevel%
echo.
echo.

:: Verify
Expand All @@ -23,9 +26,47 @@ where arduino-cli.exe
if %errorlevel% neq 0 exit /b %errorlevel%
arduino-cli version
echo.
echo.

echo Initialize configuration file...
REM Expecting something like: Config file written to: C:\Users\%USERNAME%\AppData\Local\Arduino15\arduino-cli.yaml
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.
32 changes: 32 additions & 0 deletions ci/windows/install_yamlpath.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
@echo off

:: Install yamlpath.
:: https://github.com/wwkimball/yamlpath
:: https://pypi.org/project/yamlpath/

:: Validate if python launcher is installed
where py.exe >NUL 2>NUL
if errorlevel 1 (
echo Command failed. Please install python and python launcher to continue.
exit /B %errorlevel%
)
echo Found python interpreter
python --version

:: Validate if pip is installed
where pip.exe >NUL 2>NUL
if errorlevel 1 (
echo Command failed. Please install pip ^(Package Installer Python^) to continue.
exit /B %errorlevel%
)

:: Installing yamlpath.
echo Proceeding with instaling yamlpath...
pip install yamlpath
if errorlevel 1 (
echo Command failed. An error was found while installing yamlpath.
exit /B %errorlevel%
)

echo yamlpath was installed on the system without error.
echo.

0 comments on commit c1968f8

Please sign in to comment.