From 1f256ab5a131c6abcfc88e8067c127992cc49950 Mon Sep 17 00:00:00 2001 From: "Eloy Lafuente (stronk7)" Date: Thu, 11 Jan 2024 17:12:35 +0100 Subject: [PATCH] Add some selfupdate integration tests We just start with the 4.1.8 release that was the first supporting the selfupdate command. Then we upgrade to actual and then rollback to confirm that we are back to the original one. That should be enough to have it continuously covered. --- .github/workflows/test.yml | 42 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index b2ff5dc8..13f59905 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -258,3 +258,45 @@ jobs: php build/moodle-plugin-ci.phar behat --profile default php build/moodle-plugin-ci.phar behat --profile chrome php build/moodle-plugin-ci.phar behat --profile firefox --tags="@local_ci&&~@app" + + 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 }}"