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/.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 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..103dfd2 --- /dev/null +++ b/database/migrations/create_aissue_tables.php @@ -0,0 +1,45 @@ +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->bigIncrements('id'); + $table->string('workflow'); + $table->string('name'); + $table->string('description'); + $table->timestamps(); + }); + + } + + public function down(){ + Schema::dropIfExists('aissue_issues'); + Schema::dropIfExists('aissue_issue_types'); + } + +}; diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 0000000..68369dd --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,20 @@ +version: '3.7' + +services: + mariadb: + image: mariadb:latest + ports: + - "33062:3306" + volumes: + - ~/apps/mariadb-aissue:/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 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'); + } } 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..52348d8 --- /dev/null +++ b/tests/Unit/AIssueTest.php @@ -0,0 +1,10 @@ +assertTrue(true); +}); + + +test('passOrAbort', function () { + expect(1)->toBeTruthy(); +});