Skip to content

Commit ab105bf

Browse files
committed
test
1 parent 38e8fdd commit ab105bf

File tree

3 files changed

+81
-104
lines changed

3 files changed

+81
-104
lines changed

.github/workflows/cron_build.yml

+2-9
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ jobs:
5858
build-libs:
5959
name: Build for ${{ matrix.target }} (${{ inputs.idf_branch }})
6060
runs-on: ubuntu-latest
61-
if: needs.check-if-needed.outputs.libs_has_asset == '0'
61+
if: needs.check-if-needed.outputs.deploy_needed == '1'
6262
needs: check-if-needed
6363
strategy:
6464
fail-fast: false
@@ -103,35 +103,28 @@ jobs:
103103
name: Combine artifacts and push changes for IDF ${{ inputs.idf_branch }}
104104
runs-on: ubuntu-latest
105105
needs: [check-if-needed, build-libs]
106-
if: |
107-
always() &&
108-
needs.check-if-needed.result == 'success' &&
109-
needs.check-if-needed.outputs.deploy_needed == '1'
106+
if: needs.check-if-needed.outputs.deploy_needed == '1'
110107
steps:
111108
- uses: actions/checkout@v4
112109
with:
113110
ref: ${{ inputs.lib_builder_branch }}
114111

115112
- name: Replace invalid characters in the artifact name
116-
if: needs.check-if-needed.outputs.libs_has_asset == '0'
117113
run: |
118114
branch=${{ inputs.idf_branch }}
119115
echo "libs_branch=${branch//\//_}" >> $GITHUB_ENV
120116
121117
- name: Download artifacts
122-
if: needs.check-if-needed.outputs.libs_has_asset == '0'
123118
uses: actions/download-artifact@v4
124119
with:
125120
path: dist
126121
pattern: libs-${{ env.libs_branch }}-*
127122
merge-multiple: true
128123

129124
- name: Combine artifacts
130-
if: needs.check-if-needed.outputs.libs_has_asset == '0'
131125
run: bash ./tools/combine-artifacts.sh
132126

133127
- name: Upload full esp32-arduino-libs archive
134-
if: needs.check-if-needed.outputs.libs_has_asset == '0'
135128
uses: actions/upload-artifact@v4
136129
with:
137130
name: esp32-arduino-libs-${{ env.libs_branch }}

tools/combine-artifacts.sh

+2-2
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,12 @@ libs_folder="out/tools/esp32-arduino-libs"
88
files=$(find dist -name 'arduino-esp32-libs-esp*.tar.gz')
99
for file in $files; do
1010
echo "Extracting $file"
11-
tar zxvf $file -C out
11+
tar zxf $file -C out
1212
cat $libs_folder/versions.txt >> $libs_folder/versions_full.txt
1313
done
1414

1515
# Merge versions.txt files
1616
awk -i inplace '!seen[$0]++' $libs_folder/versions_full.txt
1717
mv -f $libs_folder/versions_full.txt $libs_folder/versions.txt
1818

19-
cd out/tools && zip -r ../../dist/esp32-arduino-libs.zip * && cd ../..
19+
cd out/tools && zip -X -r ../../dist/esp32-arduino-libs.zip * && cd ../..

tools/push-to-arduino.sh

+77-93
Original file line numberDiff line numberDiff line change
@@ -26,106 +26,90 @@ IDF_LIBS_ZIP_URL="https://github.com/$AR_LIBS_REPO/releases/download/$LIBS_RELEA
2626
IDF_LIBS_JSON_URL="https://github.com/$AR_LIBS_REPO/releases/download/$LIBS_RELEASE_TAG/$LIBS_JSON_FILENAME"
2727

2828
if [ $AR_HAS_COMMIT == "0" ]; then
29-
if [ $LIBS_HAS_ASSET == "0" ]; then
30-
cd "$AR_ROOT"
31-
mkdir -p dist
32-
33-
# check if the release exists
34-
if [ $LIBS_HAS_RELEASE == "0" ]; then
35-
echo "Release for tag \"$LIBS_RELEASE_TAG\" not found. Please create the release first."
36-
exit 1
37-
fi
29+
cd "$AR_ROOT"
30+
mkdir -p dist
3831

39-
echo "Creating asset '$LIBS_ZIP_FILENAME'..."
32+
# check if the release exists
33+
if [ $LIBS_HAS_RELEASE == "0" ]; then
34+
echo "Release for tag \"$LIBS_RELEASE_TAG\" not found. Please create the release first."
35+
exit 1
36+
fi
4037

41-
mv -f "dist/esp32-arduino-libs.zip" "dist/$LIBS_ZIP_FILENAME"
42-
LIBS_ASSET_ID=`github_release_asset_upload "$AR_LIBS_REPO" "$LIBS_RELEASE_ID" "$LIBS_ZIP_FILENAME" "dist/$LIBS_ZIP_FILENAME"`
43-
if [ -z "$LIBS_ASSET_ID" ]; then
44-
echo "ERROR: Failed to upload asset '$LIBS_ZIP_FILENAME'"
45-
exit 1
38+
# Delete old assets for the version
39+
if [ $LIBS_HAS_ASSET == "1" ]; then
40+
echo "Deleting existing assets for version '$LIBS_VERSION'..."
41+
if [ `github_release_asset_delete "$AR_LIBS_REPO" "$LIBS_ASSET_ID"` == "0" ]; then
42+
echo "ERROR: Failed to delete asset '$LIBS_ZIP_FILENAME'"
4643
fi
44+
JSON_ASSET_ID=`github_release_asset_id "$AR_LIBS_REPO" "$LIBS_RELEASE_ID" "$LIBS_JSON_FILENAME"`
45+
if [ "$JSON_ASSET_ID" != "" ] && [ `github_release_asset_delete "$AR_LIBS_REPO" "$JSON_ASSET_ID"` == "0" ]; then
46+
echo "ERROR: Failed to delete asset '$LIBS_JSON_FILENAME'"
47+
fi
48+
fi
4749

48-
echo "Finished uploading asset '$LIBS_ZIP_FILENAME'. Asset ID: $LIBS_ASSET_ID"
49-
50-
# Calculate the local file checksum and size
51-
local_checksum=$(sha256sum "dist/$LIBS_ZIP_FILENAME" | awk '{print $1}')
52-
local_size=$(stat -c%s "dist/$LIBS_ZIP_FILENAME")
50+
echo "Creating asset '$LIBS_ZIP_FILENAME'..."
5351

54-
echo "Downloading asset '$LIBS_ZIP_FILENAME' and checking integrity..."
52+
mv -f "dist/esp32-arduino-libs.zip" "dist/$LIBS_ZIP_FILENAME"
53+
LIBS_ASSET_ID=`github_release_asset_upload "$AR_LIBS_REPO" "$LIBS_RELEASE_ID" "$LIBS_ZIP_FILENAME" "dist/$LIBS_ZIP_FILENAME"`
54+
if [ -z "$LIBS_ASSET_ID" ]; then
55+
echo "ERROR: Failed to upload asset '$LIBS_ZIP_FILENAME'"
56+
exit 1
57+
fi
5558

56-
# Download the file
57-
remote_file="remote-$LIBS_ZIP_FILENAME"
58-
curl -s -L -o "$remote_file" "$IDF_LIBS_ZIP_URL"
59+
echo "Finished uploading asset '$LIBS_ZIP_FILENAME'. Asset ID: $LIBS_ASSET_ID"
5960

60-
# Check if the download was successful
61-
if [ $? -ne 0 ]; then
62-
echo "Error downloading file from $IDF_LIBS_ZIP_URL"
63-
exit 1
64-
fi
61+
# Calculate the local file checksum and size
62+
local_checksum=$(sha256sum "dist/$LIBS_ZIP_FILENAME" | awk '{print $1}')
63+
local_size=$(stat -c%s "dist/$LIBS_ZIP_FILENAME")
6564

66-
# Calculate the remote file checksum and size
67-
remote_checksum=$(sha256sum "$remote_file" | awk '{print $1}')
68-
remote_size=$(stat -c%s "$remote_file")
65+
echo "Downloading asset '$LIBS_ZIP_FILENAME' and checking integrity..."
6966

70-
echo "Local: $local_size bytes, $local_checksum"
71-
echo "Remote: $remote_size bytes, $remote_checksum"
67+
# Download the file
68+
remote_file="remote-$LIBS_ZIP_FILENAME"
69+
curl -s -L -o "$remote_file" "$IDF_LIBS_ZIP_URL"
7270

73-
# Check if the checksums match
74-
if [ "$local_checksum" != "$remote_checksum" ]; then
75-
echo "Checksum mismatch for downloaded file"
76-
echo "Deleting asset and exiting..."
77-
if [ `github_release_asset_delete "$AR_LIBS_REPO" "$LIBS_ASSET_ID"` == "0" ]; then
78-
echo "ERROR: Failed to delete asset '$LIBS_ZIP_FILENAME'"
79-
fi
80-
exit 1
81-
fi
71+
# Check if the download was successful
72+
if [ $? -ne 0 ]; then
73+
echo "Error downloading file from $IDF_LIBS_ZIP_URL"
74+
exit 1
75+
fi
8276

83-
# Clean up the downloaded file
84-
rm "$remote_file"
85-
86-
# Print the results
87-
echo "Tool: esp32-arduino-libs"
88-
echo "Version: $LIBS_VERSION"
89-
echo "URL: $IDF_LIBS_ZIP_URL"
90-
echo "File: $LIBS_ZIP_FILENAME"
91-
echo "Size: $local_size bytes"
92-
echo "SHA-256: $local_checksum"
93-
echo "JSON: $AR_OUT/package_esp32_index.template.json"
94-
cd "$AR_ROOT"
95-
python3 tools/add_sdk_json.py -j "$AR_OUT/package_esp32_index.template.json" -n "esp32-arduino-libs" -v "$LIBS_VERSION" -u "$IDF_LIBS_ZIP_URL" -f "$LIBS_ZIP_FILENAME" -s "$local_size" -c "$local_checksum"
96-
if [ $? -ne 0 ]; then exit 1; fi
97-
98-
JSON_ASSET_ID=`github_release_asset_upload "$AR_LIBS_REPO" "$LIBS_RELEASE_ID" "$LIBS_JSON_FILENAME" "$AR_OUT/package_esp32_index.template.json"`
99-
if [ -z "$JSON_ASSET_ID" ]; then
100-
echo "ERROR: Failed to upload asset '$LIBS_JSON_FILENAME'"
101-
exit 1
102-
fi
103-
else
104-
cd "$AR_ROOT"
105-
mkdir -p $AR_TOOLS
77+
# Calculate the remote file checksum and size
78+
remote_checksum=$(sha256sum "$remote_file" | awk '{print $1}')
79+
remote_size=$(stat -c%s "$remote_file")
10680

107-
echo "Asset '$LIBS_ZIP_FILENAME' already exists. Downloading..."
81+
echo "Local: $local_size bytes, $local_checksum"
82+
echo "Remote: $remote_size bytes, $remote_checksum"
10883

109-
curl -s -L -o "$LIBS_ZIP_FILENAME" "$IDF_LIBS_ZIP_URL"
110-
if [ $? -ne 0 ]; then
111-
echo "ERROR: Failed to download asset '$LIBS_ZIP_FILENAME'"
112-
exit 1
84+
# Check if the checksums match
85+
if [ "$local_checksum" != "$remote_checksum" ]; then
86+
echo "Checksum mismatch for downloaded file"
87+
echo "Deleting asset and exiting..."
88+
if [ `github_release_asset_delete "$AR_LIBS_REPO" "$LIBS_ASSET_ID"` == "0" ]; then
89+
echo "ERROR: Failed to delete asset '$LIBS_ZIP_FILENAME'"
11390
fi
91+
exit 1
92+
fi
11493

115-
unzip -o "$LIBS_ZIP_FILENAME" -d "$AR_OUT/tools"
116-
117-
JSON_ASSET_ID=`github_release_asset_id "$AR_LIBS_REPO" "$LIBS_RELEASE_ID" "$LIBS_JSON_FILENAME"`
118-
if [ -z "$JSON_ASSET_ID" ]; then
119-
echo "ERROR: JSON file '$LIBS_JSON_FILENAME' not found. Deleting asset '$LIBS_ZIP_FILENAME' and exiting..."
120-
if [ "`github_release_asset_delete "$AR_LIBS_REPO" "$LIBS_ASSET_ID"`" == "0" ]; then
121-
echo "ERROR: Failed to delete asset '$LIBS_ZIP_FILENAME'"
122-
fi
123-
exit 1
124-
fi
94+
# Clean up the downloaded file
95+
rm "$remote_file"
96+
97+
# Print the results
98+
echo "Tool: esp32-arduino-libs"
99+
echo "Version: $LIBS_VERSION"
100+
echo "URL: $IDF_LIBS_ZIP_URL"
101+
echo "File: $LIBS_ZIP_FILENAME"
102+
echo "Size: $local_size bytes"
103+
echo "SHA-256: $local_checksum"
104+
echo "JSON: $AR_OUT/package_esp32_index.template.json"
105+
cd "$AR_ROOT"
106+
python3 tools/add_sdk_json.py -j "$AR_OUT/package_esp32_index.template.json" -n "esp32-arduino-libs" -v "$LIBS_VERSION" -u "$IDF_LIBS_ZIP_URL" -f "$LIBS_ZIP_FILENAME" -s "$local_size" -c "$local_checksum"
107+
if [ $? -ne 0 ]; then exit 1; fi
125108

126-
echo "JSON asset ID: $JSON_ASSET_ID"
127-
echo "Downloading JSON asset '$LIBS_JSON_FILENAME'..."
128-
curl -s -L -o "$AR_OUT/package_esp32_index.template.json" "$IDF_LIBS_JSON_URL"
109+
JSON_ASSET_ID=`github_release_asset_upload "$AR_LIBS_REPO" "$LIBS_RELEASE_ID" "$LIBS_JSON_FILENAME" "$AR_OUT/package_esp32_index.template.json"`
110+
if [ -z "$JSON_ASSET_ID" ]; then
111+
echo "ERROR: Failed to upload asset '$LIBS_JSON_FILENAME'"
112+
exit 1
129113
fi
130114
fi
131115

@@ -144,7 +128,7 @@ if [ $AR_HAS_COMMIT == "0" ]; then
144128
git -C "$AR_COMPS/arduino" checkout -b $AR_NEW_BRANCH_NAME
145129
fi
146130
if [ $? -ne 0 ]; then
147-
echo "ERROR: Checkout of branch '$AR_NEW_BRANCH_NAME' failed"
131+
echo "ERROR: Checkout of branch '$AR_NEW_BRANCH_NAME' failed"
148132
exit 1
149133
fi
150134

@@ -157,18 +141,18 @@ if [ $AR_HAS_COMMIT == "0" ]; then
157141
# did any of the files change?
158142
if [ -n "$(git status --porcelain)" ]; then
159143
echo "Pushing changes to branch '$AR_NEW_BRANCH_NAME'..."
160-
git add . && git commit --message "$AR_NEW_COMMIT_MESSAGE" && git push -u origin $AR_NEW_BRANCH_NAME
144+
git add . && git commit --message "$AR_NEW_COMMIT_MESSAGE" && git push -u origin $AR_NEW_BRANCH_NAME
161145
if [ $? -ne 0 ]; then
162-
echo "ERROR: Pushing to branch '$AR_NEW_BRANCH_NAME' failed"
146+
echo "ERROR: Pushing to branch '$AR_NEW_BRANCH_NAME' failed"
163147
exit 1
164148
fi
165149
else
166-
echo "No changes in branch '$AR_NEW_BRANCH_NAME'"
167-
if [ $AR_HAS_BRANCH == "0" ]; then
168-
echo "Delete created branch '$AR_NEW_BRANCH_NAME'"
169-
git branch -d $AR_NEW_BRANCH_NAME
170-
fi
171-
exit 0
150+
echo "No changes in branch '$AR_NEW_BRANCH_NAME'"
151+
if [ $AR_HAS_BRANCH == "0" ]; then
152+
echo "Delete created branch '$AR_NEW_BRANCH_NAME'"
153+
git branch -d $AR_NEW_BRANCH_NAME
154+
fi
155+
exit 0
172156
fi
173157

174158
# CREATE PULL REQUEST

0 commit comments

Comments
 (0)