From 582b0ef7d7f0a3865cc99f2a93ae1c941a45b792 Mon Sep 17 00:00:00 2001 From: emreakay Date: Mon, 5 Sep 2022 15:28:16 +0300 Subject: [PATCH 1/5] testing services --- .github/workflows/run-tests.yml | 23 +++++++++++++++ .../migrations/create_aissue_table.php.stub | 19 ------------- database/migrations/create_aissue_tables.php | 28 +++++++++++++++++++ phpunit.xml.dist | 11 ++++++++ src/AIssueServiceProvider.php | 17 ++++++++--- 5 files changed, 75 insertions(+), 23 deletions(-) delete mode 100644 database/migrations/create_aissue_table.php.stub create mode 100644 database/migrations/create_aissue_tables.php diff --git a/.github/workflows/run-tests.yml b/.github/workflows/run-tests.yml index 2fc238d..6f2912b 100644 --- a/.github/workflows/run-tests.yml +++ b/.github/workflows/run-tests.yml @@ -22,7 +22,26 @@ jobs: name: P${{ matrix.php }} - L${{ matrix.laravel }} - ${{ matrix.stability }} - ${{ matrix.os }} + services: + mysql: + image: mysql:8.0 + ports: + - 3306 + env: + MYSQL_ROOT_PASSWORD: aissue + MYSQL_PASSWORD: aissue + MYSQL_USER: aissue + MYSQL_DATABASE: aissue + options: --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=3 + steps: + + - name: Verify Mysql connection + run: | + mysql --version + sudo apt-get install -y mysql-client + mysql --host 127.0.0.1 --port ${{ job.services.mysql.ports['3306'] }} -uaissue -paissue -e "SHOW DATABASES" + - name: Checkout code uses: actions/checkout@v3 @@ -45,3 +64,7 @@ jobs: - name: Execute tests run: vendor/bin/pest + env: + DB_USERNAME: aauth + DB_PASSWORD: aauth + DB_PORT: ${{ job.services.mysql.ports[3306] }} diff --git a/database/migrations/create_aissue_table.php.stub b/database/migrations/create_aissue_table.php.stub deleted file mode 100644 index a197ae0..0000000 --- a/database/migrations/create_aissue_table.php.stub +++ /dev/null @@ -1,19 +0,0 @@ -id(); - - // add fields - - $table->timestamps(); - }); - } -}; diff --git a/database/migrations/create_aissue_tables.php b/database/migrations/create_aissue_tables.php new file mode 100644 index 0000000..fa88eb7 --- /dev/null +++ b/database/migrations/create_aissue_tables.php @@ -0,0 +1,28 @@ +id(); + $table->timestamps(); + }); + + Schema::create('aissue_issue_types', function (Blueprint $table) { + $table->id(); + $table->timestamps(); + }); + + } + + public function down(){ + Schema::dropIfExists('aissue_issues'); + Schema::dropIfExists('aissue_issue_types'); + } + +}; diff --git a/phpunit.xml.dist b/phpunit.xml.dist index a4b6c29..05abebc 100644 --- a/phpunit.xml.dist +++ b/phpunit.xml.dist @@ -36,4 +36,15 @@ + + + + + + + + + + + diff --git a/src/AIssueServiceProvider.php b/src/AIssueServiceProvider.php index c3e49b1..6a98958 100644 --- a/src/AIssueServiceProvider.php +++ b/src/AIssueServiceProvider.php @@ -17,9 +17,18 @@ public function configurePackage(Package $package): void */ $package ->name('aissue') - ->hasConfigFile() - ->hasViews() - ->hasMigration('create_aissue_table') - ->hasCommand(AIssueCommand::class); + ->hasConfigFile(); + // ->hasViews() + // ->hasMigration('create_aissue_table') + // ->hasCommand(AIssueCommand::class); + } + + public function boot() + { + parent::boot(); + + // load packages migrations + $this->loadMigrationsFrom(__DIR__ . '/../database/migrations'); + } } From 2a69ed3321dee62271bd1b9eb7ef568ea5ed43c1 Mon Sep 17 00:00:00 2001 From: emreakay Date: Mon, 5 Sep 2022 15:30:38 +0300 Subject: [PATCH 2/5] added docker-compose.yml for testing --- docker-compose.yml | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 docker-compose.yml diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 0000000..368c0d3 --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,20 @@ +version: '3.7' + +services: + mariadb: + image: mariadb:10.8 + ports: + - "33062:3306" + volumes: + - ~/apps/mariadb:/var/lib/mysql + environment: + - MYSQL_ROOT_PASSWORD=aissue + - MYSQL_PASSWORD=aissue + - MYSQL_USER=aissue + - MYSQL_DATABASE=aissue +networks: + default: + driver: bridge + ipam: + config: + - subnet: 172.16.57.0/24 From a999480bd41b28d541a7bba884aabfc669d9ad73 Mon Sep 17 00:00:00 2001 From: emreakay Date: Mon, 5 Sep 2022 15:43:16 +0300 Subject: [PATCH 3/5] added first unit test --- docker-compose.yml | 4 ++-- tests/ExampleTest.php | 5 ----- tests/Unit/AIssueTest.php | 5 +++++ 3 files changed, 7 insertions(+), 7 deletions(-) delete mode 100644 tests/ExampleTest.php create mode 100644 tests/Unit/AIssueTest.php diff --git a/docker-compose.yml b/docker-compose.yml index 368c0d3..68369dd 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -2,11 +2,11 @@ version: '3.7' services: mariadb: - image: mariadb:10.8 + image: mariadb:latest ports: - "33062:3306" volumes: - - ~/apps/mariadb:/var/lib/mysql + - ~/apps/mariadb-aissue:/var/lib/mysql environment: - MYSQL_ROOT_PASSWORD=aissue - MYSQL_PASSWORD=aissue diff --git a/tests/ExampleTest.php b/tests/ExampleTest.php deleted file mode 100644 index 5d36321..0000000 --- a/tests/ExampleTest.php +++ /dev/null @@ -1,5 +0,0 @@ -toBeTrue(); -}); diff --git a/tests/Unit/AIssueTest.php b/tests/Unit/AIssueTest.php new file mode 100644 index 0000000..0caeda5 --- /dev/null +++ b/tests/Unit/AIssueTest.php @@ -0,0 +1,5 @@ +assertTrue(true); +}); From f823b1993cb5ea6f13fda44adc8d427c17937f69 Mon Sep 17 00:00:00 2001 From: Emrullah Numan Sinan Date: Mon, 5 Sep 2022 16:18:16 +0300 Subject: [PATCH 4/5] migration tables filled --- database/migrations/create_aissue_tables.php | 21 ++++++++++++++++++-- tests/Unit/AIssueTest.php | 5 +++++ 2 files changed, 24 insertions(+), 2 deletions(-) diff --git a/database/migrations/create_aissue_tables.php b/database/migrations/create_aissue_tables.php index fa88eb7..103dfd2 100644 --- a/database/migrations/create_aissue_tables.php +++ b/database/migrations/create_aissue_tables.php @@ -9,12 +9,29 @@ public function up() { Schema::create('aissue_issues', function (Blueprint $table) { - $table->id(); + $table->bigIncrements('id'); + $table->string('code')->nullable(); + $table->string('model_type'); + $table->bigIncrements('model_id'); + $table->bigIncrements('assignee_id'); + $table->bigIncrements('creater_id'); + $table->bigIncrements('issue_type_id'); + $table->string('summary'); + $table->string('description'); + $table->bigIncrements('priority'); + $table->string('status'); + $table->dateTime('duedate'); + $table->boolean('archived'); + $table->bigIncrements('archived_by'); + $table->dateTime('archived_at'); $table->timestamps(); }); Schema::create('aissue_issue_types', function (Blueprint $table) { - $table->id(); + $table->bigIncrements('id'); + $table->string('workflow'); + $table->string('name'); + $table->string('description'); $table->timestamps(); }); diff --git a/tests/Unit/AIssueTest.php b/tests/Unit/AIssueTest.php index 0caeda5..52348d8 100644 --- a/tests/Unit/AIssueTest.php +++ b/tests/Unit/AIssueTest.php @@ -3,3 +3,8 @@ it('starts', function () { $this->assertTrue(true); }); + + +test('passOrAbort', function () { + expect(1)->toBeTruthy(); +}); From 2882989baddc8ee142be1a3223ce7c7ec6d88bb6 Mon Sep 17 00:00:00 2001 From: emreakay Date: Tue, 6 Sep 2022 16:13:53 +0300 Subject: [PATCH 5/5] changelog deleted --- .github/workflows/update-changelog.yml | 28 -------------------------- 1 file changed, 28 deletions(-) delete mode 100644 .github/workflows/update-changelog.yml diff --git a/.github/workflows/update-changelog.yml b/.github/workflows/update-changelog.yml deleted file mode 100644 index b20f3b6..0000000 --- a/.github/workflows/update-changelog.yml +++ /dev/null @@ -1,28 +0,0 @@ -name: "Update Changelog" - -on: - release: - types: [released] - -jobs: - update: - runs-on: ubuntu-latest - - steps: - - name: Checkout code - uses: actions/checkout@v3 - with: - ref: main - - - name: Update Changelog - uses: stefanzweifel/changelog-updater-action@v1 - with: - latest-version: ${{ github.event.release.name }} - release-notes: ${{ github.event.release.body }} - - - name: Commit updated CHANGELOG - uses: stefanzweifel/git-auto-commit-action@v4 - with: - branch: main - commit_message: Update CHANGELOG - file_pattern: CHANGELOG.md