From 0ba9dcb38654a8363732c558a0310df7bd032ab1 Mon Sep 17 00:00:00 2001 From: Bob Evans Date: Thu, 4 May 2023 14:36:52 -0400 Subject: [PATCH] refactor(run-versioned-tests.sh): added ability to run versioned tests and skip collecting coverage by passing in `C8` env var to the job. * Updates `.c8rc.json` to remove redundant html reporter as lcov does both lcov and html. --- .c8rc.json | 5 +++-- .github/workflows/versioned-coverage.yml | 1 + bin/run-versioned-tests.sh | 23 +++++++++++++++++------ 3 files changed, 21 insertions(+), 8 deletions(-) diff --git a/.c8rc.json b/.c8rc.json index 600995c4f0..700ba627ec 100644 --- a/.c8rc.json +++ b/.c8rc.json @@ -1,4 +1,5 @@ { - "reporter": ["html", "lcov"], - "exclude": ["test/*", "*.mjs", "**/*.mjs"] + "reporter": ["lcov"], + "exclude": ["test/*", "*.mjs", "**/*.mjs"], + "clean": true } diff --git a/.github/workflows/versioned-coverage.yml b/.github/workflows/versioned-coverage.yml index 444d5643fe..a84c483405 100644 --- a/.github/workflows/versioned-coverage.yml +++ b/.github/workflows/versioned-coverage.yml @@ -34,6 +34,7 @@ jobs: env: VERSIONED_MODE: --major JOBS: 4 # 2 per CPU seems to be the sweet spot in GHA (July 2022) + C8: skip versioned: runs-on: ubuntu-latest diff --git a/bin/run-versioned-tests.sh b/bin/run-versioned-tests.sh index 654e4c6d99..35448b820a 100755 --- a/bin/run-versioned-tests.sh +++ b/bin/run-versioned-tests.sh @@ -33,14 +33,24 @@ else ) fi -# C8 runs out of heap when running against -# patch/minor flag. We will just skip it -# and figure out another way to get coverage -# when running on main branch. -if [[ $VERSIONED_MODE == '--major' ]]; +# When C8 is set as an env var the intention is to +# run versioned tests without coverage. +if [[ -z "$C8" ]]; then - C8="c8 -o ./coverage/versioned" + # C8 runs out of heap when running against + # patch/minor flag. We will just skip it + # and figure out another way to get coverage + # when running on main branch. + if [[ $VERSIONED_MODE == '--major' ]]; + then + # lcovonly only generates lcov report which will cut down on amount of time generating reports + C8="c8 -o ./coverage/versioned -r lcovonly" + else + C8="" + fi else + # C8 was pass in as an env var which is intended to skip + # running versioned tests with c8 C8="" fi @@ -50,6 +60,7 @@ export AGENT_PATH=`pwd` echo "JOBS = ${JOBS}" echo "NPM7 = ${NPM7}" echo "CONTEXT MANAGER = ${CTX_MGR}" +echo "C8 = ${C8}" # if $JOBS is not empy if [ ! -z "$JOBS" ];