Add GitHub Actions (#97)

* Add GitHub Actions

* Update branches trigger

* Fix .env file

* Fix default database connection

* Add test step

* Normalize PHP version

* Update main.yml

* Add more jobs

* Fix YAML syntax error

* Fix YAML syntax error

* Attempt to fix Windows job

* Update main.yml

* Update main.yml

* Update main.yml

* Attempt to use MySQL

* Update main.yml

* Fix possible error
This commit is contained in:
Pig Fang 2019-09-11 23:32:56 +08:00 committed by GitHub
parent deab8be4a8
commit e91185461a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 39 additions and 4 deletions

View File

@ -12,7 +12,7 @@ APP_ENV = production
WEBPACK_ENV = production WEBPACK_ENV = production
# Database Configuration # Database Configuration
DB_CONNECTION = dummy DB_CONNECTION = mysql
DB_HOST = localhost DB_HOST = localhost
DB_PORT = 3306 DB_PORT = 3306
DB_DATABASE = blessingskin DB_DATABASE = blessingskin

30
.github/workflows/main.yml vendored Normal file
View File

@ -0,0 +1,30 @@
name: CI
on: [push]
jobs:
php73:
name: PHP 7.3
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
- name: Install dependencies
run: composer install --prefer-dist --no-progress --no-suggest
- name: Run tests
run: |
php -v
mysql -uroot -proot -e 'create database if not exists test;'
./vendor/bin/phpunit
env:
APP_ENV: testing
frontend:
name: Front End
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
- name: Install dependencies
run: yarn
- name: Run tests
run: |
yarn lint
yarn test

View File

@ -371,7 +371,8 @@ class PluginManager
? [$name => compact('version', 'constraint')] ? [$name => compact('version', 'constraint')]
: []; : [];
} elseif ($name == 'php') { } elseif ($name == 'php') {
$version = PHP_VERSION; preg_match('/(\d+\.\d+\.\d+)/', PHP_VERSION, $matches);
$version = $matches[1];
return (! Semver::satisfies($version, $constraint)) return (! Semver::satisfies($version, $constraint))
? [$name => compact('version', 'constraint')] ? [$name => compact('version', 'constraint')]

View File

@ -26,7 +26,7 @@ return [
| |
*/ */
'default' => env('DB_CONNECTION', 'dummy'), 'default' => env('DB_CONNECTION', 'mysql'),
/* /*
|-------------------------------------------------------------------------- |--------------------------------------------------------------------------

View File

@ -475,9 +475,11 @@ class PluginManagerTest extends TestCase
$this->assertEquals(config('app.version'), $info['version']); $this->assertEquals(config('app.version'), $info['version']);
$this->assertEquals('^0.0.0', $info['constraint']); $this->assertEquals('^0.0.0', $info['constraint']);
preg_match('/(\d+\.\d+\.\d+)/', PHP_VERSION, $matches);
$version = $matches[1];
$plugin = new Plugin('', ['require' => ['php' => '^0.0.0']]); $plugin = new Plugin('', ['require' => ['php' => '^0.0.0']]);
$info = $manager->getUnsatisfied($plugin)->get('php'); $info = $manager->getUnsatisfied($plugin)->get('php');
$this->assertEquals(PHP_VERSION, $info['version']); $this->assertEquals($version, $info['version']);
$this->assertEquals('^0.0.0', $info['constraint']); $this->assertEquals('^0.0.0', $info['constraint']);
$plugin = new Plugin('', ['require' => ['another-plugin' => '0.0.*']]); $plugin = new Plugin('', ['require' => ['another-plugin' => '0.0.*']]);

View File

@ -800,6 +800,8 @@ class SkinlibControllerTest extends TestCase
// Without returning score // Without returning score
option(['return_score' => false, 'private_score_per_storage' => 0]); option(['return_score' => false, 'private_score_per_storage' => 0]);
$uploader->score += 1000;
$uploader->save();
$texture = factory(Texture::class)->create(['public' => 'false', 'uploader' => $uploader->uid]); $texture = factory(Texture::class)->create(['public' => 'false', 'uploader' => $uploader->uid]);
$other = factory(User::class)->create(); $other = factory(User::class)->create();
$other->closet()->attach($texture->tid, ['item_name' => 'a']); $other->closet()->attach($texture->tid, ['item_name' => 'a']);