Commit 9fd3e49a authored by norvell's avatar norvell
Browse files

Add simplified build script build-codec.sh

parent 6a68e269
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -285,7 +285,8 @@ workflow:
    - if [ "$DELTA_ODG" = "true" ]; then comp_args="${comp_args} --odg_bin"; MEASURES_FOR_REPORT="$MEASURES_FOR_REPORT DELTA_ODG"; fi
    - if [ "$SPLIT_COMPARISON" = "true" ]; then comp_args="${comp_args} --split-comparison"; fi

    - bash "${CI_PROJECT_DIR}"/ivas-codec-ci/snippets/basop/build-and-create-float-ref-outputs.sh
    - bash "${CI_PROJECT_DIR}"/ivas-codec-ci/snippets/basop/build-codec.sh ivas-float-update _ref
    - bash "${CI_PROJECT_DIR}"/ivas-codec-ci/snippets/basop/build-codec.sh HEAD

    # DMX comparison only in manual job with no other metrics
    - if [ "$COMPARE_DMX" = "true" ]; then
+52 −0
Original line number Diff line number Diff line
#! /bin/bash

# Usage: build-codec.sh <commit> [<suffix>]
# 
# Checks out <commit>, builds executables, optionally appends <suffix> and returns to current branch

set -euxo pipefail

cd "${CI_PROJECT_DIR}"

commit=$1
if [ $# -eq 2 ]; then
  suffix=$2
  suffix_msg="suffix $2"
else
  suffix=""
  suffix_msg="no suffix"
fi

echo "Building binaries from commit $ref_to_check_out with $suffix_msg"

current_commit_sha="$(git rev-parse HEAD)"

restore_stash() {
  if [[ "$(git stash list)" != "" ]]; then
    git stash pop
  fi
}
trap restore_stash EXIT

# store potential changes
# should never fail, even if there is nothing to be stored
git stash

git checkout "$commit"

bash "${CI_PROJECT_DIR}"/ivas-codec-ci/snippets/basop/activate-debug-mode-info-if-set.sh

make clean
make -j "$(nproc)"

# avoid errors in mv when renaming to same file
if [ -n $suffix ]; then
  mv IVAS_cod IVAS_cod"$suffix"
  mv IVAS_dec IVAS_dec"$suffix" 
  mv IVAS_rend IVAS_rend"$suffix"
  if [ -f ISAR_post_rend ]; then mv ISAR_post_rend ISAR_post_rend"$suffix"; fi
fi
# return to current branch
git restore .
git rev-parse HEAD >"$commit_file"
git checkout "$current_commit_sha"