Skip to content

Merge pull request #388 from Automattic/update/dependencies-may-2024 #952

Merge pull request #388 from Automattic/update/dependencies-may-2024

Merge pull request #388 from Automattic/update/dependencies-may-2024 #952

Workflow file for this run

name: CI
on:
push:
workflow_dispatch:
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
permissions:
contents: read
jobs:
unit-testing:
name: Run unit tests (PHP ${{ matrix.php }})
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
php:
- '8.0'
- '8.1'
- '8.2'
steps:
- name: Check out the source code
uses: actions/checkout@v3
- name: Set up PHP
uses: shivammathur/setup-php@2.25.2
with:
coverage: none
php-version: "${{ matrix.php }}"
tools: phpunit:9
env:
fail-fast: 'true'
- name: Configure PHPUnit
run: sed "s:PROJECT_DIR:$(pwd):g" phpunit.xml.dist > phpunit.xml
- name: Run unit tests
run: phpunit --testsuite=unit-tests
env:
VIPGOCI_TESTING_DEBUG_MODE: 'true'
integration-testing:
name: Run integration tests (PHP ${{ matrix.php }})
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
php:
- '8.0'
- '8.1'
- '8.2'
steps:
- name: Check out the source code
uses: actions/checkout@v3
- name: Set up PHP 7.4
uses: shivammathur/setup-php@2.25.2
with:
coverage: none
php-version: "7.4"
- name: Set up PHP 8.0
uses: shivammathur/setup-php@2.25.2
with:
coverage: none
php-version: "8.0"
- name: Set up PHP 8.1
uses: shivammathur/setup-php@2.25.2
with:
coverage: none
php-version: "8.1"
- name: Set up PHP 8.2
uses: shivammathur/setup-php@2.25.2
with:
coverage: none
php-version: "8.2"
tools: phpunit:9
env:
fail-fast: 'true'
- name: Install tools
run: |
./tools-init.sh
rm -rf ~/vip-go-ci-tools/vip-go-ci
- name: Clone vip-go-ci-testing repository
run: |
git clone https://github.com/Automattic/vip-go-ci-testing.git ~/vip-go-ci-tools/vip-go-ci-testing
git -C ~/vip-go-ci-tools/vip-go-ci-testing checkout ap-file-types-test-1 # Need to check this out so branch is known
git -C ~/vip-go-ci-tools/vip-go-ci-testing checkout master # Switch to default
- name: Configure tools
env:
GH_TESTS_TOKEN: ${{ secrets.GH_TESTS_TOKEN }}
run: |
sed "s:/home/phpunit/:${HOME}/:; s:phpcs-php-path=.*:phpcs-php-path=/usr/bin/php7.4:g; s:svg-php-path=.*:svg-php-path=/usr/bin/php8.1:g; s:github-repo-url=.*:github-repo-url=${HOME}/vip-go-ci-tools/vip-go-ci-testing:g;" tests/config.ini.dist > tests/config.ini
rm -f tests/config.ini.dist
echo '[git-secrets]' > tests/config-secrets.ini
echo "github-token=$GH_TESTS_TOKEN" >> tests/config-secrets.ini
echo 'github-skip-write-tests=true' >> tests/config-secrets.ini
sed "s:PROJECT_DIR:$(pwd):g" phpunit.xml.dist > phpunit.xml
- name: Set default PHP version
run: sudo update-alternatives --set php "/usr/bin/php${{ matrix.php }}"
- name: Run integration tests
run: phpunit --testsuite=integration-tests
env:
VIPGOCI_TESTING_DEBUG_MODE: 'true'
- name: Clean up after integration tests
run: |
rm -f tests/config-secrets.ini
e2e-testing:
name: Run E2E tests (PHP ${{ matrix.php }})
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
php:
- '8.0'
- '8.1'
- '8.2'
steps:
- name: Check out the source code
uses: actions/checkout@v3
with:
ref: ${{ github.event.pull_request.head.ref }}
- name: Ask git to fetch latest branch and other branches
run: git fetch origin latest && git pull
- name: Set up PHP
uses: shivammathur/setup-php@2.25.2
with:
coverage: none
php-version: "${{ matrix.php }}"
tools: phpunit:9
env:
fail-fast: 'true'
- name: Configure PHPUnit
run: sed "s:PROJECT_DIR:$(pwd):g" phpunit.xml.dist > phpunit.xml
- name: Run E2E tests
run: phpunit --testsuite=e2e-tests
env:
VIPGOCI_TESTING_DEBUG_MODE: 'true'
php-code-compatibility:
name: PHP code compatibility (8.2)
runs-on: ubuntu-latest
steps:
- name: Check out the source code
uses: actions/checkout@v3
- name: Set up PHP
uses: shivammathur/setup-php@2.25.2
with:
coverage: none
php-version: 8.2
- name: Install tools
run: |
./tools-init.sh
rm -rf ~/vip-go-ci-tools/vip-go-ci
- name: Run PHPCS
run: |
~/vip-go-ci-tools/phpcs/bin/phpcs --runtime-set 'testVersion' '8.2-' --standard=PHPCompatibility,PHPCompatibilityParagonieRandomCompat,PHPCompatibilityParagonieSodiumCompat --ignore="vendor/*" .