Skip to content

Commit

Permalink
Merge pull request #31548 from laravel/github-actions
Browse files Browse the repository at this point in the history
[6.x] Switch to Github Actions
  • Loading branch information
driesvints authored Feb 24, 2020
2 parents 1698459 + 4644641 commit a05b9dc
Show file tree
Hide file tree
Showing 7 changed files with 74 additions and 70 deletions.
1 change: 0 additions & 1 deletion .gitattributes
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
.gitattributes export-ignore
.gitignore export-ignore
.styleci.yml export-ignore
.travis.yml export-ignore
CHANGELOG-* export-ignore
CODE_OF_CONDUCT.md export-ignore
CONTRIBUTING.md export-ignore
Expand Down
66 changes: 66 additions & 0 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
name: tests

on:
push:
pull_request:
schedule:
- cron: '0 0 * * *'

jobs:
tests:

runs-on: ubuntu-latest
services:
mysql:
image: mysql:5.7
env:
MYSQL_ALLOW_EMPTY_PASSWORD: yes
MYSQL_DATABASE: forge
ports:
- 33306:3306
options: --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=3
redis:
image: redis:5.0
ports:
- 6379:6379
options: --entrypoint redis-server
strategy:
fail-fast: true
matrix:
php: [7.2, 7.3, 7.4]
stability: [prefer-lowest, prefer-stable]

name: P${{ matrix.php }} - S${{ matrix.stability }}

steps:
- name: Checkout code
uses: actions/checkout@v2

- name: Cache dependencies
uses: actions/cache@v1
with:
path: ~/.composer/cache/files
key: dependencies-php-${{ matrix.php }}-composer-${{ hashFiles('composer.json') }}

- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php }}
extensions: dom, curl, libxml, mbstring, zip, pcntl, pdo, sqlite, pdo_sqlite, gd
coverage: none

- name: Setup Memcached
uses: niden/actions-memcached@v7

- name: Install dependencies
run: composer update --${{ matrix.stability }} --prefer-dist --no-interaction --no-suggest

- name: Start MySQL
run: sudo /etc/init.d/mysql start

- name: Execute tests
run: vendor/bin/phpunit --verbose
env:
CI: ${{ secrets.CI }}
DB_PORT: ${{ job.services.mysql.ports[3306] }}
DB_USERNAME: root
41 changes: 0 additions & 41 deletions .travis.yml

This file was deleted.

2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<p align="center"><a href="https://laravel.com" target="_blank"><img src="https://res.cloudinary.com/dtfbvvkyp/image/upload/v1566331377/laravel-logolockup-cmyk-red.svg" width="400"></a></p>

<p align="center">
<a href="https://travis-ci.org/laravel/framework"><img src="https://travis-ci.org/laravel/framework.svg" alt="Build Status"></a>
<a href="https://github.com/laravel/framework/actions"><img src="https://github.com/laravel/framework/workflows/tests/badge.svg" alt="Build Status"></a>
<a href="https://packagist.org/packages/laravel/framework"><img src="https://poser.pugx.org/laravel/framework/d/total.svg" alt="Total Downloads"></a>
<a href="https://packagist.org/packages/laravel/framework"><img src="https://poser.pugx.org/laravel/framework/v/stable.svg" alt="Latest Stable Version"></a>
<a href="https://packagist.org/packages/laravel/framework"><img src="https://poser.pugx.org/laravel/framework/license.svg" alt="License"></a>
Expand Down
2 changes: 1 addition & 1 deletion bin/test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ echo "Waiting for services to boot ..."

if docker run -it --rm registry.gitlab.com/grahamcampbell/php:7.4-base -r "\$tries = 0; while (true) { try { \$tries++; if (\$tries > 30) { throw new RuntimeException('MySQL never became available'); } sleep(1); new PDO('mysql:host=docker.for.mac.localhost;dbname=forge', 'root', '', [PDO::ATTR_TIMEOUT => 3]); break; } catch (PDOException \$e) {} }"; then
if docker run -it -w /data -v ${PWD}:/data:delegated --entrypoint vendor/bin/phpunit \
--env CI=1 --env DB_HOST=docker.for.mac.localhost \
--env CI=1 --env DB_HOST=docker.for.mac.localhost --env DB_USERNAME=root \
--env REDIS_HOST=docker.for.mac.localhost --env REDIS_PORT=6379 \
--env MEMCACHED_HOST=docker.for.mac.localhost --env MEMCACHED_PORT=11211 \
--rm registry.gitlab.com/grahamcampbell/php:7.4-base "$@"; then
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,25 +2,16 @@

namespace Illuminate\Tests\Integration\Database;

use PDO;

class DatabaseEmulatePreparesMySqlConnectionTest extends DatabaseMySqlConnectionTest
{
protected function getEnvironmentSetUp($app)
{
$app['config']->set('app.debug', 'true');

// Database configuration
$app['config']->set('database.default', 'testbench');

$app['config']->set('database.connections.testbench', [
'driver' => 'mysql',
'host' => env('DB_HOST', '127.0.0.1'),
'username' => 'root',
'password' => '',
'database' => 'forge',
'prefix' => '',
'options' => [
\PDO::ATTR_EMULATE_PREPARES => true,
],
$app['config']->set('database.default', 'mysql');
$app['config']->set('database.connections.mysql.options', [
PDO::ATTR_EMULATE_PREPARES => true,
]);
}
}
13 changes: 1 addition & 12 deletions tests/Integration/Database/DatabaseMySqlConnectionTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,18 +18,7 @@ class DatabaseMySqlConnectionTest extends TestCase
protected function getEnvironmentSetUp($app)
{
$app['config']->set('app.debug', 'true');

// Database configuration
$app['config']->set('database.default', 'testbench');

$app['config']->set('database.connections.testbench', [
'driver' => 'mysql',
'host' => env('DB_HOST', '127.0.0.1'),
'username' => 'root',
'password' => '',
'database' => 'forge',
'prefix' => '',
]);
$app['config']->set('database.default', 'mysql');
}

protected function setUp(): void
Expand Down

0 comments on commit a05b9dc

Please sign in to comment.