-
Notifications
You must be signed in to change notification settings - Fork 65
/
test.sh
executable file
·52 lines (48 loc) · 1.7 KB
/
test.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
#!/bin/bash
set -euo pipefail
JOB_TYPE=${JOB_TYPE:-"local"}
REPO_ROOT=$(git rev-parse --show-toplevel)
CI_SERVER_URL=https://prow.svc.ci.openshift.org/view/gcs/origin-ci-test
if [ ! -d node_modules ]; then
yarn install
fi
GIT_BRANCH=${GIT_BRANCH:-}
export IS_PR=${IS_PR:-false}
ENV_BRANCH=$(sed "s/origin\///" <<< "$GIT_BRANCH")
if [[ "${ENV_BRANCH}" = "master" || "${ENV_BRANCH}" = "main" ]]; then
BETA=true
fi
if [[ "${JOB_TYPE}" == "presubmit" ]]; then
echo "detected PR code coverage job for #${PULL_NUMBER}"
REF_FLAGS="-P ${PULL_NUMBER} -C ${PULL_PULL_SHA}"
JOB_LINK="${CI_SERVER_URL}/pr-logs/pull/${REPO_OWNER}_${REPO_NAME}/${PULL_NUMBER}/${JOB_NAME}/${BUILD_ID}"
elif [[ "${JOB_TYPE}" == "postsubmit" || "${JOB_TYPE}" == "periodic" ]]; then
#echo "detected branch code coverage job for ${PULL_BASE_REF}"
#REF_FLAGS="-B ${PULL_BASE_REF} -C ${PULL_BASE_SHA}"
REF_FLAGS=""
REPO_OWNER="openshift"
REPO_NAME="hac-dev"
JOB_LINK="${CI_SERVER_URL}/logs/${JOB_NAME}/${BUILD_ID}"
else
echo "Coverage not enabled on Job Type :${JOB_TYPE}"
# let's turn on universal build
if [ "$IS_PR" == true ]; then
yarn verify
else
export BETA=false
yarn verify
mv dist stable
export BETA=true
yarn build
mv dist preview
mkdir -p dist
mv stable dist/stable
mv preview dist/preview
fi
fi
if [[ "${JOB_TYPE}" != "local" ]]; then
curl -Os https://uploader.codecov.io/latest/linux/codecov
chmod +x codecov
yarn verify
./codecov -t ${CODECOV_TOKEN} -r "${REPO_OWNER}/${REPO_NAME}" ${REF_FLAGS} --dir ./coverage
fi