Replace Travis with GitHub Actions workflows (#4633)
Credit to @bennothommo
This commit is contained in:
parent
919835e5de
commit
c9b4402f13
|
|
@ -0,0 +1,30 @@
|
|||
name: Code Quality
|
||||
|
||||
on:
|
||||
pull_request:
|
||||
|
||||
jobs:
|
||||
codeQuality:
|
||||
runs-on: ubuntu-latest
|
||||
name: PHP
|
||||
steps:
|
||||
- name: Checkout changes
|
||||
uses: actions/checkout@v1
|
||||
- name: Install PHP
|
||||
uses: shivammathur/setup-php@master
|
||||
with:
|
||||
php-version: 7.2
|
||||
- name: Install Composer dependencies
|
||||
run: composer install --no-interaction --no-progress --no-suggest
|
||||
- name: Reset October modules and library
|
||||
run: |
|
||||
git reset --hard HEAD
|
||||
rm -rf ./vendor/october/rain
|
||||
wget https://github.com/octobercms/library/archive/develop.zip -O ./vendor/october/develop.zip
|
||||
unzip ./vendor/october/develop.zip -d ./vendor/october
|
||||
mv ./vendor/october/library-develop ./vendor/october/rain
|
||||
composer dump-autoload
|
||||
- name: Run code quality checks
|
||||
run: |
|
||||
git config remote.origin.fetch "+refs/heads/*:refs/remotes/origin/*" && git fetch
|
||||
./vendor/bin/phpcs --colors -nq --report="full" --extensions="php" $(git diff --name-only --diff-filter=ACMR origin/${{ github.base_ref }} HEAD)
|
||||
|
|
@ -0,0 +1,31 @@
|
|||
name: Code Quality
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- master
|
||||
- develop
|
||||
|
||||
jobs:
|
||||
codeQuality:
|
||||
runs-on: ubuntu-latest
|
||||
name: PHP
|
||||
steps:
|
||||
- name: Checkout changes
|
||||
uses: actions/checkout@v1
|
||||
- name: Install PHP
|
||||
uses: shivammathur/setup-php@master
|
||||
with:
|
||||
php-version: 7.2
|
||||
- name: Install Composer dependencies
|
||||
run: composer install --no-interaction --no-progress --no-suggest
|
||||
- name: Reset October modules and library
|
||||
run: |
|
||||
git reset --hard HEAD
|
||||
rm -rf ./vendor/october/rain
|
||||
wget https://github.com/octobercms/library/archive/develop.zip -O ./vendor/october/develop.zip
|
||||
unzip ./vendor/october/develop.zip -d ./vendor/october
|
||||
mv ./vendor/october/library-develop ./vendor/october/rain
|
||||
composer dump-autoload
|
||||
- name: Run code quality checks
|
||||
run: ./vendor/bin/phpcs --colors -nq --report="full" --extensions="php" $(git show --name-only --pretty="" --diff-filter=ACMR ${{ github.sha }})
|
||||
|
|
@ -0,0 +1,39 @@
|
|||
name: Tests
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- master
|
||||
- develop
|
||||
pull_request:
|
||||
|
||||
jobs:
|
||||
phpUnitTests:
|
||||
runs-on: ubuntu-latest
|
||||
strategy:
|
||||
max-parallel: 6
|
||||
matrix:
|
||||
phpVersions: ['7.1', '7.2', '7.3']
|
||||
fail-fast: false
|
||||
name: PHP ${{ matrix.phpVersions }}
|
||||
steps:
|
||||
- name: Checkout changes
|
||||
uses: actions/checkout@v1
|
||||
- name: Install PHP
|
||||
uses: shivammathur/setup-php@master
|
||||
with:
|
||||
php-version: ${{ matrix.phpVersions }}
|
||||
- name: Install Composer dependencies
|
||||
run: composer install --no-interaction --no-progress --no-suggest
|
||||
- name: Reset October modules and library
|
||||
run: |
|
||||
git reset --hard HEAD
|
||||
rm -rf ./vendor/october/rain
|
||||
wget https://github.com/octobercms/library/archive/develop.zip -O ./vendor/october/develop.zip
|
||||
unzip ./vendor/october/develop.zip -d ./vendor/october
|
||||
mv ./vendor/october/library-develop ./vendor/october/rain
|
||||
composer dump-autoload
|
||||
- name: Run Linting and Tests
|
||||
run: |
|
||||
./vendor/bin/parallel-lint --exclude vendor --exclude storage --exclude tests/fixtures/plugins/testvendor/goto/Plugin.php .
|
||||
./vendor/bin/phpunit
|
||||
|
|
@ -0,0 +1,29 @@
|
|||
name: Wrong Branch
|
||||
|
||||
on:
|
||||
pull_request:
|
||||
types: [opened]
|
||||
branches:
|
||||
- master
|
||||
|
||||
jobs:
|
||||
wrongBranch:
|
||||
runs-on: ubuntu-latest
|
||||
name: Fix Wrong Branch
|
||||
steps:
|
||||
- name: Alert submitter
|
||||
run: |
|
||||
export ISSUE_NUMBER=$(echo '${{ github.ref }}' | cut -d'/' -f3)
|
||||
curl -s --request POST \
|
||||
--url https://api.github.com/repos/${{ github.repository }}/issues/${ISSUE_NUMBER}/comments \
|
||||
--header 'authorization: Bearer ${{ secrets.GITHUB_TOKEN }}' \
|
||||
--header 'content-type: application/json' \
|
||||
--data '{"body": "This pull request has been made to the wrong branch. Please review [the contributing guidelines](https://github.com/octobercms/october/blob/master/.github/CONTRIBUTING.md#making-a-pull-request) as all PRs need to be made to the `develop` branch.\n\nWe'\''ll fix it for you this time, but please ensure you make any future PRs to the `develop` branch, not the `master` branch."}' > /dev/null
|
||||
- name: Change base branch
|
||||
run: |
|
||||
export ISSUE_NUMBER=$(echo '${{ github.ref }}' | cut -d'/' -f3)
|
||||
curl -s --request PATCH \
|
||||
--url https://api.github.com/repos/${{ github.repository }}/pulls/${ISSUE_NUMBER} \
|
||||
--header 'authorization: Bearer ${{ secrets.GITHUB_TOKEN }}' \
|
||||
--header 'content-type: application/json' \
|
||||
--data '{"base": "develop"}' > /dev/null
|
||||
60
.travis.yml
60
.travis.yml
|
|
@ -1,60 +0,0 @@
|
|||
language: php
|
||||
|
||||
php:
|
||||
- 7.0
|
||||
- 7.1
|
||||
- 7.2
|
||||
- 7.3
|
||||
- nightly
|
||||
|
||||
matrix:
|
||||
allow_failures:
|
||||
- php: nightly
|
||||
|
||||
sudo: false
|
||||
|
||||
if: type = pull_request OR (type = push AND (branch = develop OR branch = master))
|
||||
|
||||
cache:
|
||||
directories:
|
||||
- $HOME/.composer/cache/files
|
||||
|
||||
install:
|
||||
- composer install --no-interaction --no-progress --no-suggest
|
||||
# Reset October modules back to Git source
|
||||
- git reset --hard HEAD
|
||||
# Replace October library with `develop` branch
|
||||
- rm -rf ./vendor/october/rain
|
||||
- wget https://github.com/octobercms/library/archive/develop.zip -O ./vendor/october/develop.zip
|
||||
- unzip ./vendor/october/develop.zip -d ./vendor/october
|
||||
- mv ./vendor/october/library-develop ./vendor/october/rain
|
||||
# Dump autoload
|
||||
- composer dump-autoload
|
||||
|
||||
stages:
|
||||
- test
|
||||
- code quality
|
||||
- code coverage
|
||||
|
||||
script:
|
||||
- ./vendor/bin/parallel-lint --exclude vendor --exclude storage --exclude tests/fixtures/plugins/testvendor/goto/Plugin.php .
|
||||
- ./vendor/bin/phpunit
|
||||
|
||||
jobs:
|
||||
include:
|
||||
- stage: code coverage
|
||||
if: type = push AND (branch = develop OR branch = master)
|
||||
php: 7.1
|
||||
script:
|
||||
- ./vendor/bin/phpunit --testsuite "October CMS Test Suite" --coverage-clover=coverage.xml
|
||||
- bash <(curl -s https://codecov.io/bash)
|
||||
- stage: code quality
|
||||
if: type = pull_request
|
||||
php: 7.1
|
||||
script:
|
||||
- git config remote.origin.fetch "+refs/heads/*:refs/remotes/origin/*" && git fetch
|
||||
- ./vendor/bin/phpcs --colors -nq --report="full" --extensions="php" $(git diff --name-only --diff-filter=ACMR HEAD origin/$TRAVIS_BRANCH)
|
||||
- stage: code quality
|
||||
if: type = push AND (branch = develop OR branch = master)
|
||||
php: 7.1
|
||||
script: ./vendor/bin/phpcs --colors -nq --report="full" --extensions="php" $(git show --name-only --pretty="" --diff-filter=ACMR $TRAVIS_COMMIT)
|
||||
Loading…
Reference in New Issue