From c54c3999bf4231b75d952b2cbd80dbc93150fe77 Mon Sep 17 00:00:00 2001 From: Ruslan Kabalin Date: Fri, 23 Aug 2024 00:26:41 +0100 Subject: [PATCH] Test with ubuntu 24.04 --- .github/workflows/test.yml | 12 ++++++------ src/Installer/VendorInstaller.php | 10 ++++++---- 2 files changed, 12 insertions(+), 10 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index d0e73b24..2601ebad 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -5,7 +5,7 @@ on: [push, pull_request, workflow_dispatch] jobs: selftest: name: CI test (make validate) - runs-on: ubuntu-22.04 + runs-on: ubuntu-24.04 steps: - name: Check out repository code @@ -28,7 +28,7 @@ jobs: coverage: if: github.repository == 'moodlehq/moodle-plugin-ci' name: Code coverage (codecov) - runs-on: ubuntu-22.04 + runs-on: ubuntu-24.04 steps: - name: Check out repository code @@ -58,7 +58,7 @@ jobs: citest: name: Integration tests needs: selftest - runs-on: ubuntu-22.04 + runs-on: ubuntu-24.04 services: postgres: @@ -153,7 +153,7 @@ jobs: buildphar: name: Build moodle-plugin-ci.phar needs: selftest - runs-on: ubuntu-22.04 + runs-on: ubuntu-24.04 steps: - name: Check out repository code @@ -179,7 +179,7 @@ jobs: phartest: name: Integration tests (PHAR) needs: buildphar - runs-on: ubuntu-22.04 + runs-on: ubuntu-24.04 services: postgres: @@ -275,7 +275,7 @@ jobs: selfupdatetest: name: SelfUpdate tests (PHAR) needs: buildphar - runs-on: ubuntu-22.04 + runs-on: ubuntu-24.04 env: lowest_release: '4.1.8' diff --git a/src/Installer/VendorInstaller.php b/src/Installer/VendorInstaller.php index cd12903f..2e2a8716 100644 --- a/src/Installer/VendorInstaller.php +++ b/src/Installer/VendorInstaller.php @@ -15,6 +15,7 @@ use MoodlePluginCI\Bridge\Moodle; use MoodlePluginCI\Bridge\MoodlePlugin; use MoodlePluginCI\Process\Execute; +use Symfony\Component\Filesystem\Filesystem; use Symfony\Component\Process\Process; /** @@ -112,15 +113,16 @@ public function canInstallNvm(): bool */ public function installNvm(): void { - $cmd = 'curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.7/install.sh | bash'; + $nvmDir = "{$this->moodle->directory}/.nvm"; + (new Filesystem())->mkdir($nvmDir); + $cmd = "curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.7/install.sh | NVM_DIR={$nvmDir} bash"; $process = $this->execute->passThroughProcess( Process::fromShellCommandline($cmd, $this->moodle->directory, null, null, null) ); if (!$process->isSuccessful()) { throw new \RuntimeException('nvm installation failed.'); } - $home = getenv('HOME'); - putenv("NVM_DIR={$home}/.nvm"); + putenv("NVM_DIR={$nvmDir}"); } /** @@ -154,7 +156,7 @@ public function installNode(): void } $nvmDir = getenv('NVM_DIR'); - $cmd = ". $nvmDir/nvm.sh && nvm install && nvm use && echo \"NVM_BIN=\$NVM_BIN\""; + $cmd = ". $nvmDir/nvm.sh; nvm install && nvm use && echo \"NVM_BIN=\$NVM_BIN\""; $process = $this->execute->passThroughProcess( Process::fromShellCommandline($cmd, $this->moodle->directory, null, null, null)