#!/bin/bash

set -e

source "$(dirname "$0")/utils.sh"

section_start "install-deps" "Installing required dependencies"
bundle_install_script
yarn_install_script
section_end "install-deps"

section_start "assets-compile" "Compiling frontend assets"

# Upstream would check the cache file at "${GLCI_GITLAB_ASSETS_HASH_FILE}",
# (variable itself computed by a previous job and stransmitted via a dotenv
# artifact... Heptapod cache structure is vastly different (we are using
# an archive on upload.h.n), so we removed it entirely.
if [[ -z "${SKIP_INFECTION_SCANNER}" ]]; then
  node scripts/frontend/infection_scanner/infection_scanner.mjs
fi
bin/rake gitlab:assets:compile

section_end "assets-compile"
