Skip to content

Commit

Permalink
Deprecate install-unittesting action input
Browse files Browse the repository at this point in the history
1. Allowing to not install UnitTesting is odd as tests won't run without it.
2. Installing a version which is unrelated with current action revision is
   also odd and confusing. If a certain version is desired for CI, it can be
   selected via `SublimeText/UnitTesting/actions/setup@<revision>`.

The `setup` action always installs the UnitTesting package, which is bundled
with the action's revision, if UnitTesting is not the checked out package or
hasn't been installed as extra-package. That's possible as the action is part
of UnitTesting package. The package doesn't need to be re-downloaded.
  • Loading branch information
deathaxe committed Apr 6, 2024
1 parent 606f7e8 commit 586f763
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 10 deletions.
4 changes: 0 additions & 4 deletions .github/workflows/test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ jobs:
- uses: "./actions/setup"
with:
sublime-text-version: ${{ matrix.st-version }}
install-unittesting: false
- uses: "./actions/run-tests"
with:
coverage: true
Expand Down Expand Up @@ -61,8 +60,6 @@ jobs:
steps:
- uses: actions/checkout@v4
- uses: SublimeText/UnitTesting/actions/setup@v1
with:
install-unittesting: false
- uses: SublimeText/UnitTesting/actions/run-tests@v1

test-as-extra-package:
Expand All @@ -82,7 +79,6 @@ jobs:
- uses: "./UnitTesting/actions/setup"
with:
package-path: UnitTesting-example
install-unittesting: false
extra-packages: |
SublimeText/UnitTesting
- uses: "./UnitTesting/actions/run-tests"
Expand Down
17 changes: 11 additions & 6 deletions actions/setup/action.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,11 @@ inputs:
required: true
default: './'
install-unittesting:
description: Whether to install UnitTesting.
description: Whether to install UnitTesting (DEPRECATED, replaced by SublimeText/UnitTesting/actions/setup@ref).
required: true
default: true
unittesting-version:
description: Version of UnitTesting. Use latest release if empty.
description: Version of UnitTesting (DEPRECATED, replaced by SublimeText/UnitTesting/actions/setup@ref).
required: false
default: ''
install-coverage:
Expand Down Expand Up @@ -186,18 +186,16 @@ runs:
cd "${{ inputs.package-path }}"
if [ -d "./.git" ] && [ ! -d "$SUBLIME_TEXT_PACKAGES/$PACKAGE" ]; then
# symlink does not play well with coverage
echo "copy the package to sublime package directory"
echo "Copy checked out package '$PACKAGE' to $SUBLIME_TEXT_PACKAGES/$PACKAGE"
mkdir -p "$SUBLIME_TEXT_PACKAGES/$PACKAGE"
cp -r ./ "$SUBLIME_TEXT_PACKAGES/$PACKAGE"
# detached head will crash package control
rm -rf "$SUBLIME_TEXT_PACKAGES/$PACKAGE/.git"
fi
cd -
fi
if [ "${{ inputs.install-unittesting }}" = "true" ]; then
InstallPackage "UnitTesting" "https://github.com/SublimeText/UnitTesting" "${{ inputs.unittesting-version }}"
fi
# Install extra packages to to Packages/<Package>
while read -r x; do
if [[ "$x" =~ ^(.*):(.*)/([^@]*)@?(.*)$ ]]; then
PKG="${BASH_REMATCH[1]}"
Expand All @@ -214,6 +212,13 @@ runs:
fi
InstallPackage "$PKG" "https://github.com/$USER/$REPO" "$SHA"
done <<< "${{ inputs.extra-packages }}"
# Install UnitTesting to Packages/UnitTesting if not yet exists
if [ ! -d "$SUBLIME_TEXT_PACKAGES/UnitTesting" ]; then
echo "Copy action's 'UnitTesting' to $SUBLIME_TEXT_PACKAGES/UnitTesting"
mkdir -p "$SUBLIME_TEXT_PACKAGES/UnitTesting"
cp -r "$GITHUB_ACTION_PATH/../../" "$SUBLIME_TEXT_PACKAGES/UnitTesting"
fi
shell: bash
- name: Install Package Control
if: (runner.os == 'Linux' || runner.os == 'macOS') && inputs.install-package-control == 'true'
Expand Down

0 comments on commit 586f763

Please sign in to comment.