Skip to content

Commit 728ab73

Browse files
committed
Fix nvm availability check for GHA and update docs.
Closes #79
1 parent 04f57bf commit 728ab73

File tree

5 files changed

+14
-3
lines changed

5 files changed

+14
-3
lines changed

.github/workflows/test.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,8 @@ jobs:
8282
echo "TRAVIS_BUILD_DIR="$(cd ../moodle-local_travis; pwd) >> $GITHUB_ENV
8383
# PHPUnit depends on en_AU.UTF-8 locale
8484
sudo locale-gen en_AU.UTF-8
85+
# Define NVM_DIR pointing to nvm installation.
86+
echo "NVM_DIR=$HOME/.nvm" >> $GITHUB_ENV
8587
8688
- name: Install moodle-plugin-ci
8789
run: moodle-plugin-ci install -vvv

docs/CHANGELOG.md

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,14 @@ This project adheres to [Semantic Versioning](http://semver.org/).
99
The format of this change log follows the advice given at [Keep a CHANGELOG](http://keepachangelog.com).
1010

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

1421
## [3.0.4] - 2021-01-29
1522
### Fixed

docs/GHAFileExplained.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,13 +92,14 @@ jobs:
9292
coverage: none
9393

9494
# Install this project into a directory called "ci", updating PATH and
95-
# locale.
95+
# locale, define nvm location.
9696
- name: Initialise moodle-plugin-ci
9797
run: |
9898
composer create-project -n --no-dev --prefer-dist moodlehq/moodle-plugin-ci ci ^3
9999
echo $(cd ci/bin; pwd) >> $GITHUB_PATH
100100
echo $(cd ci/vendor/bin; pwd) >> $GITHUB_PATH
101101
sudo locale-gen en_AU.UTF-8
102+
echo "NVM_DIR=$HOME/.nvm" >> $GITHUB_ENV
102103
103104
# Run the default install.
104105
# Optionally, it is possible to specify a different Moodle repo to use

gha.dist.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@ jobs:
4949
echo $(cd ci/bin; pwd) >> $GITHUB_PATH
5050
echo $(cd ci/vendor/bin; pwd) >> $GITHUB_PATH
5151
sudo locale-gen en_AU.UTF-8
52+
echo "NVM_DIR=$HOME/.nvm" >> $GITHUB_ENV
5253
5354
- name: Install moodle-plugin-ci
5455
run: |

src/Installer/VendorInstaller.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ public function stepCount()
102102
*/
103103
public function canInstallNode()
104104
{
105-
return getenv('NVM_DIR') && getenv('NVM_BIN');
105+
return !empty(getenv('NVM_DIR'));
106106
}
107107

108108
/**

0 commit comments

Comments
 (0)