Migrate from TravisCI to GitHub Actions (#2218)

* Remove TravisCI, add Github actions

* Fix missing steps

* Fix composer command

* Fix composer command 2nd :(

* Install postfix

* Postfix set up

* Fix missing sudos

* More sudos

* Fix permissions

* Sendmail path

* Debug

* Debug

* Debug

* Sendmail path

* Code coverage path

* Fix clover.xml path

* Install qmail

* Github Actions CI

* Add more PHP versions

* Add more PHP versions

* Use Ubuntu 18.04

Co-authored-by: Marcus Bointon <marcus@synchromedia.co.uk>
This commit is contained in:
codedge 2020-12-09 17:54:59 +01:00 committed by GitHub
parent 4ddf42b5c4
commit e78f71aa67
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 76 additions and 72 deletions

75
.github/workflows/ci_cd.yml vendored Normal file
View File

@ -0,0 +1,75 @@
name: "CI/CD"
on: [push]
jobs:
coding-standard:
runs-on: ubuntu-18.04
strategy:
matrix:
php: ['8.0']
dependency-version: [prefer-stable]
name: P${{ matrix.php }} - ${{ matrix.dependency-version }}
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php }}
- name: Install dependencies
run: composer install --no-interaction
- name: PHP CS
run: ./vendor/bin/phpcs -s
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']
dependency-version: [prefer-stable]
name: P${{ matrix.php }} - ${{ matrix.dependency-version }}
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php }}
coverage: xdebug
ini-values: sendmail_path=/usr/sbin/sendmail -t -i
- name: Install PHP packages
run: composer install --no-interaction
- 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
- name: Downloading scrutinizer ocular.phar
run: wget https://scrutinizer-ci.com/ocular.phar
- name: Uploading code coverage to scrutinizer
run: php ocular.phar code-coverage:upload --format=php-clover ./build/logs/clover.xml

View File

@ -1,71 +0,0 @@
language: php
arch:
- amd64
- ppc64le
dist: xenial
os: linux
cache:
directories:
- $HOME/.composer/cache
# PHP 5.5 and 7.4 (lowest/highest supported) are run in a separate stage with code coverage. See jobs.
php:
- 5.6
- 7.0
- 7.1
- 7.2
- 7.3
- nightly
stages:
- coding-standard
- test
- coverage
jobs:
allow_failures:
- php: nightly
include:
## SNIFF STAGE ##
- stage: coding-standard
php: 7.4
before_install:
before_script:
script: ./vendor/bin/phpcs -s
after_script:
## COVERAGE STAGE ##
# Extra builds generating code coverage on top of the standard test runs defined via the "php:" key.
- stage: coverage
php: 7.4
- php: 5.5
dist: trusty
before_install:
- sudo apt-get update -qq
- sudo apt-get install -y -qq postfix
install:
- if [[ "${TRAVIS_BUILD_STAGE_NAME^}" != "Coverage" ]]; then phpenv config-rm xdebug.ini || true; fi
- composer install --no-interaction
before_script:
- sudo service postfix stop
- smtp-sink -d "%d.%H.%M.%S" localhost:2500 1000 &
- mkdir -p build/logs
- cp test/testbootstrap-dist.php test/testbootstrap.php
- 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
- echo 'sendmail_path = "/usr/sbin/sendmail -t -i "' > $(php --ini|grep -m 1 "ini files in:"|cut -d ":" -f 2)/sendmail.ini
script:
- ./vendor/bin/phpunit --configuration ./travis.phpunit.xml.dist
after_script:
- if [[ "${TRAVIS_BUILD_STAGE_NAME^}" == "Coverage" ]]; then wget https://scrutinizer-ci.com/ocular.phar; fi
- if [[ "${TRAVIS_BUILD_STAGE_NAME^}" == "Coverage" ]]; then php ocular.phar code-coverage:upload --format=php-clover ../build/logs/clover.xml; fi

View File

@ -208,7 +208,7 @@ See [changelog](changelog.md).
### What's changed since moving from SourceForge?
- Official successor to the SourceForge and Google Code projects.
- Test suite.
- Continuous integration with Travis-CI.
- Continuous integration with Github Actions.
- Composer support.
- Public development.
- Additional languages and language strings.