diff --git a/.github/actions/determineNodeVersions/action.yml b/.github/actions/determineNodeVersions/action.yml index d82a81d..7177815 100644 --- a/.github/actions/determineNodeVersions/action.yml +++ b/.github/actions/determineNodeVersions/action.yml @@ -8,6 +8,9 @@ inputs: nodeDisableCurrent: description: Disable testing on Node "current" required: false + nodeDisablePrevious: + description: Disable testing on Node "-1" + required: false outputs: nodeVersions: @@ -41,16 +44,29 @@ runs: id: node-versions run: | # Current can be disabled by setting the "nodeDisableCurrent" input to "true" + # Previous LTS can be disabled by setting the "nodeDisablePrevious" input to "true" # IF "NODE_VERSION" is overridden, "NODE_VERSION_CURRENT" will also be disabled + NODE_VERSION_CURRENT="current" - NODE_VERSION="${INPUTS_NODE_VERSION_OVERRIDE:-lts/*}" - NODE_PREVIOUS_LTS="lts/-1" + if [ "$INPUTS_NODE_DISABLE_CURRENT" = "true" ] || [ -n "$INPUTS_NODE_VERSION_OVERRIDE" ]; then + NODE_VERSION_CURRENT="" + fi + NODE_VERSION="lts/*" if [ -n "$INPUTS_NODE_VERSION_OVERRIDE" ]; then + NODE_VERSION="$INPUTS_NODE_VERSION_OVERRIDE" + fi + + NODE_PREVIOUS_LTS="lts/-1" + if [ "$INPUTS_NODE_DISABLE_PREVIOUS" = "true" ]; then + NODE_PREVIOUS_LTS="" + fi + + if [ -n "$INPUTS_NODE_VERSION_OVERRIDE" ] && [ "$INPUTS_NODE_DISABLE_PREVIOUS" != "true" ] ; then NODE_VERSION_MAJOR=$(echo "$INPUTS_NODE_VERSION_OVERRIDE" | cut -d '.' -f 1) # LTS-1 will always be the previous LTS, which is always even. Here we calculate the nearest LTS - if [ $((NODE_VERSION_MAJOR % 2)) == 0 ]; then + if [ $((NODE_VERSION_MAJOR % 2)) = 0 ]; then NODE_PREVIOUS_LTS="$((NODE_VERSION_MAJOR - 2))" else NODE_PREVIOUS_LTS="$((NODE_VERSION_MAJOR - 1))" @@ -59,13 +75,10 @@ runs: { echo "nodeVersions<> "$GITHUB_OUTPUT" env: INPUTS_NODE_VERSION_OVERRIDE: ${{ inputs.nodeVersionOverride }} INPUTS_NODE_DISABLE_CURRENT: ${{ inputs.nodeDisableCurrent }} + INPUTS_NODE_DISABLE_PREVIOUS: ${{ inputs.nodeDisablePrevious }} diff --git a/.github/workflows/unitTestsLinux.yml b/.github/workflows/unitTestsLinux.yml index 0cbdfa7..8b796fd 100644 --- a/.github/workflows/unitTestsLinux.yml +++ b/.github/workflows/unitTestsLinux.yml @@ -18,6 +18,7 @@ jobs: with: nodeVersionOverride: ${{ vars.NODE_VERSION_OVERRIDE }} # default is 'lts/*' and 'lts/-1' nodeDisableCurrent: ${{ vars.UT_DISABLE_NODE_CURRENT }} # default is falsy + nodeDisablePrevious: ${{ vars.UT_DISABLE_NODE_PREVIOUS }} # default is falsy prevent-typescript-dependency: if: ${{ inputs.skipTsDepCheck == false }} diff --git a/.github/workflows/unitTestsWindows.yml b/.github/workflows/unitTestsWindows.yml index 55c8ee3..fbc0dc9 100644 --- a/.github/workflows/unitTestsWindows.yml +++ b/.github/workflows/unitTestsWindows.yml @@ -12,6 +12,7 @@ jobs: with: nodeVersionOverride: ${{ vars.NODE_VERSION_OVERRIDE }} # default is 'lts/*' and 'lts/-1' nodeDisableCurrent: ${{ vars.UT_DISABLE_NODE_CURRENT }} # default is falsy + nodeDisablePrevious: ${{ vars.UT_DISABLE_NODE_PREVIOUS }} # default is falsy windows-unit-tests: needs: determine-node-versions