esp-idf/components/freemodbus/.gitlab-ci.yml

162 lines
4.4 KiB
YAML
Raw Normal View History

stages:
- build
- deploy
variables:
# System environment
ESP_DOCS_ENV_IMAGE: "$CI_DOCKER_REGISTRY/esp-idf-doc-env-v5.0:2-2"
ESP_DOCS_PATH: "$CI_PROJECT_DIR"
# GitLab-CI environment
GET_SOURCES_ATTEMPTS: "10"
ARTIFACT_DOWNLOAD_ATTEMPTS: "10"
GIT_SUBMODULE_STRATEGY: none
.setup_idf_tools: &setup_idf_tools |
tools/idf_tools.py --non-interactive install && eval "$(tools/idf_tools.py --non-interactive export)" || exit 1
.add_gh_key_remote: &add_gh_key_remote |
command -v ssh-agent >/dev/null || exit 1
eval $(ssh-agent -s)
printf '%s\n' "${GH_PUSH_KEY}" | tr -d '\r' | ssh-add - > /dev/null
mkdir -p ~/.ssh && chmod 700 ~/.ssh
[[ -f /.dockerenv ]] && echo -e "Host *\n\tStrictHostKeyChecking no\n\n" > ~/.ssh/config || ssh-keyscan -t rsa github.com >> ~/.ssh/known_hosts
git remote remove github || true
git remote add github ${GH_PUSH_REPO}
after_script:
# Just for cleaning space, no other causes
- git clean -ffdx
# This template gets expanded multiple times, once for every IDF version.
# IDF version is specified by setting the espressif/idf image tag.
#
# EXAMPLE_TARGETS sets the list of IDF_TARGET values to build examples for.
# It should be equal to the list of targets supported by the specific IDF version.
#
# TEST_TARGETS sets the list of IDF_TARGET values to build the test_app for.
# It should contain only the targets with optimized assembly implementations.
#
.build_template:
stage: build
tags:
- build
- internet
script:
- pip install idf-component-manager --upgrade
- ./build_all.sh
variables:
EXAMPLE_TARGETS: "esp32"
TEST_TARGETS: "esp32"
build_idf_v4.1:
extends: .build_template
image: espressif/idf:release-v4.1
build_idf_v4.2:
extends: .build_template
image: espressif/idf:release-v4.2
variables:
EXAMPLE_TARGETS: "esp32 esp32s2"
build_idf_v4.3:
extends: .build_template
image: espressif/idf:release-v4.3
variables:
EXAMPLE_TARGETS: "esp32 esp32s2 esp32c3"
build_idf_v4.4:
extends: .build_template
image: espressif/idf:release-v4.4
variables:
EXAMPLE_TARGETS: "esp32 esp32s2 esp32s3 esp32c3"
TEST_TARGETS: "esp32 esp32s3"
build_idf_latest:
extends: .build_template
image: espressif/idf:latest
variables:
EXAMPLE_TARGETS: "esp32 esp32s2 esp32s3 esp32c3"
TEST_TARGETS: "esp32 esp32s3"
# GNU Make based build system is not supported starting from IDF v5.0
SKIP_GNU_MAKE_BUILD: 1
build_docs:
stage: build
image: $ESP_DOCS_ENV_IMAGE
tags:
- build_docs
artifacts:
when: always
paths:
- docs/_build/*/*/*.txt
- docs/_build/*/*/html/*
expire_in: 4 days
# No cleaning when the artifacts
after_script: []
script:
- cd docs
- pip install -r requirements.txt
- build-docs -l en -t esp32
.deploy_docs_template:
stage: deploy
image: $ESP_DOCS_ENV_IMAGE
tags:
- deploy_docs
needs:
- build_docs
only:
changes:
- "docs/**/*"
script:
- source ${CI_PROJECT_DIR}/docs/utils.sh
- add_doc_server_ssh_keys $DOCS_DEPLOY_PRIVATEKEY $DOCS_DEPLOY_SERVER $DOCS_DEPLOY_SERVER_USER
- export GIT_VER=$(git describe --always)
- pip install -r ${CI_PROJECT_DIR}/docs/requirements.txt
- deploy-docs
deploy_docs_preview:
extends:
- .deploy_docs_template
except:
refs:
- master
variables:
TYPE: "preview"
DOCS_BUILD_DIR: "${CI_PROJECT_DIR}/docs/_build/"
DOCS_DEPLOY_PRIVATEKEY: "$DOCS_DEPLOY_KEY"
DOCS_DEPLOY_SERVER: "$DOCS_SERVER"
DOCS_DEPLOY_SERVER_USER: "$DOCS_SERVER_USER"
DOCS_DEPLOY_PATH: "$DOCS_PATH"
DOCS_DEPLOY_URL_BASE: "https://$DOCS_PREVIEW_SERVER_URL/docs/esp-modbus"
deploy_docs_production:
extends:
- .deploy_docs_template
only:
refs:
- master
variables:
TYPE: "production"
DOCS_BUILD_DIR: "${CI_PROJECT_DIR}/docs/_build/"
DOCS_DEPLOY_PRIVATEKEY: "$DOCS_PROD_DEPLOY_KEY"
DOCS_DEPLOY_SERVER: "$DOCS_PROD_SERVER"
DOCS_DEPLOY_SERVER_USER: "$DOCS_PROD_SERVER_USER"
DOCS_DEPLOY_PATH: "$DOCS_PROD_PATH"
DOCS_DEPLOY_URL_BASE: "https://docs.espressif.com/projects/esp-modbus"
upload_to_component_manager:
stage: deploy
image: python:3.10-alpine
tags:
- deploy
rules:
- if: '$CI_COMMIT_BRANCH == "master"'
- if: '$FORCE_PUSH_COMPONENT == "1"'
script:
- pip install idf-component-manager
- export IDF_COMPONENT_API_TOKEN=${ESP_MODBUS_API_KEY}
- python -m idf_component_manager upload-component --allow-existing --name=esp-modbus --namespace=espressif