Skip to content

Commit 1f0d4b5

Browse files
ci(gitlab): Initial GitLab setup (#11577)
* ci(gitlab): Initial GitLab setup * fix(version): Add to version update script * ci(pre-commit): Apply automatic fixes --------- Co-authored-by: pre-commit-ci-lite[bot] <117423508+pre-commit-ci-lite[bot]@users.noreply.github.com>
1 parent 0a45a06 commit 1f0d4b5

File tree

5 files changed

+63
-0
lines changed

5 files changed

+63
-0
lines changed

.github/CODEOWNERS

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111

1212
# CI
1313
/.github/ @lucasssvaz @me-no-dev @P-R-O-C-H-Y
14+
/.gitlab/ @lucasssvaz
1415
/tests/ @lucasssvaz @P-R-O-C-H-Y
1516

1617
# Tools

.github/scripts/update-version.sh

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,11 @@ cat docs/conf_common.py | \
4545
sed "s/.. |version| replace:: .*/.. |version| replace:: $ESP_ARDUINO_VERSION/g" | \
4646
sed "s/.. |idf_version| replace:: .*/.. |idf_version| replace:: $ESP_IDF_VERSION/g" > docs/__conf_common.py && mv docs/__conf_common.py docs/conf_common.py
4747

48+
echo "Updating .gitlab/workflows/common.yml..."
49+
cat .gitlab/workflows/common.yml | \
50+
sed "s/ESP_IDF_VERSION:.*/ESP_IDF_VERSION: \"$ESP_IDF_VERSION\"/g" | \
51+
sed "s/ESP_ARDUINO_VERSION:.*/ESP_ARDUINO_VERSION: \"$ESP_ARDUINO_VERSION\"/g" > .gitlab/workflows/__common.yml && mv .gitlab/workflows/__common.yml .gitlab/workflows/common.yml
52+
4853
echo "Updating cores/esp32/esp_arduino_version.h..."
4954
cat cores/esp32/esp_arduino_version.h | \
5055
sed "s/#define ESP_ARDUINO_VERSION_MAJOR.*/#define ESP_ARDUINO_VERSION_MAJOR $ESP_ARDUINO_VERSION_MAJOR/g" | \

.gitlab-ci.yml

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
workflow:
2+
rules:
3+
# Disable those non-protected push triggered pipelines
4+
- if: '$CI_COMMIT_REF_NAME != "master" && $CI_COMMIT_BRANCH !~ /^release\/v/ && $CI_COMMIT_TAG !~ /^\d+\.\d+(\.\d+)?($|-)/ && $CI_PIPELINE_SOURCE == "push"'
5+
when: never
6+
# when running merged result pipelines, CI_COMMIT_SHA represents the temp commit it created.
7+
# Please use PIPELINE_COMMIT_SHA at all places that require a commit sha of the original commit.
8+
- if: $CI_OPEN_MERGE_REQUESTS != null
9+
variables:
10+
PIPELINE_COMMIT_SHA: $CI_MERGE_REQUEST_SOURCE_BRANCH_SHA
11+
IS_MR_PIPELINE: 1
12+
- if: $CI_OPEN_MERGE_REQUESTS == null
13+
variables:
14+
PIPELINE_COMMIT_SHA: $CI_COMMIT_SHA
15+
IS_MR_PIPELINE: 0
16+
- if: '$CI_PIPELINE_SOURCE == "schedule"'
17+
variables:
18+
IS_SCHEDULED_RUN: "true"
19+
- when: always
20+
21+
# Place the default settings in `.gitlab/workflows/common.yml` instead
22+
23+
include:
24+
- ".gitlab/workflows/common.yml"
25+
- ".gitlab/workflows/sample.yml"

.gitlab/workflows/common.yml

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
#####################
2+
# Default Variables #
3+
#####################
4+
5+
stages:
6+
- pre_check
7+
- build
8+
- test
9+
- result
10+
11+
variables:
12+
ESP_IDF_VERSION: "5.4"
13+
ESP_ARDUINO_VERSION: "3.2.1"
14+
15+
#############
16+
# `default` #
17+
#############
18+
19+
default:
20+
retry:
21+
max: 2
22+
when:
23+
# In case of a runner failure we could hop to another one, or a network error could go away.
24+
- runner_system_failure
25+
# Job execution timeout may be caused by a network issue.
26+
- job_execution_timeout

.gitlab/workflows/sample.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
hello-world:
2+
stage: test
3+
script:
4+
- echo "Hello, World from GitLab CI!"
5+
rules:
6+
- if: $CI_PIPELINE_SOURCE == "push"

0 commit comments

Comments
 (0)