Skip to content

Commit

Permalink
Fix nvm availability check for GHA and update docs.
Browse files Browse the repository at this point in the history
Closes #79
  • Loading branch information
kabalin committed Feb 2, 2021
1 parent 04f57bf commit 728ab73
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 3 deletions.
2 changes: 2 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,8 @@ jobs:
echo "TRAVIS_BUILD_DIR="$(cd ../moodle-local_travis; pwd) >> $GITHUB_ENV
# PHPUnit depends on en_AU.UTF-8 locale
sudo locale-gen en_AU.UTF-8
# Define NVM_DIR pointing to nvm installation.
echo "NVM_DIR=$HOME/.nvm" >> $GITHUB_ENV
- name: Install moodle-plugin-ci
run: moodle-plugin-ci install -vvv
Expand Down
9 changes: 8 additions & 1 deletion docs/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,14 @@ This project adheres to [Semantic Versioning](http://semver.org/).
The format of this change log follows the advice given at [Keep a CHANGELOG](http://keepachangelog.com).

## [Unreleased]
No unreleased changes.
### Fixed
- `nvm` availability check to make it work correctly in GHA
- ACTION REQUIRED: If you are using GitHub Actions, add `NVM_DIR` definition
in "Initialise moodle-plugin-ci" step. Without it `nvm` can't be used for
node version switching, see the step definition at
[gha.dist.yml](https://github.com/moodlehq/moodle-plugin-ci/blob/master/gha.dist.yml)
and add missing `NVM_DIR` line your plugin's GHA workflow file.


## [3.0.4] - 2021-01-29
### Fixed
Expand Down
3 changes: 2 additions & 1 deletion docs/GHAFileExplained.md
Original file line number Diff line number Diff line change
Expand Up @@ -92,13 +92,14 @@ jobs:
coverage: none

# Install this project into a directory called "ci", updating PATH and
# locale.
# locale, define nvm location.
- name: Initialise moodle-plugin-ci
run: |
composer create-project -n --no-dev --prefer-dist moodlehq/moodle-plugin-ci ci ^3
echo $(cd ci/bin; pwd) >> $GITHUB_PATH
echo $(cd ci/vendor/bin; pwd) >> $GITHUB_PATH
sudo locale-gen en_AU.UTF-8
echo "NVM_DIR=$HOME/.nvm" >> $GITHUB_ENV
# Run the default install.
# Optionally, it is possible to specify a different Moodle repo to use
Expand Down
1 change: 1 addition & 0 deletions gha.dist.yml
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ jobs:
echo $(cd ci/bin; pwd) >> $GITHUB_PATH
echo $(cd ci/vendor/bin; pwd) >> $GITHUB_PATH
sudo locale-gen en_AU.UTF-8
echo "NVM_DIR=$HOME/.nvm" >> $GITHUB_ENV
- name: Install moodle-plugin-ci
run: |
Expand Down
2 changes: 1 addition & 1 deletion src/Installer/VendorInstaller.php
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ public function stepCount()
*/
public function canInstallNode()
{
return getenv('NVM_DIR') && getenv('NVM_BIN');
return !empty(getenv('NVM_DIR'));
}

/**
Expand Down

0 comments on commit 728ab73

Please sign in to comment.