ci: update pre_commit jobs

pull/13114/head
Chen Yudong 2024-01-30 21:36:00 +08:00
rodzic bc7e87b416
commit b27cf4d444
6 zmienionych plików z 54 dodań i 18 usunięć

Wyświetl plik

@ -24,6 +24,7 @@ include:
- '.gitlab/ci/upload_cache.yml'
- '.gitlab/ci/docs.yml'
- '.gitlab/ci/static-code-analysis.yml'
- '.gitlab/ci/pre_commit.yml'
- '.gitlab/ci/pre_check.yml'
- '.gitlab/ci/build.yml'
- '.gitlab/ci/integration_test.yml'

Wyświetl plik

@ -103,6 +103,7 @@ fast_template_app:
- .build_template_app_template
- .rules:build:target_test
stage: pre_check
tags: [fast_run, shiny]
variables:
BUILD_COMMAND_ARGS: "-p"
#------------------------------------------------------------------------------
@ -284,6 +285,7 @@ build_template_app:
generate_build_child_pipeline:
extends:
- .build_template
tags: [fast_run, shiny]
dependencies: # set dependencies to null to avoid missing artifacts issue
needs:
- pipeline_variables

Wyświetl plik

@ -34,8 +34,7 @@ gen_integration_pipeline:
image: ${CI_INTEGRATION_ASSIGN_ENV}
stage: assign_test
cache: []
tags:
- assign_test
tags: [fast_run, shiny]
variables:
SUBMODULES_TO_FETCH: "none"
GIT_LFS_SKIP_SMUDGE: 1

Wyświetl plik

@ -5,18 +5,6 @@
- host_test
dependencies: # set dependencies to null to avoid missing artifacts issue
check_pre_commit:
extends:
- .pre_check_template
- .before_script:minimal
image: $PRE_COMMIT_IMAGE
needs:
- pipeline_variables
script:
- fetch_submodules
- pre-commit run --files $MODIFIED_FILES
- pre-commit run --hook-stage post-commit validate-sbom-manifest
check_version:
# Don't run this for feature/bugfix branches, so that it is possible to modify
# esp_idf_version.h in a branch before tagging the next version.
@ -142,8 +130,7 @@ pipeline_variables:
extends:
- .pre_check_template
- .before_script:fetch:git_diff
tags:
- build
tags: [fast_run, shiny]
script:
# MODIFIED_FILES is a list of files that changed, could be used everywhere
- MODIFIED_FILES=$(echo "$GIT_DIFF_OUTPUT" | xargs)
@ -174,5 +161,6 @@ pipeline_variables:
check_test_cases_env_markers_and_required_runners:
extends:
- .pre_check_template
tags: [fast_run, shiny]
script:
- python tools/ci/dynamic_pipelines/scripts/generate_target_test_child_pipeline.py --check

Wyświetl plik

@ -0,0 +1,47 @@
.check_pre_commit_template:
extends:
- .before_script:minimal
stage: pre_check
image: $PRE_COMMIT_IMAGE
tags: [cache, shiny]
needs:
- pipeline_variables
variables:
# cache pre_commit
PRE_COMMIT_HOME: "$CI_PROJECT_DIR/.cache/pre-commit"
script:
- fetch_submodules
- pre-commit run --files $MODIFIED_FILES
- pre-commit run --hook-stage post-commit validate-sbom-manifest
check_pre_commit_upload_cache:
extends:
- .check_pre_commit_template
rules:
- if: '($CI_COMMIT_REF_NAME == "master" || $CI_COMMIT_BRANCH =~ /^release\/v/) && $CI_PIPELINE_SOURCE == "push"'
cache:
- key: pre_commit-cache-${LATEST_GIT_TAG}
paths:
- .cache/pre-commit
policy: pull-push
- key: submodule-cache-${LATEST_GIT_TAG}
paths:
- .cache/submodule_archives
policy: pull
check_pre_commit:
extends:
- .check_pre_commit_template
rules:
- if: '($CI_COMMIT_REF_NAME == "master" || $CI_COMMIT_BRANCH =~ /^release\/v/) && $CI_PIPELINE_SOURCE == "push"'
when: never
- when: on_success
cache:
- key: pre_commit-cache-${LATEST_GIT_TAG}
paths:
- .cache/pre-commit
policy: pull
- key: submodule-cache-${LATEST_GIT_TAG}
paths:
- .cache/submodule_archives
policy: pull

Wyświetl plik

@ -1,6 +1,5 @@
# SPDX-FileCopyrightText: 2024 Espressif Systems (Shanghai) CO LTD
# SPDX-License-Identifier: Apache-2.0
import inspect
import typing as t
from dataclasses import dataclass
@ -83,7 +82,7 @@ class EmptyJob(Job):
) -> None:
super().__init__(
name=name or 'fake_pass_job',
tags=tags or ['build', 'shiny'],
tags=tags or ['fast_run', 'shiny'],
stage=stage or 'build',
script=['echo "This is a fake job to pass the pipeline"'],
before_script=before_script or [],