diff --git a/.github/workflows/build_linux.yml b/.github/workflows/build_linux.yml index 3328804..23615cf 100644 --- a/.github/workflows/build_linux.yml +++ b/.github/workflows/build_linux.yml @@ -71,6 +71,11 @@ jobs: shell: bash run: ./ci/github/install_yamlpath.sh + - name: Install pyserial + working-directory: ${{env.GITHUB_WORKSPACE}} + shell: bash + run: ./ci/github/install_pyserial.sh + - name: Install Arduino CLI working-directory: ${{env.GITHUB_WORKSPACE}} shell: bash diff --git a/.github/workflows/build_windows.yml b/.github/workflows/build_windows.yml index 6238dbc..28a67f0 100644 --- a/.github/workflows/build_windows.yml +++ b/.github/workflows/build_windows.yml @@ -63,6 +63,11 @@ jobs: shell: cmd run: call ci\github\install_yamlpath.bat + - name: Install pyserial + working-directory: ${{env.GITHUB_WORKSPACE}} + shell: cmd + run: call ci\github\install_pyserial.bat + - name: Install Arduino CLI working-directory: ${{env.GITHUB_WORKSPACE}} shell: cmd diff --git a/appveyor.yml b/appveyor.yml index 5849d4d..125b73d 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -29,6 +29,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_pyserial.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 diff --git a/ci/appveyor/install_pyserial.bat b/ci/appveyor/install_pyserial.bat new file mode 100644 index 0000000..8664e83 --- /dev/null +++ b/ci/appveyor/install_pyserial.bat @@ -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% diff --git a/ci/github/install_pyserial.bat b/ci/github/install_pyserial.bat new file mode 100644 index 0000000..3879bc5 --- /dev/null +++ b/ci/github/install_pyserial.bat @@ -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% diff --git a/ci/github/install_pyserial.sh b/ci/github/install_pyserial.sh new file mode 100755 index 0000000..23af3c6 --- /dev/null +++ b/ci/github/install_pyserial.sh @@ -0,0 +1,12 @@ +# 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 +this_filename=`basename "$0"` +$GITHUB_WORKSPACE/ci/linux/$this_filename diff --git a/ci/linux/install_pyserial.sh b/ci/linux/install_pyserial.sh new file mode 100755 index 0000000..059606b --- /dev/null +++ b/ci/linux/install_pyserial.sh @@ -0,0 +1,24 @@ +# Any commands which fail will cause the shell script to exit immediately +set -e + +# Install pyserial. + +# Search for python +echo Validate if python is installed +which python +echo Found python interpreter +python --version +echo + +# Search for pip +echo Validate if pip is installed +which pip +echo + +# Installing pyserial. +echo Proceeding with instaling pyserial... +pip install pyserial +echo + +echo pyserial was installed on the system without error. +echo diff --git a/ci/windows/install_pyserial.bat b/ci/windows/install_pyserial.bat new file mode 100644 index 0000000..9b90cbc --- /dev/null +++ b/ci/windows/install_pyserial.bat @@ -0,0 +1,42 @@ +@echo off + +:: Install pyserial. + +:: Search for py.exe +:: NOTE: THIS STEP IS WINDOWS ONLY. Linux does not have a python launcher. +echo 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 launcher. +echo. + +:: Search for python.exe +echo Validate if python is installed +where python.exe >NUL 2>NUL +echo Found python interpreter +python --version +echo. + +:: Search for pip.exe +echo 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% +) +echo. + +:: Installing pyserial. +echo Proceeding with instaling pyserial... +pip install pyserial +if errorlevel 1 ( + echo Command failed. An error was found while installing pyserial. + exit /B %errorlevel% +) +echo. + +echo pyserial was installed on the system without error. +echo.