diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index f3b7b291..16ceca0f 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -11,61 +11,35 @@ env: MYSQL_ADAPTER: PDO_MYSQL jobs: - phpunit: + tests: strategy: matrix: - php-versions: ['7.1'] - #php-versions: ['7.1', '7.2', '7.3', '7.4', '8.0'] - matomo-versions: ['3.12.0', '3.14.0'] - node-version: [12.x] - #node-version: [10.x, 12.x] + php: ['7.2', '7.4', '8.0', '8.2', '8.3'] + matomo-target: ['minimum_required_matomo', 'maximum_supported_matomo'] + node: ['12.x', '20.x', '24.x'] runs-on: ubuntu-latest - name: PHPUnit with PHP ${{ matrix.php-versions }}, Node.js ${{ matrix.node-version }} and Matomo ${{ matrix.matomo-versions }} + permissions: + checks: write + pull-requests: write + contents: read - steps: - - uses: actions/checkout@v2 + name: Tests with PHP '${{ matrix.php }}', Node.js '${{ matrix.node }}' and Matomo target '${{ matrix.matomo-target }}' - - name: Setup PHP - uses: shivammathur/setup-php@v2 + steps: + - name: Checkout repository + uses: actions/checkout@v4 with: - php-version: ${{ matrix.php-versions }} - extensions: dom, curl, libxml, mbstring, zip, pcntl, pdo, sqlite, pdo_sqlite, bcmath, intl, gd, iconv - coverage: none - tools: composer, phpunit:7.5.20 + lfs: true + persist-credentials: false - - name: Use Node.js ${{ matrix.node-version }} - uses: actions/setup-node@v1 + - name: Run plugin tests + uses: matomo-org/github-action-tests@v1 with: - node-version: ${{ matrix.node-version }} - - - name: Create database - run: | - sudo /etc/init.d/mysql start - mysql -u root -proot -e 'CREATE DATABASE IF NOT EXISTS matomo_tests;' - - - name: Clone Matomo and run plugin Tests - # TODO - run: | - shopt -s extglob - mkdir ${{ env.PLUGIN_NAME }} - cp -R !(${{ env.PLUGIN_NAME }}) ${{ env.PLUGIN_NAME }} - cp -R .git/ ${{ env.PLUGIN_NAME }}/ - - git clone --config filter.lfs.smudge=true -q https://github.com/matomo-org/matomo.git matomo - cd matomo - git fetch --all - git submodule update - git checkout -f -q tags/${{ matrix.matomo-versions }} - [ -d ./tests/travis/.git ] || sh -c "rm -rf ./tests/travis && git clone https://github.com/matomo-org/travis-scripts.git ./tests/travis" - cd ./tests/travis - git checkout master - cd ../.. - [ ! -f ./tests/travis/check_plugin_compatible_with_piwik.php ] || php ./tests/travis/check_plugin_compatible_with_piwik.php "${{ env.PLUGIN_NAME }}" - composer install --no-dev --no-progress - rm -rf plugins/${{ env.PLUGIN_NAME }} - mv ../${{ env.PLUGIN_NAME }} plugins - echo './console tests:run PerformanceAudit' - env: - DB_PASSWORD: root + plugin-name: 'PerformanceAudit' + test-type: 'PluginTests' + php-version: ${{ matrix.php }} + matomo-test-branch: ${{ matrix.matomo-target }} + node-version: ${{ matrix.node }} + mysql-service: true