Skip to content

Commit

Permalink
refactor(run-versioned-tests.sh): added ability to run versioned test…
Browse files Browse the repository at this point in the history
…s 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.
  • Loading branch information
bizob2828 committed May 8, 2023
1 parent e271eee commit 0ba9dcb
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 8 deletions.
5 changes: 3 additions & 2 deletions .c8rc.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
{
"reporter": ["html", "lcov"],
"exclude": ["test/*", "*.mjs", "**/*.mjs"]
"reporter": ["lcov"],
"exclude": ["test/*", "*.mjs", "**/*.mjs"],
"clean": true
}
1 change: 1 addition & 0 deletions .github/workflows/versioned-coverage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
23 changes: 17 additions & 6 deletions bin/run-versioned-tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -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" ];
Expand Down

0 comments on commit 0ba9dcb

Please sign in to comment.