From 3422f93153f18c383b707497bf7e0af492dafe57 Mon Sep 17 00:00:00 2001 From: Ben Thomson Date: Fri, 19 Jul 2024 09:30:12 +0800 Subject: [PATCH] Simplify tests workflow --- .github/workflows/tests.yml | 87 ++++++++++++------------------------- 1 file changed, 28 insertions(+), 59 deletions(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 4a834ea..547a2d2 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -6,89 +6,58 @@ on: - main pull_request: +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true + jobs: phpUnitTests: - runs-on: ubuntu-latest - name: Unit Tests / PHP ${{ matrix.phpVersion }} / Winter ${{ matrix.winterRelease }} strategy: - max-parallel: 6 matrix: - phpVersion: ['8.0', '8.1'] - winterRelease: ['develop'] - winterReleaseDir: ['develop'] + operatingSystem: [ubuntu-latest] + phpVersion: ['8.0', '8.1', '8.2', '8.3'] + winterBranch: ['develop'] include: - phpVersion: '7.4' - winterRelease: 'v1.1.9' - winterReleaseDir: '1.1.9' + winterBranch: '1.1' fail-fast: false + + name: PHP ${{ matrix.phpVersion }} / Winter ${{ matrix.winterBranch }} + runs-on: ${{ matrix.operatingSystem }} + env: - phpExtensions: mbstring, intl, gd, xml, sqlite - cacheKey: ext-cache-v1 - winterCmsRelease: develop + extensions: curl, fileinfo, gd, mbstring, openssl, pdo, pdo_sqlite, sqlite3, xml, zip + steps: - - name: Checkout changes - uses: actions/checkout@v2 + - name: Checkout Winter CMS + uses: actions/checkout@v4 with: - path: user-plugin + repository: wintercms/winter + ref: ${{ matrix.winterBranch }} - - name: Setup cache environment - id: extcache - uses: shivammathur/cache-extensions@v1 - with: - php-version: ${{ matrix.phpVersion }} - extensions: ${{ env.phpExtensions }} - key: ${{ env.cacheKey }} - - - name: Cache extensions - uses: actions/cache@v2 + - name: Checkout changes + uses: actions/checkout@v2 with: - path: ${{ steps.extcache.outputs.dir }} - key: ${{ steps.extcache.outputs.key }} - restore-keys: ${{ steps.extcache.outputs.key }} + path: plugins/winter/user - - name: Install PHP and extensions + - name: Install PHP uses: shivammathur/setup-php@v2 with: php-version: ${{ matrix.phpVersion }} - extensions: ${{ env.phpExtensions }} tools: composer:v2 - coverage: none - - - name: Install Winter CMS - run: | - wget https://github.com/wintercms/winter/archive/${{ matrix.winterRelease }}.zip - unzip ${{ matrix.winterRelease }}.zip - rm ${{ matrix.winterRelease }}.zip - shopt -s dotglob - mv winter-${{ matrix.winterReleaseDir }}/* ./ - rmdir winter-${{ matrix.winterReleaseDir }} - shopt -u dotglob - cp config/cms.php config/testing/cms.php - mkdir -p plugins/winter - mv user-plugin plugins/winter/user - - - name: Get Composer cache directory - id: composercache - run: echo "::set-output name=dir::$(composer config cache-files-dir)" - - - name: Cache dependencies - uses: actions/cache@v2 - with: - path: ${{ steps.composercache.outputs.dir }} - key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }} - restore-keys: ${{ runner.os }}-composer- + extensions: ${{ env.extensions }} - name: Install Composer dependencies - run: composer install --no-interaction --no-progress + run: composer install --no-interaction --no-progress --no-scripts - name: Run linting run: ./vendor/bin/parallel-lint plugins/winter/user - - name: Run unit tests (1.2/develop) - if: matrix.winterRelease != 'v1.1.9' + - name: Run unit tests (develop branch) + if: matrix.winterBranch != '1.1' run: php artisan winter:test -p Winter.User -- --testdox - - name: Run unit tests (1.1) - if: matrix.winterRelease == 'v1.1.9' + - name: Run unit tests (1.1 branch) + if: matrix.winterBranch == '1.1' working-directory: plugins/winter/user run: ../../../vendor/bin/phpunit --bootstrap ../../../tests/bootstrap.php --testdox