Skip to content

Commit 5fdfb88

Browse files
committed
Update cron.yml
1 parent 0e10fad commit 5fdfb88

12 files changed

+116
-101
lines changed

Diff for: .github/workflows/cron.yml

+5-5
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,8 @@ jobs:
3232
GITHUB_TOKEN: ${{ secrets.PUSH_TOKEN }}
3333
IDF_BRANCH: ${{ matrix.idf_branch }}
3434
run: bash ./tools/cron.sh
35-
# - name: Upload archive
36-
# uses: actions/upload-artifact@v1
37-
# with:
38-
# name: arduino-libs
39-
# path: dist
35+
- name: Upload archive
36+
uses: actions/upload-artifact@v1
37+
with:
38+
name: artifacts
39+
path: dist

Diff for: .github/workflows/push.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -23,5 +23,5 @@ jobs:
2323
- name: Upload archive
2424
uses: actions/upload-artifact@v1
2525
with:
26-
name: arduino-libs
26+
name: artifacts
2727
path: dist

Diff for: .github/workflows/repository_dispatch.yml

+5-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ jobs:
66
run:
77
name: Dispatch Event
88
runs-on: ubuntu-latest
9-
109
steps:
1110
- uses: actions/checkout@v1
1211
- name: Install dependencies
@@ -17,3 +16,8 @@ jobs:
1716
env:
1817
GITHUB_TOKEN: ${{ secrets.PUSH_TOKEN }}
1918
run: bash ./tools/repository_dispatch.sh
19+
- name: Upload archive
20+
uses: actions/upload-artifact@v1
21+
with:
22+
name: artifacts
23+
path: dist

Diff for: build.sh

+2
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,8 @@ if ! [ -x "$(command -v stat)" ]; then
3535
exit 1
3636
fi
3737

38+
mkdir -p dist
39+
3840
# update components from git
3941
./tools/update-components.sh
4042
if [ $? -ne 0 ]; then exit 1; fi

Diff for: tools/archive-build.sh

+10-7
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,16 @@
11
#!/bin/bash
22

3-
IDF_COMMIT=$(git -C $IDF_PATH rev-parse --short HEAD)
4-
IDF_BRANCH=$(git -C $IDF_PATH symbolic-ref --short HEAD)
3+
IDF_COMMIT=$(git -C "$IDF_PATH" rev-parse --short HEAD)
4+
IDF_BRANCH=$(git -C "$IDF_PATH" symbolic-ref --short HEAD)
55

66
idf_version_string=${IDF_BRANCH//\//_}"-$IDF_COMMIT"
77
archive_path="dist/arduino-esp32-libs-$idf_version_string.tar.gz"
8+
build_archive_path="dist/arduino-esp32-build-$idf_version_string.tar.gz"
89

9-
mkdir -p dist && \
10-
rm -rf $archive_path && \
11-
cd out && \
12-
tar zcf ../$archive_path * \
13-
&& cd ..
10+
mkdir -p dist && rm -rf "$archive_path" "$build_archive_path"
11+
if [ -d "out" ]; then
12+
cd out && tar zcf "../$archive_path" * && cd ..
13+
fi
14+
if [ -d "build" ]; then
15+
cd build && tar zcf "../$build_archive_path" * && cd ..
16+
fi

Diff for: tools/config.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ if [ -z $IDF_BRANCH ]; then
1313
fi
1414

1515
# Owner of the target ESP32 Arduino repository
16-
AR_USER="me-no-dev"
16+
AR_USER="espressif"
1717

1818
# The full name of the repository
1919
AR_REPO="$AR_USER/arduino-esp32"

Diff for: tools/cron.sh

+1-6
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,10 @@
11
#!/bin/bash
22

3-
if [ ! $GITHUB_EVENT_NAME == "schedule" ]; then
3+
if [ ! "$GITHUB_EVENT_NAME" == "schedule" ]; then
44
echo "Wrong event '$GITHUB_EVENT_NAME'!"
55
exit 1
66
fi
77

8-
echo "Event: $GITHUB_EVENT_NAME, Repo: $GITHUB_REPOSITORY, Path: $GITHUB_WORKSPACE, Ref: $GITHUB_REF"
9-
108
git checkout "$IDF_BRANCH" #local branches should match what the matrix wants to build
11-
129
source ./build.sh
13-
1410
bash ./tools/push-to-arduino.sh
15-
#bash ./tools/archive-build.sh

Diff for: tools/install-esp-idf.sh

+37-3
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,10 @@ if ! [ -x "$(command -v $SED)" ]; then
77
exit 1
88
fi
99

10+
#
11+
# CLONE ESP-IDF
12+
#
13+
1014
if [ -z "$IDF_PATH" ]; then
1115
echo "ESP-IDF is not installed! Installing local copy"
1216
idf_was_installed="1"
@@ -17,12 +21,16 @@ if [ -z "$IDF_PATH" ]; then
1721
fi
1822

1923
if [ "$IDF_COMMIT" ]; then
20-
git -C $IDF_PATH checkout $IDF_COMMIT
24+
git -C "$IDF_PATH" checkout "$IDF_COMMIT"
2125
commit_predefined="1"
2226
fi
2327

24-
export IDF_COMMIT=$(git -C $IDF_PATH rev-parse --short HEAD)
25-
export IDF_BRANCH=$(git -C $IDF_PATH symbolic-ref --short HEAD)
28+
export IDF_COMMIT=$(git -C "$IDF_PATH" rev-parse --short HEAD)
29+
export IDF_BRANCH=$(git -C "$IDF_PATH" symbolic-ref --short HEAD)
30+
31+
#
32+
# SETUP ARDUINO DEPLOY
33+
#
2634

2735
if [ "$GITHUB_EVENT_NAME" == "schedule" ] || [ "$GITHUB_EVENT_NAME" == "repository_dispatch" -a "$GITHUB_EVENT_ACTION" == "deploy" ]; then
2836
# format new branch name and pr title
@@ -53,6 +61,24 @@ if [ "$GITHUB_EVENT_NAME" == "schedule" ] || [ "$GITHUB_EVENT_NAME" == "reposito
5361
echo "PR '$AR_NEW_PR_TITLE' Already Exists"
5462
fi
5563

64+
# setup git for pushing
65+
git config --global github.user "$GITHUB_ACTOR"
66+
git config --global user.name "$GITHUB_ACTOR"
67+
git config --global user.email "$GITHUB_ACTOR@github.com"
68+
69+
# create or checkout the branch
70+
if [ ! $AR_HAS_BRANCH == "0" ]; then
71+
echo "Switching to arduino branch '$AR_NEW_BRANCH_NAME'..."
72+
git -C "$AR_COMPS/arduino" checkout $AR_NEW_BRANCH_NAME
73+
else
74+
echo "Creating arduino branch '$AR_NEW_BRANCH_NAME'..."
75+
git -C "$AR_COMPS/arduino" checkout -b $AR_NEW_BRANCH_NAME
76+
fi
77+
if [ $? -ne 0 ]; then
78+
echo "ERROR: Checkout of branch '$AR_NEW_BRANCH_NAME' failed"
79+
exit 1
80+
fi
81+
5682
export AR_NEW_BRANCH_NAME
5783
export AR_NEW_COMMIT_MESSAGE
5884
export AR_NEW_PR_TITLE
@@ -62,6 +88,10 @@ if [ "$GITHUB_EVENT_NAME" == "schedule" ] || [ "$GITHUB_EVENT_NAME" == "reposito
6288
export AR_HAS_PR
6389
fi
6490

91+
#
92+
# UPDATE IDF MODULES
93+
#
94+
6595
if [ -x $idf_was_installed ]; then
6696
git -C $IDF_PATH fetch origin && git -C $IDF_PATH pull origin $IDF_BRANCH
6797
git -C $IDF_PATH submodule update --init --recursive
@@ -70,6 +100,10 @@ else
70100
cd $IDF_PATH && python -m pip install -r requirements.txt && cd "$AR_ROOT"
71101
fi
72102

103+
#
104+
# INSTALL TOOLCHAIN
105+
#
106+
73107
if ! [ -x "$(command -v $IDF_TOOLCHAIN-gcc)" ]; then
74108
echo "GCC toolchain is not installed! Installing local copy"
75109

Diff for: tools/prepare-libs.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ cat pio_start.txt > "$AR_PLATFORMIO_PY"
1616
rm pio_end.txt 1pio_start.txt 2pio_start.txt pio_start.txt
1717

1818
# include dirs
19-
AR_INC="-DESP_PLATFORM -DMBEDTLS_CONFIG_FILE=\"mbedtls/esp_config.h\" -DHAVE_CONFIG_H \"-I{compiler.sdk.path}/include/config\""
19+
AR_INC="-DESP_PLATFORM -DMBEDTLS_CONFIG_FILE=\"mbedtls/esp_config.h\" -DHAVE_CONFIG_H -DGCC_NOT_5_2_0=0 -DWITH_POSIX \"-I{compiler.sdk.path}/include/config\""
2020
echo " CPPPATH=[" >> "$AR_PLATFORMIO_PY" && echo " join(FRAMEWORK_DIR, \"tools\", \"sdk\", \"include\", \"config\")," >> "$AR_PLATFORMIO_PY"
2121
while [ "$1" != "" ]; do
2222
cpath=$1

Diff for: tools/push-to-arduino.sh

+1-34
Original file line numberDiff line numberDiff line change
@@ -11,46 +11,13 @@ if ! [ -d "$AR_COMPS/arduino" ]; then
1111
exit 1
1212
fi
1313

14-
# # format new branch name and pr title
15-
# if [ -x $1 ]; then #commit was not specified at build time
16-
# AR_NEW_BRANCH_NAME="idf-$IDF_BRANCH"
17-
# AR_NEW_COMMIT_MESSAGE="IDF $IDF_BRANCH $IDF_COMMIT"
18-
# AR_NEW_PR_TITLE="IDF $IDF_BRANCH"
19-
# else
20-
# AR_NEW_BRANCH_NAME="idf-$IDF_COMMIT"
21-
# AR_NEW_COMMIT_MESSAGE="IDF $IDF_COMMIT"
22-
# AR_NEW_PR_TITLE="$AR_NEW_COMMIT_MESSAGE"
23-
# fi
24-
25-
# AR_HAS_COMMIT=`git_commit_exists "$AR_COMPS/arduino" "$AR_NEW_COMMIT_MESSAGE"`
26-
# AR_HAS_BRANCH=`git_branch_exists "$AR_COMPS/arduino" "$AR_NEW_BRANCH_NAME"`
27-
# AR_HAS_PR=`git_pr_exists "$AR_NEW_BRANCH_NAME"`
28-
2914
#
30-
# CREATE/UPDATE BRANCH
15+
# UPDATE FILES
3116
#
3217

3318
if [ $AR_HAS_COMMIT == "0" ]; then
3419
cd $AR_COMPS/arduino
3520

36-
# setup git for pushing
37-
git config --global github.user "$GITHUB_ACTOR"
38-
git config --global user.name "$GITHUB_ACTOR"
39-
git config --global user.email "$GITHUB_ACTOR@github.com"
40-
41-
# create or checkout the branch
42-
if [ ! $AR_HAS_BRANCH == "0" ]; then
43-
echo "Switching to branch '$AR_NEW_BRANCH_NAME'..."
44-
git checkout $AR_NEW_BRANCH_NAME
45-
else
46-
echo "Creating branch '$AR_NEW_BRANCH_NAME'..."
47-
git checkout -b $AR_NEW_BRANCH_NAME
48-
fi
49-
if [ $? -ne 0 ]; then
50-
echo "ERROR: Checkour of branch '$AR_NEW_BRANCH_NAME' failed"
51-
exit 1
52-
fi
53-
5421
# make changes to the files
5522
echo "Patching files in branch '$AR_NEW_BRANCH_NAME'..."
5623
rm -rf $AR_COMPS/arduino/tools/sdk

Diff for: tools/repository_dispatch.sh

+20-20
Original file line numberDiff line numberDiff line change
@@ -1,41 +1,41 @@
11
#!/bin/bash
22

3-
if [ ! $GITHUB_EVENT_NAME == "repository_dispatch" ]; then
3+
if [ ! "$GITHUB_EVENT_NAME" == "repository_dispatch" ]; then
44
echo "Wrong event '$GITHUB_EVENT_NAME'!"
55
exit 1
66
fi
77

8-
#echo "Event: $GITHUB_EVENT_NAME, Repo: $GITHUB_REPOSITORY, Path: $GITHUB_WORKSPACE, Ref: $GITHUB_REF"
8+
EVENT_JSON=`cat "$GITHUB_EVENT_PATH"`
9+
action=`echo "$EVENT_JSON" | jq -r '.action'`
10+
payload=`echo "$EVENT_JSON" | jq -r '.client_payload'`
11+
branch=`echo "$payload" | jq -r '.branch'`
12+
commit=`echo "$payload" | jq -r '.commit'`
13+
builder=`echo "$payload" | jq -r '.builder'`
914

10-
EVENT_JSON=`cat $GITHUB_EVENT_PATH`
11-
action=`echo $EVENT_JSON | jq -r '.action'`
12-
payload=`echo $EVENT_JSON | jq -r '.client_payload'`
13-
branch=`echo $payload | jq -r '.branch'`
14-
commit=`echo $payload | jq -r '.commit'`
15+
echo "Action: $action, Branch: $branch, Commit: $commit, Builder: $builder"
1516

16-
echo "Action: $action, Branch: $branch, Commit: $commit"
17-
18-
if [ ! $action == "deploy" ] && [ ! $action == "build" ]; then
17+
if [ ! "$action" == "deploy" ] && [ ! "$action" == "build" ]; then
1918
echo "Bad Action $action"
2019
exit 1
2120
fi
2221

2322
export GITHUB_EVENT_ACTION="$action"
2423

25-
if [ ! $commit == "" ] && [ ! $commit == "null" ]; then
24+
if [ ! "$commit" == "" ] && [ ! "$commit" == "null" ]; then
2625
export IDF_COMMIT="$commit"
2726
else
28-
commit=""
29-
if [ ! $branch == "" ] && [ ! $branch == "null" ]; then
30-
export IDF_BRANCH="$branch"
31-
git checkout "$IDF_BRANCH" #local branches should match what the matrix wants to build
32-
fi
27+
commit=""
28+
if [ ! "$branch" == "" ] && [ ! "$branch" == "null" ]; then
29+
export IDF_BRANCH="$branch"
30+
fi
3331
fi
3432

35-
source ./build.sh
33+
if [ ! "$builder" == "" ] && [ ! "$builder" == "null" ]; then
34+
git checkout "$builder"
35+
fi
3636

37-
#bash ./tools/archive-build.sh
37+
source ./build.sh
3838

39-
if [ $action == "deploy" ]; then
40-
bash ./tools/push-to-arduino.sh $commit
39+
if [ "$action" == "deploy" ]; then
40+
bash ./tools/push-to-arduino.sh
4141
fi

Diff for: tools/update-components.sh

+32-22
Original file line numberDiff line numberDiff line change
@@ -2,29 +2,39 @@
22

33
source ./tools/config.sh
44

5-
cd "$AR_COMPS"
6-
7-
if [ ! -d "arduino" ]; then
8-
git clone $AR_REPO_URL arduino
9-
fi
10-
11-
if [ ! -d "esp32-camera" ]; then
12-
git clone --depth 1 $CAMERA_REPO_URL
5+
#
6+
# CLONE/UPDATE ARDUINO
7+
#
8+
9+
if [ ! -d "$AR_COMPS/arduino" ]; then
10+
git clone $AR_REPO_URL "$AR_COMPS/arduino"
11+
else
12+
git -C "$AR_COMPS/arduino" fetch origin && \
13+
git -C "$AR_COMPS/arduino" pull origin master
1314
fi
14-
15-
if [ ! -d "esp-face" ]; then
16-
git clone --depth 1 $FACE_REPO_URL
15+
if [ $? -ne 0 ]; then exit 1; fi
16+
git -C "$AR_COMPS/arduino" submodule update --init --recursive
17+
18+
#
19+
# CLONE/UPDATE ESP32-CAMERA
20+
#
21+
22+
if [ ! -d "$AR_COMPS/esp32-camera" ]; then
23+
git clone $CAMERA_REPO_URL "$AR_COMPS/esp32-camera"
24+
else
25+
git -C "$AR_COMPS/esp32-camera" fetch origin && \
26+
git -C "$AR_COMPS/esp32-camera" pull origin master
1727
fi
28+
if [ $? -ne 0 ]; then exit 1; fi
1829

19-
cd "$AR_ROOT"
20-
21-
for component in `ls components`; do
22-
cd "$AR_COMPS/$component"
23-
if [ -d ".git" ]; then
24-
git fetch origin && git pull origin master
25-
fi
26-
done
30+
#
31+
# CLONE/UPDATE ESP-FACE
32+
#
2733

28-
cd "$AR_COMPS/arduino"
29-
git submodule update --init --recursive
30-
cd "$AR_ROOT"
34+
if [ ! -d "$AR_COMPS/esp-face" ]; then
35+
git clone $FACE_REPO_URL "$AR_COMPS/esp-face"
36+
else
37+
git -C "$AR_COMPS/esp-face" fetch origin && \
38+
git -C "$AR_COMPS/esp-face" pull origin master
39+
fi
40+
if [ $? -ne 0 ]; then exit 1; fi

0 commit comments

Comments
 (0)