PHPMailer/.github/workflows/tests.yml

95 lines
2.8 KiB
YAML

name: "Tests"
on:
push:
pull_request:
# Allow manually triggering the workflow.
workflow_dispatch:
jobs:
coding-standard:
runs-on: ubuntu-18.04
name: Coding standards
steps:
- name: Check out code
uses: actions/checkout@v2
- name: Set up PHP
uses: shivammathur/setup-php@v2
with:
php-version: '8.0'
coverage: none
tools: cs2pr
# Install dependencies and handle caching in one go.
# @link https://github.com/marketplace/actions/install-composer-dependencies
- name: Install Composer dependencies
uses: "ramsey/composer-install@v1"
- name: Check coding standards
continue-on-error: true
run: ./vendor/bin/phpcs -s --report-full --report-checkstyle=./phpcs-report.xml
- name: Show PHPCS results in PR
run: cs2pr ./phpcs-report.xml
test:
needs: ['coding-standard']
runs-on: ubuntu-18.04
strategy:
matrix:
php: ['5.5', '5.6', '7.0.', '7.1', '7.2', '7.3', '7.4', '8.0']
experimental: [false]
include:
# Experimental builds. These are allowed to fail.
- php: '8.1'
experimental: true
name: PHP ${{ matrix.php }}
continue-on-error: ${{ matrix.experimental }}
steps:
- name: Check out code
uses: actions/checkout@v2
- name: Set up PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php }}
coverage: xdebug
ini-values: sendmail_path=/usr/sbin/sendmail -t -i, zend.multibyte=1, zend.script_encoding=UTF-8, default_charset=UTF-8, error_reporting=E_ALL, display_errors=On
extensions: imap, mbstring, intl, ctype, filter, hash
# Install dependencies and handle caching in one go.
# @link https://github.com/marketplace/actions/install-composer-dependencies
- name: Install PHP packages - normal
if: ${{ matrix.php != '8.1' }}
uses: "ramsey/composer-install@v1"
- name: Install PHP packages - ignore-platform-reqs
if: ${{ matrix.php == '8.1' }}
uses: "ramsey/composer-install@v1"
with:
composer-options: --ignore-platform-reqs
- name: Install postfix
run: |
sudo apt-get install -y -qq postfix qmail
sudo service postfix stop
- name: Set up sendmail
run: |
smtp-sink -d "%d.%H.%M.%S" localhost:2500 1000 &
mkdir -p build/logs
sudo cp test/testbootstrap-dist.php test/testbootstrap.php
sudo chmod +x test/fakesendmail.sh
sudo mkdir -p /var/qmail/bin
sudo cp test/fakesendmail.sh /var/qmail/bin/sendmail
sudo cp test/fakesendmail.sh /usr/sbin/sendmail
- name: Run tests
run: ./vendor/bin/phpunit --configuration ./phpunit.xml.dist