|
| 1 | +name: Test OpenMage 20.x |
| 2 | + |
| 3 | +on: |
| 4 | + workflow_call: |
| 5 | + workflow_dispatch: |
| 6 | + |
| 7 | +jobs: |
| 8 | + test-openmage-latest-matrix: |
| 9 | + name: OpenMage ${{ matrix.openmage_version }} / PHP ${{ matrix.php_version }} / MySQL ${{ matrix.mysql_version }} |
| 10 | + runs-on: ubuntu-latest |
| 11 | + strategy: |
| 12 | + fail-fast: false |
| 13 | + matrix: |
| 14 | + openmage_version: ["20.16.0"] |
| 15 | + php_version: ["8.5", "8.1"] |
| 16 | + mysql_version: ["8.0", "5.7"] |
| 17 | + |
| 18 | + services: |
| 19 | + mysql: |
| 20 | + image: mysql:${{ matrix.mysql_version }} |
| 21 | + env: |
| 22 | + MYSQL_ROOT_PASSWORD: root |
| 23 | + MYSQL_DATABASE: magento_test_db |
| 24 | + ports: |
| 25 | + - 3306:3306 |
| 26 | + options: --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=3 |
| 27 | + |
| 28 | + steps: |
| 29 | + - uses: actions/checkout@v5 |
| 30 | + |
| 31 | + - name: Linux Setup |
| 32 | + run: ./.github/workflows/scripts/linux-setup.sh |
| 33 | + |
| 34 | + - name: Setup PHP |
| 35 | + uses: shivammathur/setup-php@v2 |
| 36 | + with: |
| 37 | + php-version: ${{ matrix.php_version }} |
| 38 | + extensions: yaml |
| 39 | + coverage: none |
| 40 | + |
| 41 | + - name: Cache dependencies |
| 42 | + uses: actions/cache@v4 |
| 43 | + with: |
| 44 | + path: | |
| 45 | + ~/.cache/composer |
| 46 | + vendor |
| 47 | + key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }} |
| 48 | + restore-keys: | |
| 49 | + ${{ runner.os }}-composer- |
| 50 | +
|
| 51 | + - name: Install dependencies |
| 52 | + run: composer install --prefer-dist --no-progress |
| 53 | + |
| 54 | + - name: Validate mysql service |
| 55 | + run: | |
| 56 | + echo "Checking mysql service" |
| 57 | + sudo apt-get install -y mysql-client |
| 58 | + mysql --host 127.0.0.1 --port ${{ job.services.mysql.ports['3306'] }} -uroot -proot -e "SHOW DATABASES" |
| 59 | +
|
| 60 | + - name: Install OpenMage |
| 61 | + run: | |
| 62 | + php bin/n98-magerun --no-interaction install \ |
| 63 | + --magentoVersionByName="openmage-${{ matrix.openmage_version }}" \ |
| 64 | + --installationFolder="./magento" \ |
| 65 | + --dbHost="127.0.0.1" \ |
| 66 | + --dbPort="${{ job.services.mysql.ports['3306'] }}" \ |
| 67 | + --dbUser="root" \ |
| 68 | + --dbPass="root" \ |
| 69 | + --dbName="magento_test_db" \ |
| 70 | + --installSampleData=no \ |
| 71 | + --useDefaultConfigParams=yes \ |
| 72 | + --baseUrl="http://magento.local/" |
| 73 | + env: |
| 74 | + COMPOSER_VENDOR_PATH : "${{ github.workspace }}/magento/vendor" |
| 75 | + |
| 76 | + - name: Set Magento root environment variable |
| 77 | + run: echo "N98_MAGERUN_TEST_MAGENTO_ROOT=${{ github.workspace }}/magento" >> $GITHUB_ENV |
| 78 | + |
| 79 | + - name: Run tests |
| 80 | + run: php vendor/bin/phpunit --configuration .phpunit.dist.xml |
| 81 | + env: |
| 82 | + COMPOSER_VENDOR_PATH : "${{ github.workspace }}/magento/vendor" |
| 83 | + |
| 84 | + - name: Report coverage |
| 85 | + uses: codecov/codecov-action@v5 |
| 86 | + with: |
| 87 | + file: ./build/coverage/clover.xml |
| 88 | + |
| 89 | + - name: Run functional tests |
| 90 | + run: bats tests/bats/functional.bats |
| 91 | + env: |
| 92 | + COMPOSER_VENDOR_PATH : "${{ github.workspace }}/magento/vendor" |
| 93 | + N98_MAGERUN_BIN: "${{ github.workspace }}/bin/n98-magerun" |
| 94 | + N98_MAGERUN_TEST_MAGENTO_ROOT: "${{ github.workspace }}/magento" |
0 commit comments