This repository has been archived by the owner on Oct 27, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 151
/
Copy path.gitlab-ci.yml
113 lines (105 loc) · 3.64 KB
/
.gitlab-ci.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
stages:
- build
- deploy
variables:
BATCH_BUILD: "1"
V: "0"
MAKEFLAGS: "-j5 --no-keep-going"
IDF_CI_BUILD: "1"
build_esp8266_demo_v3.3:
stage: build
image: $CI_DOCKER_REGISTRY/ae-esp8266-ci-env:latest-029382ce
tags:
- build
script:
- export IDF_PATH=~/.espressif/rtos/ESP8266_RTOS_SDK-v3.3
- cd examples/solutions/smart_light
- make chip=esp8266 defconfig
- make
build_esp32_demo_make_v4.2:
stage: build
image: $CI_DOCKER_REGISTRY/ae-esp32-ci-env:latest-3cf42c4c
tags:
- build
script:
- export IDF_PATH=~/.espressif/idf/esp-idf-v4.2
- . $IDF_PATH/export.sh
- cd examples/solutions/smart_light
- make chip=esp32 defconfig
- make
build_esp32_demo_cmake_v4.2:
stage: build
image: $CI_DOCKER_REGISTRY/ae-esp32-ci-env:latest-3cf42c4c
tags:
- build
script:
- export IDF_PATH=~/.espressif/idf/esp-idf-v4.2
- . $IDF_PATH/export.sh
- cd examples/solutions/smart_light
- idf.py build
build_esp32s2_demo_cmake_v4.2:
stage: build
image: $CI_DOCKER_REGISTRY/ae-esp32-ci-env:latest-3cf42c4c
tags:
- build
script:
- export IDF_PATH=~/.espressif/idf/esp-idf-v4.2
- . $IDF_PATH/export.sh
- cd examples/solutions/smart_light
- idf.py set-target esp32s2
- idf.py build
build_esp32s3_demo_cmake_master:
stage: build
image: $CI_DOCKER_REGISTRY/esp-env:v4.4-1
tags:
- build
script:
# add gitlab ssh key
- mkdir -p ~/.ssh
- chmod 700 ~/.ssh
- echo -n $GITLAB_KEY > ~/.ssh/id_rsa_base64
- base64 --decode --ignore-garbage ~/.ssh/id_rsa_base64 > ~/.ssh/id_rsa
- chmod 600 ~/.ssh/id_rsa
- echo -e "Host gitlab.espressif.cn\n\tStrictHostKeyChecking no\n" >> ~/.ssh/config
- git --version
- git clone --recursive -b v4.3.1 --depth 1 $GITLAB_SSH_SERVER/idf/esp-idf.git
- export IDF_PATH=$CI_PROJECT_DIR/esp-idf
- cd esp-idf/
- git checkout ${CI_COMMIT_REF_NAME} || echo "Using esp-idf default branch..."
- source tools/ci/configure_ci_environment.sh
- source tools/ci/setup_python.sh
# setup correct toolchain
- tools/idf_tools.py --non-interactive install && eval "$(tools/idf_tools.py --non-interactive export)" || exit 1
- cd -
- cd examples/solutions/smart_light
- idf.py --preview set-target esp32s3
- idf.py build
push_to_github:
stage: deploy
only:
- master
- /^release\/v/
- /^v\d+\.\d+(\.\d+)?($|-)/
# when: on_success
image: espressif/esp32-ci-env
tags:
- deploy
variables:
GIT_STRATEGY: clone
GITHUB_PUSH_REFS: refs/remotes/origin/release refs/remotes/origin/master
script:
- mkdir -p ~/.ssh
- chmod 700 ~/.ssh
- echo -n $GH_PUSH_KEY >> ~/.ssh/id_rsa_base64
- base64 --decode --ignore-garbage ~/.ssh/id_rsa_base64 > ~/.ssh/id_rsa
- chmod 600 ~/.ssh/id_rsa
- echo -e "Host github.com\n\tStrictHostKeyChecking no\n" >> ~/.ssh/config
- git remote add github [email protected]:espressif/esp-aliyun.git
# What the next line of script does: goes through the list of refs for all branches we push to github,
# generates a snippet of shell which is evaluated. The snippet checks CI_BUILD_REF against the SHA
# (aka objectname) at tip of each branch, and if any SHAs match then it checks out the local branch
# and then pushes that ref to a corresponding github branch
#
# NB: In gitlab 9.x, CI_BUILD_REF was deprecated. New name is CI_COMMIT_REF. If below command suddenly
# generates bash syntax errors, this is probably why.
- eval $(git for-each-ref --shell bash --format 'if [ $CI_BUILD_REF == %(objectname) ]; then git checkout -B %(refname:strip=3); git push --follow-tags github %(refname:strip=3); fi;' $GITHUB_PUSH_REFS)