Merge pull request #17139 from mauriciofauth/composer-action

Use `ramsey/composer-install` GitHub action
This commit is contained in:
Maurício Meneghini Fauth 2021-10-08 13:44:07 -03:00 committed by GitHub
commit 29304ffc10
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 162 additions and 168 deletions

View File

@ -13,24 +13,32 @@ jobs:
runs-on: ubuntu-latest
if: "!contains(github.event.head_commit.message, '[ci skip]')"
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v1
- name: Checkout code
uses: actions/checkout@v2
- name: Set up Node
uses: actions/setup-node@v1
with:
node-version: 12
- name: Get yarn cache directory path
- name: Get Yarn cache directory path
id: yarn-cache-dir-path
run: echo "::set-output name=dir::$(yarn cache dir)"
- name: yarn cache
- name: Cache Yarn dependencies
uses: actions/cache@v2
with:
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-yarn-
- name: Install modules
run: yarn install --non-interactive
- name: Lint JS files
- name: Lint JavaScript files
run: yarn run js-lint --quiet
- name: Lint CSS files
run: yarn run css-lint
@ -41,40 +49,37 @@ jobs:
matrix:
php-version: ["7.2"]
steps:
- uses: actions/checkout@v2
- name: Use PHP ${{ matrix.php-version }}
- name: Checkout code
uses: actions/checkout@v2
- name: Set up PHP ${{ matrix.php-version }}
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php-version }}
- name: Validate composer.json and composer.lock
run: composer validate
run: composer validate --strict
- name: Get Composer cache directory
id: composer-cache
run: |
echo "::set-output name=dir::$(composer config cache-files-dir)"
- name: Cache dependencies
uses: actions/cache@v2
- name: Install Composer dependencies
uses: ramsey/composer-install@v1
with:
path: ${{ steps.composer-cache.outputs.dir }}
key: composer-${{ runner.os }}-${{ matrix.php-version }}-${{ hashFiles('**/composer.*') }}
restore-keys: |
composer-${{ runner.os }}-${{ matrix.php-version }}-
dependency-versions: highest
# Ignore zip for php-webdriver/webdriver
composer-options: "--ignore-platform-req=ext-zip"
- name: Cache coding-standard
uses: actions/cache@v2
with:
path: .phpcs-cache
key: phpcs-cache
- name: Install dependencies
# Ignore zip for php-webdriver/webdriver
run: composer install --ignore-platform-req=ext-zip
- name: Lint PHP files
run: ./test/ci-phplint
- name: Check coding-standard
run: composer phpcs
- name: Check twig templates
- name: Check Twig templates
run: composer run twig-lint
analyse-php:
@ -84,29 +89,22 @@ jobs:
matrix:
php-version: ["7.2"]
steps:
- uses: actions/checkout@v2
- name: Use PHP ${{ matrix.php-version }}
- name: Checkout code
uses: actions/checkout@v2
- name: Set up PHP ${{ matrix.php-version }}
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php-version }}
extensions: mbstring, iconv, mysqli, zip, gd, bz2
- name: Get Composer cache directory
id: composer-cache
run: |
echo "::set-output name=dir::$(composer config cache-files-dir)"
- name: Cache dependencies
uses: actions/cache@v2
- name: Install Composer dependencies
uses: ramsey/composer-install@v1
with:
path: ${{ steps.composer-cache.outputs.dir }}
key: composer-${{ runner.os }}-${{ matrix.php-version }}-${{ hashFiles('**/composer.*') }}
restore-keys: |
composer-${{ runner.os }}-${{ matrix.php-version }}-
dependency-versions: highest
- name: Install dependencies
run: composer install
- name: Analyse files with phpstan
- name: Analyse files with PHPStan
run: composer phpstan -- --memory-limit 2G
- name: Analyse files with psalm
- name: Analyse files with Psalm
run: composer psalm -- --shepherd

View File

@ -13,7 +13,9 @@ jobs:
runs-on: ubuntu-latest
if: "!contains(github.event.head_commit.message, '[ci skip]')"
steps:
- uses: actions/checkout@v2
- name: Checkout code
uses: actions/checkout@v2
- name: Lint phpdoc blocks
uses: sudo-bot/action-doctum@v5
with:

View File

@ -9,17 +9,14 @@ on:
jobs:
tests:
name: Mutation tests with PHP ${{ matrix.php-version }}
runs-on: ${{ matrix.operating-system }}
if: "!contains(github.event.head_commit.message, '[ci skip]')"
runs-on: ${{ matrix.operating-system }}
strategy:
matrix:
php-version: ["8.0"]
operating-system: [ubuntu-latest]
steps:
- name: Checkout
- name: Checkout code
uses: actions/checkout@v2
- name: Fetch github.base_ref (for diffing)
@ -31,7 +28,10 @@ jobs:
run: |
sudo apt-get install -y gettext
- name: Install PHP ${{ matrix.php-version }}
- name: Generate mo files
run: ./scripts/generate-mo --quiet
- name: Set up PHP ${{ matrix.php-version }}
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php-version }}
@ -44,23 +44,10 @@ jobs:
run: |
phive --no-progress install --target ./build/tools --trust-gpg-keys C5095986493B4AA0 infection
- name: Get Composer cache directory
id: composer-cache
run: |
echo "::set-output name=dir::$(composer config cache-files-dir)"
- name: Cache dependencies
uses: actions/cache@v2
- name: Install Composer dependencies
uses: ramsey/composer-install@v1
with:
path: ${{ steps.composer-cache.outputs.dir }}
key: composer-${{ runner.os }}-${{ matrix.php-version }}-${{ hashFiles('**/composer.*') }}
restore-keys: |
composer-${{ runner.os }}-${{ matrix.php-version }}-
- name: Install dependencies
run: |
composer update --no-interaction --no-progress
./scripts/generate-mo --quiet
dependency-versions: highest
- name: Collect coverage report
run: |

View File

@ -13,12 +13,17 @@ jobs:
runs-on: ubuntu-latest
if: "!contains(github.event.head_commit.message, '[ci skip]')"
steps:
- uses: actions/checkout@v2
- uses: actions/setup-python@v2
- name: Checkout code
uses: actions/checkout@v2
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: '3.6'
- name: Install Sphinx for the documentation build
run: pip install 'Sphinx'
- name: Build the documentation
run: make -C doc html SPHINXOPTS='-n -W -a'
@ -29,50 +34,51 @@ jobs:
matrix:
php-version: ["7.2"]
steps:
- uses: actions/checkout@v2
- name: Use PHP ${{ matrix.php-version }}
- name: Checkout code
uses: actions/checkout@v2
- name: Set up PHP ${{ matrix.php-version }}
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php-version }}
extensions: mbstring, iconv, mysqli, zip, gd
tools: composer:v2
- name: Get Composer cache directory
id: composer-cache
run: |
echo "::set-output name=dir::$(composer config cache-files-dir)"
- name: Cache dependencies
uses: actions/cache@v2
- name: Install Composer dependencies
uses: ramsey/composer-install@v1
with:
path: ${{ steps.composer-cache.outputs.dir }}
key: composer-${{ runner.os }}-${{ matrix.php-version }}-${{ hashFiles('**/composer.*') }}
restore-keys: |
composer-${{ runner.os }}-${{ matrix.php-version }}-
dependency-versions: highest
- name: Install dependencies
run: composer install
- uses: actions/setup-node@v1
- name: Set up Node
uses: actions/setup-node@v1
with:
node-version: 12
- name: Get yarn cache directory path
- name: Get Yarn cache directory path
id: yarn-cache-dir-path
run: echo "::set-output name=dir::$(yarn cache dir)"
- name: yarn cache
- name: Cache Yarn dependencies
uses: actions/cache@v2
with:
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-yarn-
- name: Install modules
run: yarn install --non-interactive
- uses: actions/setup-python@v2
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: '3.6'
- name: Install gettext
run: sudo apt-get install -y gettext
- name: Install Sphinx for the documentation build
run: pip install 'Sphinx'
- name: Build the release
run: ./scripts/create-release.sh --ci

View File

@ -1,4 +1,4 @@
name: Run selenium tests
name: Run Selenium tests
on:
push:
@ -10,7 +10,7 @@ on:
jobs:
test-selenium:
name: Selenium tests on php ${{ matrix.php-version }} and ${{ matrix.os }}
name: Selenium tests on PHP ${{ matrix.php-version }} and ${{ matrix.os }}
if: "!contains(github.event.head_commit.message, '[ci skip]') && !contains(github.event.head_commit.message, '[ci selenium skip]')"
runs-on: ${{ matrix.os }}
services:
@ -25,6 +25,7 @@ jobs:
--health-interval=10s
--health-timeout=5s
--health-retries=3
selenium-server:
image: selenium/standalone-chrome:3.141.59
volumes:
@ -36,6 +37,7 @@ jobs:
SCREEN_HEIGHT: 1080
ports:
- "4444:4444"
docker-host-bridge:
# Allow accessing localhost ports from docker containers.
# See https://github.com/qoomon/docker-host
@ -53,53 +55,55 @@ jobs:
os: [ubuntu-latest]
db-server: ["mysql:5.7"]
steps:
- uses: actions/checkout@v2
- name: Checkout code
uses: actions/checkout@v2
- name: Refresh apt cache
run: sudo apt-get update
- name: Install gettext
run: sudo apt-get install -y gettext
- name: Generate mo files
run: ./scripts/generate-mo --quiet
- name: Use php ${{ matrix.php-version }}
- name: Set up PHP ${{ matrix.php-version }}
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php-version }}
extensions: mbstring, iconv, mysqli, zip, gd, bz2
- name: Get Composer cache directory
id: composer-cache
run: |
echo "::set-output name=dir::$(composer config cache-files-dir)"
- name: Cache dependencies
uses: actions/cache@v2
- name: Install Composer dependencies
uses: ramsey/composer-install@v1
with:
path: ${{ steps.composer-cache.outputs.dir }}
key: composer-${{ runner.os }}-${{ matrix.php-version }}-${{ hashFiles('**/composer.*') }}
restore-keys: |
composer-${{ runner.os }}-${{ matrix.php-version }}-
dependency-versions: highest
- name: Install dependencies
run: composer install --no-interaction
- uses: actions/setup-node@v1
- name: Set up Node
uses: actions/setup-node@v1
with:
node-version: 12
- name: Get yarn cache directory path
- name: Get Yarn cache directory path
id: yarn-cache-dir-path
run: echo "::set-output name=dir::$(yarn cache dir)"
- name: yarn cache
- name: Cache Yarn dependencies
uses: actions/cache@v2
with:
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-yarn-
- name: Install modules
run: yarn install --non-interactive --production
- name: Install nginx and php-fpm
run: sudo apt-get install -y nginx php7.2-fpm
- name: Copy the config
run: cp test/config.e2e.inc.php config.inc.php
- name: Start server
env:
CI_MODE: selenium
@ -109,7 +113,8 @@ jobs:
./test/start-local-server
echo ::set-output name=SELENIUM_TEMPDIR::"$(cat /tmp/last_temp_dir_phpMyAdminTests)"
id: start-local-server
- name: Run selenium tests
- name: Run Selenium tests
env:
CI_MODE: selenium
TESTSUITE_SELENIUM_BROWSER: chrome
@ -121,6 +126,7 @@ jobs:
TESTSUITE_SELENIUM_HOST: "127.0.0.1"
TESTSUITE_SELENIUM_PORT: "4444"
run: ./vendor/bin/phpunit --testsuite selenium --verbose --debug --no-coverage --stop-on-skipped
- name: Output logs and stop server
env:
CI_MODE: selenium
@ -130,7 +136,8 @@ jobs:
if [ -f "${SELENIUM_TEMPDIR}/php.log" ] ; then cat "${SELENIUM_TEMPDIR}/php.log" ; fi
if [ -f "${SELENIUM_TEMPDIR}/nginx-error.log" ] ; then cat "${SELENIUM_TEMPDIR}/nginx-error.log" ; fi
./test/stop-local-server
- name: 'Upload screenshots'
- name: Upload screenshots
uses: actions/upload-artifact@v2
if: ${{ success() || failure() }}
with:

View File

@ -10,7 +10,7 @@ on:
jobs:
multi-arch-tests-php:
name: Test on php ${{ matrix.php-version }} (${{ matrix.arch }})
name: Test on PHP ${{ matrix.php-version }} (${{ matrix.arch }})
if: "!contains(github.event.head_commit.message, '[ci skip]')"
runs-on: ubuntu-latest
continue-on-error: ${{ matrix.experimental }}
@ -26,12 +26,14 @@ jobs:
- { php-version: '7', experimental: true, arch: 'ppc64le', exclude-phpunit-groups: 'extension-iconv' }
- { php-version: '7', experimental: false, arch: 's390x', exclude-phpunit-groups: 'extension-iconv,32bit-incompatible' }
steps:
- uses: actions/checkout@v2
- name: Checkout code
uses: actions/checkout@v2
- 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 workaround a version detection issue with composer, see: https://github.com/Roave/SecurityAdvisories/issues/76
# git is needed to work around a version detection issue with composer, see: https://github.com/Roave/SecurityAdvisories/issues/76
run: |
printf "set -exu && \
export V='%s' && \
@ -45,14 +47,18 @@ jobs:
./scripts/generate-mo && \
php -d memory_limit=512M ./vendor/bin/phpunit --no-coverage --testsuite unit --exclude-group=%s" \
"${{ matrix.php-version }}" "${{ matrix.exclude-phpunit-groups }}" > ./do-tests.sh
- name: Setup multi arch support
- 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 ${{ matrix.arch }}/alpine:3.14 uname -a
- name: Run tests on php ${{ matrix.php-version }}
run: docker run -v $PWD:/app --workdir /app --rm ${{ matrix.arch }}/alpine:3.14 sh /app/do-tests.sh
test-php:
name: Test on php ${{ matrix.php-version }} and ${{ matrix.os }}
name: Test on PHP ${{ matrix.php-version }} and ${{ matrix.os }}
if: "!contains(github.event.head_commit.message, '[ci skip]')"
runs-on: ${{ matrix.os }}
continue-on-error: ${{ matrix.experimental }}
@ -69,46 +75,44 @@ jobs:
phpunit-options: '--configuration test/phpunit-php-nightly.xml'
composer-options: '--ignore-platform-req=php'
steps:
- uses: actions/checkout@v2
- name: Checkout code
uses: actions/checkout@v2
- name: Install gettext
run: sudo apt-get install -y gettext
- name: Generate mo files
run: ./scripts/generate-mo --quiet
- name: Use php ${{ matrix.php-version }}
- name: Set up PHP ${{ matrix.php-version }}
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php-version }}
extensions: mbstring, iconv, mysqli, zip, gd, bz2
coverage: xdebug
- name: Get Composer cache directory
id: composer-cache
run: |
echo "::set-output name=dir::$(composer config cache-files-dir)"
- name: Cache dependencies
uses: actions/cache@v2
- name: Install Composer dependencies
uses: ramsey/composer-install@v1
with:
path: ${{ steps.composer-cache.outputs.dir }}
key: composer-${{ runner.os }}-${{ matrix.php-version }}-${{ hashFiles('**/composer.*') }}
restore-keys: |
composer-${{ runner.os }}-${{ matrix.php-version }}-
dependency-versions: highest
composer-options: ${{ matrix.composer-options }}
- name: Install dependencies
run: composer install --no-interaction ${{ matrix.composer-options }}
- name: Run php tests
- name: Run PHP tests
run: composer run phpunit -- ${{ matrix.phpunit-options }}
- name: Send coverage
uses: codecov/codecov-action@v1
with:
flags: unit-${{ matrix.php-version }}-${{ matrix.os }}
name: phpunit-${{ matrix.php-version }}-${{ matrix.os }}
- name: Send coverage to Scrutinizer
uses: sudo-bot/action-scrutinizer@latest
# Upload can fail on forks
continue-on-error: true
with:
cli-args: "--format=php-clover build/logs/clover.xml"
- name: Send coverage to Codacy
# Upload can fail on forks or if the secret is missing
continue-on-error: true
@ -118,7 +122,7 @@ jobs:
coverage-reports: build/logs/clover.xml
test-php-optional-extensions:
name: Test on php (+ ext-${{ matrix.extension }}) ${{ matrix.php-version }} and ${{ matrix.os }}
name: Test on PHP (+ ext-${{ matrix.extension }}) ${{ matrix.php-version }} and ${{ matrix.os }}
runs-on: ${{ matrix.os }}
if: "!contains(github.event.head_commit.message, '[ci skip]')"
strategy:
@ -127,46 +131,43 @@ jobs:
os: [ubuntu-latest]
extension: ["dbase", "recode"]
steps:
- uses: actions/checkout@v2
- name: Checkout code
uses: actions/checkout@v2
- name: Install gettext
run: sudo apt-get install -y gettext
- name: Generate mo files
run: ./scripts/generate-mo --quiet
- name: Use php ${{ matrix.php-version }}
- 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: xdebug
- name: Get Composer cache directory
id: composer-cache
run: |
echo "::set-output name=dir::$(composer config cache-files-dir)"
- name: Cache dependencies
uses: actions/cache@v2
- name: Install Composer dependencies
uses: ramsey/composer-install@v1
with:
path: ${{ steps.composer-cache.outputs.dir }}
key: composer-${{ runner.os }}-${{ matrix.php-version }}-${{ hashFiles('**/composer.*') }}
restore-keys: |
composer-${{ runner.os }}-${{ matrix.php-version }}-
dependency-versions: highest
- name: Install dependencies
run: composer install
- name: Run php tests
- name: Run PHP tests
run: composer run phpunit -- --testsuite unit
- name: Send coverage
uses: codecov/codecov-action@v1
with:
flags: ${{ matrix.extension }}-extension
name: php-7.2-${{ matrix.extension }}-enabled
- name: Send coverage to Scrutinizer
uses: sudo-bot/action-scrutinizer@latest
# Upload can fail on forks
continue-on-error: true
with:
cli-args: "--format=php-clover build/logs/clover.xml"
- name: Send coverage to Codacy
# Upload can fail on forks or if the secret is missing
continue-on-error: true
@ -180,21 +181,28 @@ jobs:
runs-on: ubuntu-latest
if: "!contains(github.event.head_commit.message, '[ci skip]')"
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v1
- name: Checkout code
uses: actions/checkout@v2
- name: Set up Node
uses: actions/setup-node@v1
with:
node-version: 12
- name: Get yarn cache directory path
- name: Get Yarn cache directory path
id: yarn-cache-dir-path
run: echo "::set-output name=dir::$(yarn cache dir)"
- name: yarn cache
- name: Cache Yarn dependencies
uses: actions/cache@v2
with:
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-yarn-
- name: Install modules
run: yarn install --non-interactive
- name: Run tests
run: yarn test

View File

@ -11,43 +11,29 @@ jobs:
runs-on: ubuntu-latest
# Source: https://github.community/t/do-not-run-cron-workflows-in-forks/17636/2?u=williamdes
if: (github.event_name == 'schedule' && github.repository == 'phpmyadmin/phpmyadmin') || (github.event_name != 'schedule')
strategy:
matrix:
php-version: ["8.0"]
steps:
- name: Checkout
- name: Checkout code
uses: actions/checkout@v2
- name: Install Gettext
run: |
sudo apt-get install -y gettext
- name: Install PHP ${{ matrix.php-version }}
- name: Set up PHP ${{ matrix.php-version }}
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php-version }}
tools: composer:v2
- name: Get Composer cache directory
id: composer-cache
run: |
echo "::set-output name=dir::$(composer config cache-files-dir)"
- name: Cache dependencies
uses: actions/cache@v2
- name: Install Composer dependencies
uses: ramsey/composer-install@v1
with:
path: ${{ steps.composer-cache.outputs.dir }}
key: composer-${{ runner.os }}-${{ matrix.php-version }}-${{ hashFiles('**/composer.*') }}
restore-keys: |
composer-${{ runner.os }}-${{ matrix.php-version }}-
dependency-versions: highest
- name: Install dependencies
run: |
composer update --no-interaction --no-progress
- name: Setup git config
- name: Set up git config
run: |
git config user.name "phpMyAdmin bot"
git config user.email bot@phpmyadmin.net