Skip to content

Commit

Permalink
Merge pull request #644 from rebing/mfn-gha
Browse files Browse the repository at this point in the history
Switch from Travis to GHA
  • Loading branch information
mfn committed Jun 22, 2020
2 parents 764d3ba + 61d7908 commit 1f9159d
Show file tree
Hide file tree
Showing 9 changed files with 169 additions and 132 deletions.
1 change: 0 additions & 1 deletion .gitattributes
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
.gitattributes export-ignore
.gitignore export-ignore
/.github export-ignore
/.travis.yml export-ignore
/docs export-ignore
/example export-ignore
/phpstan.neon export-ignore
Expand Down
62 changes: 62 additions & 0 deletions .github/workflows/analysis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
name: Code Analysis

on: [push, pull_request]

jobs:
static-analysis:
name: Static Analysis
runs-on: ubuntu-18.04
env:
COMPOSER_NO_INTERACTION: 1

steps:
- uses: actions/checkout@v2

- uses: shivammathur/setup-php@v2
with:
php-version: 7.4
tools: composer:v2
coverage: none

- name: Get composer cache directory
id: composercache
run: echo "::set-output name=dir::$(composer config cache-files-dir)"

- name: Cache dependencies
uses: actions/cache@v2
with:
path: ${{ steps.composercache.outputs.dir }}
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }}
restore-keys: ${{ runner.os }}-composer-

- run: composer update --prefer-dist --no-progress

- run: composer phpstan -- --no-progress

code-style-checker:
name: Code Style checker
runs-on: ubuntu-18.04

steps:
- uses: actions/checkout@v2

- uses: shivammathur/setup-php@v2
with:
php-version: 7.4
tools: composer:v2
coverage: none

- name: Get composer cache directory
id: composercache
run: echo "::set-output name=dir::$(composer config cache-files-dir)"

- name: Cache dependencies
uses: actions/cache@v2
with:
path: ${{ steps.composercache.outputs.dir }}
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }}
restore-keys: ${{ runner.os }}-composer-

- run: composer update --prefer-dist --no-progress

- run: composer lint
48 changes: 0 additions & 48 deletions .github/workflows/ci.yml

This file was deleted.

41 changes: 41 additions & 0 deletions .github/workflows/integration_tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
name: Integration tests

on: [push, pull_request]

jobs:
integration:
strategy:
matrix:
integration: [laravel, lumen]
name: ${{ matrix.integration }}
runs-on: ubuntu-18.04
env:
COMPOSER_NO_INTERACTION: 1

steps:
- uses: actions/checkout@v2

- uses: shivammathur/setup-php@v2
with:
php-version: '7.4'
coverage: none

# Due to version incompatibility with older Laravels we test, we remove it
- run: composer remove --dev matt-allan/laravel-code-style --no-update
- run: composer require illuminate/contracts:7.0 --no-update
- run: composer remove --dev nunomaduro/larastan --no-update

- name: Get composer cache directory
id: composercache
run: echo "::set-output name=dir::$(composer config cache-files-dir)"

- name: Cache dependencies
uses: actions/cache@v2
with:
path: ${{ steps.composercache.outputs.dir }}
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }}
restore-keys: ${{ runner.os }}-composer-

- run: composer install --prefer-dist --no-suggest

- run: tests/integration-${{ matrix.integration }}.sh
59 changes: 59 additions & 0 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
name: Tests

on: [push, pull_request]

jobs:
integration:
strategy:
matrix:
php: [7.1, 7.2, 7.3, 7.4]
laravel: [5.5.*, ^6.0, ^7.0]
exclude:
- php: 7.1
laravel: ^6.0
- php: 7.1
laravel: ^7.0
- php: 7.4
laravel: 5.5.*
name: PHP ${{ matrix.php }} Laravel ${{ matrix.laravel }}
runs-on: ubuntu-18.04
env:
COMPOSER_NO_INTERACTION: 1

steps:
- uses: actions/checkout@v2

- uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php }}
tools: composer:v2
coverage: none

# Due to version incompatibility with older Laravels we test, we remove it
- run: composer remove --dev matt-allan/laravel-code-style --no-update
- run: composer require illuminate/contracts:${{ matrix.laravel }} --no-update
- run: composer remove --dev nunomaduro/larastan --no-update

- name: Get composer cache directory
id: composercache
run: echo "::set-output name=dir::$(composer config cache-files-dir)"

- name: Cache dependencies
uses: actions/cache@v2
with:
path: ${{ steps.composercache.outputs.dir }}
key: ${{ runner.os }}-${{ matrix.php }}-${{ matrix.laravel }}-composer-${{ hashFiles('**/composer.json') }}
restore-keys: ${{ runner.os }}-${{ matrix.php }}-${{ matrix.laravel }}-composer-

- run: composer update --prefer-dist --no-progress

- run: composer require --dev orchestra/database:3.5 --prefer-dist --no-suggest
if: matrix.laravel == '5.5.*'

- name: Run tests (without lazyload types)
run: vendor/bin/phpunit --colors=always --verbose

- name: Run tests (with lazyload types)
run: vendor/bin/phpunit --colors=always --verbose
env:
TESTS_ENABLE_LAZYLOAD_TYPES: 1
74 changes: 0 additions & 74 deletions .travis.yml

This file was deleted.

2 changes: 0 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
# Laravel GraphQL

[![Latest Stable Version](https://poser.pugx.org/rebing/graphql-laravel/v/stable)](https://packagist.org/packages/rebing/graphql-laravel)
[![codecov](https://codecov.io/gh/rebing/graphql-laravel/branch/master/graph/badge.svg)](https://codecov.io/gh/rebing/graphql-laravel)
[![Build Status](https://travis-ci.org/rebing/graphql-laravel.svg?branch=master)](https://travis-ci.org/rebing/graphql-laravel)
[![License](https://poser.pugx.org/rebing/graphql-laravel/license)](https://packagist.org/packages/rebing/graphql-laravel)
[![Get on Slack](https://img.shields.io/badge/slack-join-orange.svg)](https://join.slack.com/t/rebing-graphql/shared_invite/enQtNTE5NjQzNDI5MzQ4LTdhNjk0ZGY1N2U1YjE4MGVlYmM2YTc2YjQ0MmIwODY5MWMwZWIwYmY1MWY4NTZjY2Q5MzdmM2Q3NTEyNDYzZjc)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,15 @@
# Create a fresh Laravel installation, install our package in it and run some
# basic tests to ensure everything works.
#
# This script is meant to be run on Travis CI
# This script is meant to be run on CI environments

echo "Install Laravel"
travis_retry composer create-project --quiet --prefer-dist "laravel/laravel" ../laravel
composer create-project --quiet --prefer-dist "laravel/laravel" ../laravel
cd ../laravel

echo "Add package from source"
sed -e 's|"type": "project",|&\n"repositories": [ { "type": "path", "url": "../graphql-laravel" } ],|' -i composer.json
travis_retry composer require --dev "rebing/graphql-laravel:*"
composer require --dev "rebing/graphql-laravel:*"

echo "Publish vendor files"
php artisan vendor:publish --provider="Rebing\GraphQL\GraphQLServiceProvider"
Expand Down
8 changes: 4 additions & 4 deletions tests/integration-lumen.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,18 @@

# Inspired by https://github.com/nunomaduro/larastan/blob/669b489e10558bd45fafc2429068fd4a73843802/tests/laravel-test.sh
#
# Create a fresh Kumen installation, install our package in it and run some
# Create a fresh Lumen installation, install our package in it and run some
# basic tests to ensure everything works.
#
# This script is meant to be run on Travis CI
# This script is meant to be run on CI environments

echo "Install Lumen"
travis_retry composer create-project --quiet --prefer-dist "laravel/lumen" ../lumen
composer create-project --quiet --prefer-dist "laravel/lumen" ../lumen
cd ../lumen

echo "Add package from source"
sed -e 's|"type": "project",|&\n"repositories": [ { "type": "path", "url": "../graphql-laravel" } ],|' -i composer.json
travis_retry composer require --dev "rebing/graphql-laravel:*"
composer require --dev "rebing/graphql-laravel:*"

echo "Install library"

Expand Down

0 comments on commit 1f9159d

Please sign in to comment.