diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 3327ef50..f9d4f138 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -258,3 +258,45 @@ jobs: php build/moodle-plugin-ci.phar phpunit --verbose --coverage-text --fail-on-warning php build/moodle-plugin-ci.phar behat --profile default php build/moodle-plugin-ci.phar behat --profile chrome + + selfupdatetest: + name: SelfUpdate tests (PHAR) + runs-on: ubuntu-22.04 + env: + lowest_release: '4.1.8' + + strategy: + fail-fast: false + matrix: + include: + # Each supported PHP version once. That's enough. + - php: '8.2' + - php: '8.1' + - php: '8.0' + - php: '7.4' + + steps: + - name: Setup PHP ${{ matrix.php }} + uses: shivammathur/setup-php@v2 + with: + php-version: ${{ matrix.php }} + extensions: pgsql, zip, gd, xmlrpc, soap + ini-values: max_input_vars=5000 + coverage: none + + - name: Download base ${{ env.lowest_release }} PHAR artifact + uses: robinraju/release-downloader@v1.8 + with: + repository: moodlehq/moodle-plugin-ci + tag: ${{ env.lowest_release }} + fileName: moodle-plugin-ci.phar + + - name: Self update PHAR to actual + run: | + php moodle-plugin-ci.phar selfupdate + php moodle-plugin-ci.phar --version | grep -qv "${{ env.lowest_release }}" + + - name: Self update rollback PHAR to base ${{ env.lowest_release }} + run: | + php moodle-plugin-ci.phar selfupdate --rollback + php moodle-plugin-ci.phar --version | grep -q "${{ env.lowest_release }}"