forked from espressif/arduino-esp32
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
10,057 changed files
with
380,935 additions
and
2,109,341 deletions.
The diff you're trying to view is too large. We only load the first 3000 changed files.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,78 @@ | ||
[CmdletBinding()] | ||
param ( | ||
[Parameter()] | ||
[String] | ||
$Path | ||
) | ||
|
||
|
||
function FindSignTool { | ||
$SignTool = "signtool.exe" | ||
if (Get-Command $SignTool -ErrorAction SilentlyContinue) { | ||
return $SignTool | ||
} | ||
$SignTool = "${env:ProgramFiles(x86)}\Windows Kits\10\bin\x64\signtool.exe" | ||
if (Test-Path -Path $SignTool -PathType Leaf) { | ||
return $SignTool | ||
} | ||
$SignTool = "${env:ProgramFiles(x86)}\Windows Kits\10\bin\x86\signtool.exe" | ||
if (Test-Path -Path $SignTool -PathType Leaf) { | ||
return $SignTool | ||
} | ||
$sdkVers = "10.0.22000.0", "10.0.20348.0", "10.0.19041.0", "10.0.17763.0" | ||
Foreach ($ver in $sdkVers) | ||
{ | ||
$SignTool = "${env:ProgramFiles(x86)}\Windows Kits\10\bin\${ver}\x64\signtool.exe" | ||
if (Test-Path -Path $SignTool -PathType Leaf) { | ||
return $SignTool | ||
} | ||
} | ||
"signtool.exe not found" | ||
Exit 1 | ||
} | ||
|
||
function SignEsptool { | ||
param( | ||
[Parameter()] | ||
[String] | ||
$Path | ||
) | ||
|
||
$SignTool = FindSignTool | ||
"Using: $SignTool" | ||
$CertificateFile = [system.io.path]::GetTempPath() + "certificate.pfx" | ||
|
||
if ($null -eq $env:CERTIFICATE) { | ||
"CERTIFICATE variable not set, unable to sign the file" | ||
Exit 1 | ||
} | ||
|
||
if ("" -eq $env:CERTIFICATE) { | ||
"CERTIFICATE variable is empty, unable to sign the file" | ||
Exit 1 | ||
} | ||
|
||
$SignParameters = @("sign", "/tr", 'http://timestamp.digicert.com', "/td", "SHA256", "/f", $CertificateFile, "/fd", "SHA256") | ||
if ($env:CERTIFICATE_PASSWORD) { | ||
"CERTIFICATE_PASSWORD detected, using the password" | ||
$SignParameters += "/p" | ||
$SignParameters += $env:CERTIFICATE_PASSWORD | ||
} | ||
$SignParameters += $Path | ||
|
||
[byte[]]$CertificateBytes = [convert]::FromBase64String($env:CERTIFICATE) | ||
[IO.File]::WriteAllBytes($CertificateFile, $CertificateBytes) | ||
|
||
&$SignTool $SignParameters | ||
|
||
if (0 -eq $LASTEXITCODE) { | ||
Remove-Item $CertificateFile | ||
} else { | ||
Remove-Item $CertificateFile | ||
"Signing failed" | ||
Exit 1 | ||
} | ||
|
||
} | ||
|
||
SignEsptool ${Path} |
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
#!/bin/bash | ||
|
||
# Get all boards | ||
boards_array=() | ||
|
||
for line in `grep '.tarch=' boards.txt`; do | ||
board_name=$(echo "$line" | cut -d '.' -f1 | cut -d '#' -f1) | ||
boards_array+=("espressif:esp32:$board_name") | ||
echo "Added 'espressif:esp32:$board_name' to array" | ||
done | ||
|
||
# Create JSON like string with all boards found and pass it to env variable | ||
board_count=${#boards_array[@]} | ||
echo "Boards found: $board_count" | ||
echo "BOARD-COUNT=$board_count" >> $GITHUB_ENV | ||
|
||
if [ $board_count -gt 0 ] | ||
then | ||
json_matrix='[' | ||
for board in ${boards_array[@]} | ||
do | ||
json_matrix+='"'$board'"' | ||
if [ $board_count -gt 1 ] | ||
then | ||
json_matrix+="," | ||
fi | ||
board_count=$(($board_count - 1)) | ||
done | ||
json_matrix+=']' | ||
|
||
echo $json_matrix | ||
echo "FQBNS=${json_matrix}" >> $GITHUB_ENV | ||
else | ||
echo "FQBNS=" >> $GITHUB_ENV | ||
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,90 @@ | ||
#!/bin/bash | ||
|
||
# Get inputs from command | ||
owner_repository=$1 | ||
pr_number=$2 | ||
|
||
url="https://github.com/repos/$owner_repository/pulls/$pr_number/files" | ||
echo $url | ||
|
||
# Get changes in boards.txt file from PR | ||
Patch=$(curl $url | jq -r '.[] | select(.filename == "boards.txt") | .patch ') | ||
|
||
# Extract only changed lines number and count | ||
substring_patch=$(echo "$Patch" | grep -o '@@[^@]*@@') | ||
|
||
params_array=() | ||
|
||
IFS=$'\n' read -d '' -ra params <<< $(echo "$substring_patch" | grep -oE '[-+][0-9]+,[0-9]+') | ||
|
||
for param in "${params[@]}" | ||
do | ||
echo "The parameter is $param" | ||
params_array+=("$param") | ||
done | ||
|
||
boards_array=() | ||
previous_board="" | ||
file="boards.txt" | ||
|
||
# Loop through boards.txt file and extract all boards that were added | ||
for (( c=0; c<${#params_array[@]}; c+=2 )) | ||
do | ||
deletion_count=$( echo "${params_array[c]}" | cut -d',' -f2 | cut -d' ' -f1 ) | ||
addition_line=$( echo "${params_array[c+1]}" | cut -d'+' -f2 | cut -d',' -f1 ) | ||
addition_count=$( echo "${params_array[c+1]}" | cut -d'+' -f2 | cut -d',' -f2 | cut -d' ' -f1 ) | ||
addition_end=$(($addition_line+$addition_count)) | ||
|
||
addition_line=$(($addition_line + 3)) | ||
addition_end=$(($addition_end - $deletion_count)) | ||
|
||
echo $addition_line | ||
echo $addition_end | ||
|
||
i=0 | ||
|
||
while read -r line | ||
do | ||
i=$((i+1)) | ||
if [ $i -lt $addition_line ] | ||
then | ||
continue | ||
elif [ $i -gt $addition_end ] | ||
then | ||
break | ||
fi | ||
board_name=$(echo "$line" | cut -d '.' -f1 | cut -d '#' -f1) | ||
if [ "$board_name" != "" ] | ||
then | ||
if [ "$board_name" != "$previous_board" ] | ||
then | ||
boards_array+=("espressif:esp32:$board_name") | ||
previous_board="$board_name" | ||
echo "Added 'espressif:esp32:$board_name' to array" | ||
fi | ||
fi | ||
done < "$file" | ||
done | ||
|
||
# Create JSON like string with all boards found and pass it to env variable | ||
board_count=${#boards_array[@]} | ||
|
||
if [ $board_count -gt 0 ] | ||
then | ||
json_matrix='{"fqbn": [' | ||
for board in ${boards_array[@]} | ||
do | ||
json_matrix+='"'$board'"' | ||
if [ $board_count -gt 1 ] | ||
then | ||
json_matrix+="," | ||
fi | ||
board_count=$(($board_count - 1)) | ||
done | ||
json_matrix+=']}' | ||
|
||
echo $json_matrix | ||
echo "FQBNS=${json_matrix}" >> $GITHUB_ENV | ||
else | ||
echo "FQBNS=" >> $GITHUB_ENV | ||
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
#!/bin/bash | ||
|
||
OSBITS=`arch` | ||
if [[ "$OSTYPE" == "linux"* ]]; then | ||
export OS_IS_LINUX="1" | ||
if [[ "$OSBITS" == "i686" ]]; then | ||
OS_NAME="linux32" | ||
elif [[ "$OSBITS" == "x86_64" ]]; then | ||
OS_NAME="linux64" | ||
elif [[ "$OSBITS" == "armv7l" || "$OSBITS" == "aarch64" ]]; then | ||
OS_NAME="linuxarm" | ||
else | ||
OS_NAME="$OSTYPE-$OSBITS" | ||
echo "Unknown OS '$OS_NAME'" | ||
exit 1 | ||
fi | ||
elif [[ "$OSTYPE" == "darwin"* ]]; then | ||
export OS_IS_MACOS="1" | ||
OS_NAME="macosx" | ||
elif [[ "$OSTYPE" == "cygwin" ]] || [[ "$OSTYPE" == "msys" ]] || [[ "$OSTYPE" == "win32" ]]; then | ||
export OS_IS_WINDOWS="1" | ||
OS_NAME="windows" | ||
else | ||
OS_NAME="$OSTYPE-$OSBITS" | ||
echo "Unknown OS '$OS_NAME'" | ||
exit 1 | ||
fi | ||
export OS_NAME | ||
|
||
if [ "$OS_IS_MACOS" == "1" ]; then | ||
export ARDUINO_IDE_PATH="$HOME/bin" | ||
export ARDUINO_USR_PATH="$HOME/Documents/Arduino" | ||
elif [ "$OS_IS_WINDOWS" == "1" ]; then | ||
export ARDUINO_IDE_PATH="$HOME/bin" | ||
export ARDUINO_USR_PATH="$HOME/Documents/Arduino" | ||
else | ||
export ARDUINO_IDE_PATH="$HOME/bin" | ||
export ARDUINO_USR_PATH="$HOME/Arduino" | ||
fi | ||
|
||
if [ ! -d "$ARDUINO_IDE_PATH" ] || [ ! -f "$ARDUINO_IDE_PATH/arduino-cli" ]; then | ||
echo "Installing Arduino CLI on $OS_NAME ..." | ||
mkdir -p "$ARDUINO_IDE_PATH" | ||
curl -fsSL https://raw.githubusercontent.com/arduino/arduino-cli/master/install.sh | BINDIR="$ARDUINO_IDE_PATH" sh | ||
fi | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.