From 8a34c68e334b6108cc511b50747b3e70d4c152a8 Mon Sep 17 00:00:00 2001 From: Dries Vints Date: Fri, 21 Feb 2020 14:41:58 +0100 Subject: [PATCH] Switch to Github Actions --- .gitattributes | 1 - .github/workflows/tests.yml | 66 +++++++++++++++++++ .travis.yml | 41 ------------ README.md | 2 +- ...baseEmulatePreparesMySqlConnectionTest.php | 19 ++---- .../Database/DatabaseMySqlConnectionTest.php | 13 +--- 6 files changed, 73 insertions(+), 69 deletions(-) create mode 100644 .github/workflows/tests.yml delete mode 100755 .travis.yml diff --git a/.gitattributes b/.gitattributes index ceba0fefff52..b82e325ce02f 100644 --- a/.gitattributes +++ b/.gitattributes @@ -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 diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml new file mode 100644 index 000000000000..c7be321c6578 --- /dev/null +++ b/.github/workflows/tests.yml @@ -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 diff --git a/.travis.yml b/.travis.yml deleted file mode 100755 index 2e1c9abde718..000000000000 --- a/.travis.yml +++ /dev/null @@ -1,41 +0,0 @@ -dist: bionic -language: php - -env: - global: - - SETUP=stable - -matrix: - fast_finish: true - include: - - php: 7.2 - - php: 7.2 - env: SETUP=lowest - - php: 7.3 - - php: 7.3 - env: SETUP=lowest - - php: 7.4 - - php: 7.4 - env: SETUP=lowest - -cache: - directories: - - $HOME/.composer/cache - -services: - - memcached - - redis-server - - mysql - -before_install: - - phpenv config-rm xdebug.ini || true - - printf "\n" | pecl install -f memcached redis - - travis_retry composer self-update - - mysql -e 'CREATE DATABASE forge;' - -install: - - if [[ $SETUP = 'stable' ]]; then travis_retry composer update --prefer-dist --no-interaction --prefer-stable --no-suggest; fi - - if [[ $SETUP = 'lowest' ]]; then travis_retry composer update --prefer-dist --no-interaction --prefer-lowest --prefer-stable --no-suggest; fi - -script: - - vendor/bin/phpunit diff --git a/README.md b/README.md index 5e1f6e6cd23f..17c583142a5e 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,7 @@

-Build Status +Build Status Total Downloads Latest Stable Version License diff --git a/tests/Integration/Database/DatabaseEmulatePreparesMySqlConnectionTest.php b/tests/Integration/Database/DatabaseEmulatePreparesMySqlConnectionTest.php index f15a39fd25ed..65e71ebdb908 100755 --- a/tests/Integration/Database/DatabaseEmulatePreparesMySqlConnectionTest.php +++ b/tests/Integration/Database/DatabaseEmulatePreparesMySqlConnectionTest.php @@ -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, ]); } } diff --git a/tests/Integration/Database/DatabaseMySqlConnectionTest.php b/tests/Integration/Database/DatabaseMySqlConnectionTest.php index 2012c3d3b6d9..86fb1b659b7f 100644 --- a/tests/Integration/Database/DatabaseMySqlConnectionTest.php +++ b/tests/Integration/Database/DatabaseMySqlConnectionTest.php @@ -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