mirror of
https://github.com/espressif/esp-idf.git
synced 2024-10-05 20:47:46 -04:00
ci: Swap github/gitlab submodules for release branches & tags also
This commit is contained in:
parent
099b5552c4
commit
818d1de771
@ -14,10 +14,11 @@ before_script:
|
|||||||
- chmod 600 ~/.ssh/id_rsa
|
- chmod 600 ~/.ssh/id_rsa
|
||||||
- echo -e "Host gitlab.espressif.cn\n\tStrictHostKeyChecking no\n" >> ~/.ssh/config
|
- echo -e "Host gitlab.espressif.cn\n\tStrictHostKeyChecking no\n" >> ~/.ssh/config
|
||||||
|
|
||||||
# if testing master branch, use github wifi and bt libs.
|
# Set IS_PRIVATE or IS_PUBLIC depending on if our branch is public or not
|
||||||
# if testing other branches, use gitlab wifi and bt libs (as maybe changes aren't merged to master yet)
|
#
|
||||||
- test "${CI_BUILD_REF_NAME}" = "master" || sed -i "s%https://github.com/espressif/esp32-wifi-lib%${GITLAB_SSH_SERVER}/idf/esp32-wifi-lib%" .gitmodules
|
# (the same regular expressions are used to set these are used in 'only:' sections below
|
||||||
- test "${CI_BUILD_REF_NAME}" = "master" || sed -i "s%https://github.com/espressif/esp32-bt-lib%${GITLAB_SSH_SERVER}/idf/esp32-bt-lib%" .gitmodules
|
- source make/configure_ci_environment.sh
|
||||||
|
|
||||||
# fetch all submodules
|
# fetch all submodules
|
||||||
- git submodule update --init --recursive
|
- git submodule update --init --recursive
|
||||||
|
|
||||||
@ -134,7 +135,7 @@ build_docs:
|
|||||||
- cd docs
|
- cd docs
|
||||||
- doxygen
|
- doxygen
|
||||||
# If not building master branch, and there are Doxygen warnings, print them and bail out
|
# If not building master branch, and there are Doxygen warnings, print them and bail out
|
||||||
- test "${CI_BUILD_REF_NAME}" = "master" || test $(cat doxygen-warning-log.txt | wc -l) -eq 0 || ( echo "Doxygen pass had some warnings:" && cat doxygen-warning-log.txt && false )
|
- test -n $IS_PRIVATE && test $(cat doxygen-warning-log.txt | wc -l) -eq 0 || ( echo "Doxygen pass had some warnings:" && cat doxygen-warning-log.txt && false )
|
||||||
- make gh-linkcheck
|
- make gh-linkcheck
|
||||||
- make html
|
- make html
|
||||||
artifacts:
|
artifacts:
|
||||||
@ -160,6 +161,7 @@ test_build_system:
|
|||||||
variables:
|
variables:
|
||||||
IDF_PATH: "$CI_PROJECT_DIR"
|
IDF_PATH: "$CI_PROJECT_DIR"
|
||||||
script:
|
script:
|
||||||
|
- ./make/test_configure_ci_environment.sh
|
||||||
- ./make/test_build_system.sh
|
- ./make/test_build_system.sh
|
||||||
|
|
||||||
test_report:
|
test_report:
|
||||||
|
35
make/configure_ci_environment.sh
Normal file
35
make/configure_ci_environment.sh
Normal file
@ -0,0 +1,35 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
#
|
||||||
|
# Short script that is sourced in to the CI environment
|
||||||
|
# in .gitlab-ci.yml
|
||||||
|
#
|
||||||
|
# Sets IS_PUBLIC and IS_PRIVATE based on branch type
|
||||||
|
#
|
||||||
|
# Tweaks .gitmodules file for private builds
|
||||||
|
|
||||||
|
[ -z $CI_BUILD_REF ] && echo "This internal script should only be run by a Gitlab CI runner." && exit 1
|
||||||
|
|
||||||
|
REF=$CI_BUILD_REF
|
||||||
|
|
||||||
|
# Public branches are:
|
||||||
|
# release branches - start with release/
|
||||||
|
# release tags - look like vXX.YY or vXX.YY.ZZ with an optional dash followed by anything on the end
|
||||||
|
# master branch
|
||||||
|
#
|
||||||
|
# These POSIX REs are equivalent to the REs in some "only:" sections of the gitlab-ci.yml file
|
||||||
|
#
|
||||||
|
if [[ $REF = "master" || $REF =~ ^release/v || $REF =~ ^v[0-9]+\.[0-9]+(\.[0-9]+)?(-|$) ]]; then
|
||||||
|
export IS_PUBLIC=1
|
||||||
|
else
|
||||||
|
export IS_PRIVATE=1
|
||||||
|
fi
|
||||||
|
|
||||||
|
unset REF
|
||||||
|
|
||||||
|
set -e
|
||||||
|
|
||||||
|
if [[ $IS_PRIVATE ]]; then
|
||||||
|
# Redirect git submodules from public github to our private gitlab server
|
||||||
|
sed -i "s%https://github.com/espressif/esp32-wifi-lib%${GITLAB_SSH_SERVER}/idf/esp32-wifi-lib%" .gitmodules
|
||||||
|
sed -i "s%https://github.com/espressif/esp32-bt-lib%${GITLAB_SSH_SERVER}/idf/esp32-bt-lib%" .gitmodules
|
||||||
|
fi
|
34
make/test_configure_ci_environment.sh
Executable file
34
make/test_configure_ci_environment.sh
Executable file
@ -0,0 +1,34 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
#
|
||||||
|
# Short script to verify behaviour of configure_ci_environment.sh
|
||||||
|
#
|
||||||
|
#
|
||||||
|
cd $(dirname $0) # make dir
|
||||||
|
|
||||||
|
touch .gitmodules # dummy file
|
||||||
|
|
||||||
|
# $1 - branch name
|
||||||
|
# $2 - 1 if public, empty if private
|
||||||
|
function assert_branch_public()
|
||||||
|
{
|
||||||
|
(
|
||||||
|
CI_BUILD_REF=$1
|
||||||
|
set -e
|
||||||
|
source ./configure_ci_environment.sh
|
||||||
|
[[ $IS_PUBLIC = $2 ]] || exit 1
|
||||||
|
) || ( echo "Expected $1 public=$2. Failing" && exit 1 )
|
||||||
|
}
|
||||||
|
|
||||||
|
assert_branch_public master 1
|
||||||
|
assert_branch_public release/v3.0 1
|
||||||
|
assert_branch_public release/invalid
|
||||||
|
assert_branch_public bugfix/invalid
|
||||||
|
assert_branch_public v1.0 1
|
||||||
|
assert_branch_public v1.0.0 1
|
||||||
|
assert_branch_public v50.50.50 1
|
||||||
|
assert_branch_public v1.2-rc77 1
|
||||||
|
assert_branch_public v1.2.3-rc1 1
|
||||||
|
assert_branch_public v1.2.3invalid
|
||||||
|
|
||||||
|
rm -f .gitmodules
|
||||||
|
|
Loading…
x
Reference in New Issue
Block a user