From e78f71aa678c413c414f6d32e923993abba1de97 Mon Sep 17 00:00:00 2001 From: codedge Date: Wed, 9 Dec 2020 17:54:59 +0100 Subject: [PATCH] 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 --- .github/workflows/ci_cd.yml | 75 +++++++++++++++++++++ .travis.yml | 71 ------------------- README.md | 2 +- travis.phpunit.xml.dist => phpunit.xml.dist | 0 4 files changed, 76 insertions(+), 72 deletions(-) create mode 100644 .github/workflows/ci_cd.yml delete mode 100644 .travis.yml rename travis.phpunit.xml.dist => phpunit.xml.dist (100%) diff --git a/.github/workflows/ci_cd.yml b/.github/workflows/ci_cd.yml new file mode 100644 index 00000000..bcc4785d --- /dev/null +++ b/.github/workflows/ci_cd.yml @@ -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 \ No newline at end of file diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index 75ae730f..00000000 --- a/.travis.yml +++ /dev/null @@ -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 diff --git a/README.md b/README.md index 9e07e1be..b947a18e 100644 --- a/README.md +++ b/README.md @@ -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. diff --git a/travis.phpunit.xml.dist b/phpunit.xml.dist similarity index 100% rename from travis.phpunit.xml.dist rename to phpunit.xml.dist