You've already forked phpmyadmin
mirror of
https://github.com/phpmyadmin/phpmyadmin.git
synced 2026-10-23 18:29:15 +03:00
267 lines
10 KiB
YAML
267 lines
10 KiB
YAML
name: Run tests
|
|
|
|
on:
|
|
push:
|
|
pull_request:
|
|
types: [opened, synchronize, reopened]
|
|
branches:
|
|
- master
|
|
- QA_**
|
|
|
|
permissions:
|
|
contents: read
|
|
|
|
jobs:
|
|
multi-arch-tests-php:
|
|
name: Test on PHP ${{ matrix.php-version }} (${{ matrix.arch }})
|
|
runs-on: ubuntu-latest
|
|
continue-on-error: ${{ matrix.experimental }}
|
|
strategy:
|
|
fail-fast: false
|
|
matrix:
|
|
include:
|
|
- { php-version: '82', experimental: false, arch: 'amd64', exclude-phpunit-groups: '--exclude-group extension-iconv' }
|
|
- { php-version: '82', experimental: false, arch: 'arm64/v8', exclude-phpunit-groups: '--exclude-group extension-iconv' }
|
|
- { php-version: '82', experimental: false, arch: 'arm/v7', exclude-phpunit-groups: '--exclude-group extension-iconv --exclude-group 32bit-incompatible' }
|
|
- { php-version: '82', experimental: false, arch: 'i386', exclude-phpunit-groups: '--exclude-group extension-iconv --exclude-group 32bit-incompatible' }
|
|
- { php-version: '82', experimental: true, arch: 'ppc64le', exclude-phpunit-groups: '--exclude-group extension-iconv' }
|
|
- { php-version: '82', experimental: false, arch: 's390x', exclude-phpunit-groups: '--exclude-group extension-iconv --exclude-group 32bit-incompatible' }
|
|
steps:
|
|
- name: Checkout code
|
|
uses: actions/checkout@v7
|
|
with:
|
|
persist-credentials: false
|
|
|
|
- name: Write script
|
|
# tcpdf allowed memory exhausted needs the memory_limit workaround
|
|
# musl-locales and musl-locales-lang are needed to run some locale specific tests
|
|
# gettext is needed to run generate-mo
|
|
# git is needed to work around a version detection issue with composer, see: https://github.com/Roave/SecurityAdvisories/issues/76
|
|
# ctype for psalm
|
|
run: |
|
|
printf "set -exu && \
|
|
export V='%s' && \
|
|
apk add --update --no-cache \
|
|
php\$V-cli php\$V-mysqli php\$V-session php\$V-mbstring php\$V-ctype php\$V-sodium \
|
|
php\$V-iconv php\$V-xml php\$V-tokenizer php\$V-xmlwriter php\$V-simplexml \
|
|
php\$V-dom php\$V-json php\$V-bz2 php\$V-curl php\$V-gd php\$V-zip php\$V-bcmath \
|
|
musl-locales musl-locales-lang \
|
|
gettext composer git && \
|
|
composer config version "$(php -r "define('VERSION_SUFFIX', ''); require_once('src/Version.php'); echo \PhpMyAdmin\Version::VERSION;")" && \
|
|
composer install && \
|
|
./bin/generate-mo && \
|
|
php\$V -d memory_limit=512M ./vendor/bin/phpunit --no-logging --no-coverage --testsuite unit --display-all-issues %s" \
|
|
"${{ matrix.php-version }}" "${{ matrix.exclude-phpunit-groups }}" > ./do-tests.sh
|
|
|
|
- name: Set up multi arch support
|
|
run: docker run --rm --privileged multiarch/qemu-user-static --reset -p yes
|
|
|
|
- name: Print arch
|
|
run: docker run --rm --platform linux/${{ matrix.arch }} alpine:3.19 uname -a
|
|
|
|
- name: Run tests on php ${{ matrix.php-version }}
|
|
run: docker run -v $PWD:/app --workdir /app --rm --platform linux/${{ matrix.arch }} alpine:3.19 sh /app/do-tests.sh
|
|
|
|
test-php:
|
|
name: Test on PHP ${{ matrix.php-version }}, ${{ matrix.composer-dependency }}
|
|
runs-on: ubuntu-latest
|
|
continue-on-error: ${{ matrix.php-version == '8.6' }}
|
|
strategy:
|
|
matrix:
|
|
php-version: ['8.2', '8.3', '8.4', '8.5']
|
|
composer-dependency: [locked, highest]
|
|
php-extensions: ['mbstring, iconv, mysqli, zip, gd, bz2']
|
|
include:
|
|
- php-version: '8.6'
|
|
composer-dependency: locked
|
|
composer-options: '--ignore-platform-req=php+'
|
|
php-extensions: 'mbstring, iconv, mysqli, zip, bz2'
|
|
steps:
|
|
- name: Checkout code
|
|
uses: actions/checkout@v7
|
|
with:
|
|
# Fetch some commits for Scrutinizer coverage upload
|
|
fetch-depth: 15
|
|
persist-credentials: false
|
|
|
|
- name: Install gettext and generate translation files
|
|
run: |
|
|
sudo apt-get install -y gettext
|
|
./bin/generate-mo --quiet
|
|
|
|
- name: Set up PHP ${{ matrix.php-version }}
|
|
uses: shivammathur/setup-php@v2
|
|
with:
|
|
php-version: ${{ matrix.php-version }}
|
|
extensions: ${{ matrix.php-extensions }}
|
|
coverage: pcov
|
|
|
|
- name: Install Composer dependencies
|
|
uses: ramsey/composer-install@v4
|
|
with:
|
|
dependency-versions: ${{ matrix.composer-dependency }}
|
|
composer-options: ${{ matrix.composer-options }}
|
|
|
|
- name: Run PHP tests
|
|
run: composer run phpunit -- --testsuite unit --display-all-issues
|
|
|
|
- name: Send coverage
|
|
uses: codecov/codecov-action@v7
|
|
with:
|
|
token: ${{ secrets.CODECOV_TOKEN }}
|
|
flags: unit-${{ matrix.php-version }}
|
|
name: phpunit-${{ matrix.php-version }}
|
|
|
|
- name: Send coverage to Scrutinizer
|
|
uses: sudo-bot/action-scrutinizer@latest
|
|
# Do not run this step on forked versions of the main repository (example: contributor forks)
|
|
if: github.repository == 'phpmyadmin/phpmyadmin'
|
|
continue-on-error: true
|
|
with:
|
|
cli-args: "--format=php-clover build/logs/clover.xml --revision=${{ github.event.pull_request.head.sha || github.sha }}"
|
|
|
|
- name: Send coverage to Codacy
|
|
uses: codacy/codacy-coverage-reporter-action@v1
|
|
# Do not run this step on forked versions of the main repository (example: contributor forks)
|
|
if: github.repository == 'phpmyadmin/phpmyadmin'
|
|
# Upload can fail on forks or if the secret is missing
|
|
continue-on-error: true
|
|
with:
|
|
project-token: ${{ secrets.CODACY_PROJECT_TOKEN }}
|
|
coverage-reports: build/logs/clover.xml
|
|
|
|
test-php-optional-extensions:
|
|
name: Test on PHP ${{ matrix.php-version }} (+ ext-${{ matrix.extension }})
|
|
runs-on: ubuntu-latest
|
|
strategy:
|
|
matrix:
|
|
php-version: ["8.2"]
|
|
extension: ["dbase"]
|
|
steps:
|
|
- name: Checkout code
|
|
uses: actions/checkout@v7
|
|
with:
|
|
# Fetch some commits for Scrutinizer coverage upload
|
|
fetch-depth: 15
|
|
persist-credentials: false
|
|
|
|
- name: Install gettext and generate translation files
|
|
run: |
|
|
sudo apt-get install -y gettext
|
|
./bin/generate-mo --quiet
|
|
|
|
- name: Set up PHP ${{ matrix.php-version }}
|
|
uses: shivammathur/setup-php@v2
|
|
with:
|
|
php-version: ${{ matrix.php-version }}
|
|
extensions: ${{ matrix.extension }}, mbstring, iconv, mysqli, zip, gd
|
|
coverage: pcov
|
|
|
|
- name: Install Composer dependencies
|
|
uses: ramsey/composer-install@v4
|
|
|
|
- name: Run PHP tests
|
|
run: composer run phpunit -- --testsuite unit --display-all-issues
|
|
|
|
- name: Send coverage
|
|
uses: codecov/codecov-action@v7
|
|
with:
|
|
token: ${{ secrets.CODECOV_TOKEN }}
|
|
flags: ${{ matrix.extension }}-extension
|
|
name: php-${{ matrix.php-version }}-${{ matrix.extension }}-enabled
|
|
|
|
- name: Send coverage to Scrutinizer
|
|
uses: sudo-bot/action-scrutinizer@latest
|
|
# Do not run this step on forked versions of the main repository (example: contributor forks)
|
|
if: github.repository == 'phpmyadmin/phpmyadmin'
|
|
continue-on-error: true
|
|
with:
|
|
cli-args: "--format=php-clover build/logs/clover.xml --revision=${{ github.event.pull_request.head.sha || github.sha }}"
|
|
|
|
- name: Send coverage to Codacy
|
|
uses: codacy/codacy-coverage-reporter-action@v1
|
|
# Do not run this step on forked versions of the main repository (example: contributor forks)
|
|
if: github.repository == 'phpmyadmin/phpmyadmin'
|
|
# Upload can fail on forks or if the secret is missing
|
|
continue-on-error: true
|
|
with:
|
|
project-token: ${{ secrets.CODACY_PROJECT_TOKEN }}
|
|
coverage-reports: build/logs/clover.xml
|
|
|
|
test-php-with-newer-phpunit:
|
|
name: Test on PHP ${{ matrix.php }} with PHPUnit ${{ matrix.phpunit }}
|
|
runs-on: ubuntu-latest
|
|
strategy:
|
|
fail-fast: false
|
|
matrix:
|
|
include:
|
|
- { php: '8.3', phpunit: '12' }
|
|
- { php: '8.4', phpunit: '13' }
|
|
steps:
|
|
- name: Checkout code
|
|
uses: actions/checkout@v7
|
|
with:
|
|
persist-credentials: false
|
|
|
|
- name: Install gettext and generate translation files
|
|
run: |
|
|
sudo apt-get install -y gettext
|
|
./bin/generate-mo --quiet
|
|
|
|
- name: Set up PHP ${{ matrix.php }}
|
|
uses: shivammathur/setup-php@v2
|
|
with:
|
|
php-version: ${{ matrix.php }}
|
|
extensions: mbstring, iconv, mysqli, zip, gd, bz2
|
|
coverage: none
|
|
|
|
- name: Update composer.json
|
|
shell: bash
|
|
env:
|
|
PHPUNIT_VERSION: ${{ matrix.phpunit }}
|
|
run: |
|
|
composer config --unset platform --no-interaction --ansi
|
|
composer remove --dev vimeo/psalm psalm/plugin-phpunit --no-update --no-interaction --ansi
|
|
composer require --dev phpunit/phpunit:^"$PHPUNIT_VERSION" --no-update --no-interaction --ansi
|
|
|
|
- name: Install Composer dependencies
|
|
uses: ramsey/composer-install@v4
|
|
with:
|
|
dependency-versions: highest
|
|
|
|
- name: Run PHP tests
|
|
run: vendor/bin/phpunit --testsuite unit --no-coverage --no-logging --display-all-issues
|
|
|
|
test-php-windows:
|
|
name: Test on PHP 8.2 (Windows)
|
|
runs-on: windows-latest
|
|
env:
|
|
php-version: '8.2'
|
|
steps:
|
|
- name: Checkout code
|
|
uses: actions/checkout@v7
|
|
with:
|
|
persist-credentials: false
|
|
|
|
- name: Install gettext
|
|
run: choco install gettext -y
|
|
|
|
- name: Generate translation files
|
|
shell: bash
|
|
run: |
|
|
export PATH=$PATH:"/c/Program Files/gettext-iconv/bin"
|
|
./bin/generate-mo --quiet
|
|
|
|
- name: Set up PHP ${{ env.php-version }}
|
|
uses: shivammathur/setup-php@v2
|
|
with:
|
|
php-version: ${{ env.php-version }}
|
|
extensions: mbstring, iconv, mysqli, zip, gd, bz2, sodium
|
|
coverage: none
|
|
|
|
- name: Install Composer dependencies
|
|
uses: ramsey/composer-install@v4
|
|
|
|
- name: Run PHP tests
|
|
run: vendor/bin/phpunit --testsuite unit --no-coverage --no-logging --display-all-issues
|