Commit 0040f992 authored by Jan Kiene's avatar Jan Kiene
Browse files

restructure validation jobs

parent eae986c5
Loading
Loading
Loading
Loading
+32 −10
Original line number Diff line number Diff line
@@ -38,10 +38,11 @@ workflow:
stages:
  - .pre
  - maintenance
  - prevalidate
  - build
  - test
  - compare
  - validate
  - postvalidate
  - deploy

# ---------------------------------------------------------------
@@ -133,6 +134,14 @@ stages:
  - sed -i.bak -e "s/\/\*[[:space:]]*\(#define[[:space:]]*SPLIT_REND_WITH_HEAD_ROT\)[[:space:]]*\*\//\1/g" ./lib_com/options.h
  - sed -i.bak -e "s/\/\/[[:space:]]*\(#define[[:space:]]*SPLIT_REND_WITH_HEAD_ROT\)/\1/g"        ./lib_com/options.h

.get-commits-behind-count: &get-commits-behind-count
  - echo $CI_COMMIT_SHA
  - echo $CI_MERGE_REQUEST_TARGET_BRANCH_NAME
  - commits_behind_count=$(git rev-list --count $CI_COMMIT_SHA..origin/$CI_MERGE_REQUEST_TARGET_BRANCH_NAME)

.check-commits-behind-count-in-compare-jobs: &check-commits-behind-count-in-compare-jobs
  - if [ $commits_behind_count -ne 0 ]; then echo "Your branch is not up-to-date with main -> Compare tests will not run as they can contain false negatives this way.\nMain might have changed during your pipeline run. Run `git pull origin/main` to update."; exit 1; fi;

# ---------------------------------------------------------------
# Job templates
# ---------------------------------------------------------------
@@ -179,11 +188,13 @@ stages:
.build-job-linux:
  stage: build
  timeout: "4 minutes"
  needs: []
  tags:
    - ivas-linux

.build-job-windows:
  stage: build
  needs: []
  timeout: "4 minutes"
  tags:
    - ivas-windows
@@ -236,19 +247,28 @@ uninterruptible:
# Validation jobs
# ---------------------------------------------------------------

check-if-branch-is-up-to-date-with-main:
branch-is-up-to-date-with-main-pre:
  extends:
    - .rules-merge-request
  stage: validate
  stage: prevalidate
  needs: []
  tags:
    - ivas-linux
  script:
    - echo $CI_COMMIT_SHA
    - echo $CI_MERGE_REQUEST_TARGET_BRANCH_NAME
    - commits_behind_count=$(git rev-list --count $CI_COMMIT_SHA..origin/$CI_MERGE_REQUEST_TARGET_BRANCH_NAME)
    - *get-commits-behind-count
    - echo $commits_behind_count
    - if [ $commits_behind_count -eq 0 ]; then exit 0; else exit 1; fi;
    - if [ $commits_behind_count -eq 0 ]; then exit 0; else echo "Your branch is behind main, run `git pull origin/main` to update."; exit 1; fi;

branch-is-up-to-date-with-main-post:
  extends:
    - .rules-merge-request
  stage: postvalidate
  tags:
    - ivas-linux
  script:
    - *get-commits-behind-count
    - echo $commits_behind_count
    - if [ $commits_behind_count -eq 0 ]; then exit 0; else echo "Your branch is behind main, possibly main changed during your pipeline run, run `git pull origin/main` to update." exit 1; fi;

# ---------------------------------------------------------------
# Build jobs
@@ -530,6 +550,8 @@ renderer-pytest-on-merge-request:
  stage: compare
  script:
    - *print-common-info
    - *get-commits-behind-count
    -

    # some helper variables - "|| true" to prevent failures from grep not finding anything
    # write to temporary file as workaround for failures observed with piping echo
@@ -783,7 +805,7 @@ clang-format-check:
    - .rules-merge-request
  variables:
    ARTIFACT_BASE_NAME: "mr-$CI_MERGE_REQUEST_IID--sha-$CI_COMMIT_SHORT_SHA--formatting-fix"
  stage: validate
  stage: prevalidate
  needs: []
  timeout: "5 minutes"
  script:
@@ -830,7 +852,7 @@ check-first-frame-is-sid:
  tags:
    - ivas-linux
  stage: test
  # needs: ["build-codec-linux-cmake"]
  needs: ["build-codec-linux-cmake"]
  script:
    - *print-common-info
    - *update-ltv-repo
@@ -861,7 +883,7 @@ lc3plus-ensure-no-code-changes:
  extends:
    - .test-job-linux
    - .rules-merge-request
  stage: validate
  stage: postvalidate
  needs: []
  timeout: "5 minutes"
  script: