From 9a2d2114aa62eaf14425137fb2e5ea92a06ef204 Mon Sep 17 00:00:00 2001 From: Dmitry Rodionov <d.rodionov@picodata.io> Date: Wed, 10 Jul 2024 16:50:48 +0300 Subject: [PATCH] ci: separate lint from test, unify CARGO_HOME Close: https://git.picodata.io/picodata/picodata/picodata/-/issues/357 --- .gitlab-ci.yml | 52 ++++++++++++++++++++++++++++++++++++++++---------- 1 file changed, 42 insertions(+), 10 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index bca9f56bad..e5e2f05836 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -24,7 +24,7 @@ variables: BASE_IMAGE: ${REGISTRY}/picodata-build-base BASE_IMAGE_LATEST: latest MAIN_BRANCH: &main-branch master - CARGO_HOME: /data/shared-storage/picodata/.cargo + CARGO_HOME: $CI_PROJECT_DIR/.cargo KANIKO_REGISTRY_MIRROR: docker-proxy.binary.picodata.io FF_USE_FASTZIP: "true" CACHE_COMPRESSION_LEVEL: "fastest" @@ -140,6 +140,13 @@ build-base-image: matrix: - BUILD_PROFILE: [release, dev] +.pipenv-install: + &pipenv-install | + # Pipenv install + ci-log-section start "pipenv-install" Installing pip dependencies ... + PIPENV_VENV_IN_PROJECT=1 PIP_NO_CACHE_DIR=true python3.10 -m pipenv install --deploy + ci-log-section end "pipenv-install" + test-linux: extends: - .test @@ -159,7 +166,6 @@ test-linux: pull_policy: if-not-present variables: GIT_DEPTH: 1 - CARGO_HOME: $CI_PROJECT_DIR/.cargo cache: - <<: *py_cache - <<: *base_cache @@ -189,11 +195,7 @@ test-linux: - cargo -V - - &pipenv-install | - # Pipenv install - ci-log-section start "pipenv-install" Installing pip dependencies ... - PIPENV_VENV_IN_PROJECT=1 PIP_NO_CACHE_DIR=true python3.10 -m pipenv install --deploy - ci-log-section end "pipenv-install" + - *pipenv-install # There are no Rust tests for `webui` feature, it's checked in pytest - cargo build --timings --locked --profile=$BUILD_PROFILE @@ -211,8 +213,6 @@ test-linux: --junitxml=junit_pytest.xml --with-webui - - make lint - artifacts: when: always paths: @@ -221,6 +221,38 @@ test-linux: reports: junit: junit_pytest.xml +lint: + stage: test + interruptible: true + rules: + - <<: *if-build-base-changes-on-master-branch + variables: + BASE_IMAGE_TAG: ${BASE_IMAGE_LATEST} + - <<: *if-build-base-changes-on-dev-branch + variables: + BASE_IMAGE_TAG: ${CI_COMMIT_SHA} + - <<: *else + variables: + BASE_IMAGE_TAG: ${BASE_IMAGE_LATEST} + image: + name: ${BASE_IMAGE}:${BASE_IMAGE_TAG} + pull_policy: if-not-present + variables: + GIT_DEPTH: 1 + GIT_SUBMODULE_STRATEGY: recursive + cache: + - <<: *py_cache + policy: pull + - <<: *base_cache + policy: pull + - <<: *base_node + policy: pull + script: + - *fetch-tags + - *pipenv-install + - make lint + - cd webui && yarn lint + .test-patch-rules: &test-patch-rules rules: - <<: *if-build-base-changes-on-master-branch @@ -255,7 +287,6 @@ test-patch-picodata: variables: GIT_DEPTH: 1 GIT_SUBMODULE_STRATEGY: recursive - CARGO_HOME: $CI_PROJECT_DIR/.cargo image: name: ${BASE_IMAGE}:${BASE_IMAGE_LATEST} pull_policy: always @@ -297,6 +328,7 @@ test-mac-m1: tags: - mac-dev-m1 script: + # Gitlab doesnt know about $HOME. If specified in variables it becomes empty - export CARGO_HOME=$HOME/.cargo - cargo -V - cargo build --locked -- GitLab