Skip to content

Commit

Permalink
Merge pull request #4 from vitodeploy/setup-tests
Browse files Browse the repository at this point in the history
setup tests
  • Loading branch information
saeedvaziry authored Aug 11, 2023
2 parents 2825b0e + 139acea commit 94aa003
Show file tree
Hide file tree
Showing 10 changed files with 76 additions and 289 deletions.
56 changes: 56 additions & 0 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
name: tests

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

jobs:
tests:
runs-on: ubuntu-20.04

services:
mysql:
image: mysql
env:
MYSQL_DATABASE: test_db
MYSQL_USER: user
MYSQL_PASSWORD: password
MYSQL_ROOT_PASSWORD: rootpassword
ports:
- 3306:3306
options: --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=3

strategy:
fail-fast: true
matrix:
php: [ 8.1 ]

steps:
- uses: actions/checkout@v2

- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php }}

- name: Cache Composer packages
id: composer-cache
uses: actions/cache@v2
with:
path: vendor
key: ${{ runner.os }}-php-${{ hashFiles('**/composer.lock') }}
restore-keys: |
${{ runner.os }}-php-
- name: Install dependencies
if: steps.composer-cache.outputs.cache-hit != 'true'
run: composer install --prefer-dist --no-progress --no-suggest

- name: Run test suite
run: php artisan test
env:
DB_HOST: 127.0.0.1
DB_DATABASE: test_db
DB_USERNAME: user
DB_PASSWORD: password
44 changes: 0 additions & 44 deletions app/Http/Livewire/SourceControls/Bitbucket.php

This file was deleted.

44 changes: 0 additions & 44 deletions app/Http/Livewire/SourceControls/Github.php

This file was deleted.

44 changes: 0 additions & 44 deletions app/Http/Livewire/SourceControls/Gitlab.php

This file was deleted.

48 changes: 0 additions & 48 deletions resources/views/livewire/source-controls/bitbucket.blade.php

This file was deleted.

48 changes: 0 additions & 48 deletions resources/views/livewire/source-controls/github.blade.php

This file was deleted.

48 changes: 0 additions & 48 deletions resources/views/livewire/source-controls/gitlab.blade.php

This file was deleted.

2 changes: 1 addition & 1 deletion tests/Feature/Http/ApplicationTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ public function test_visit_application()
$this->actingAs($this->user);

$this->get(
route('servers.sites.application', [
route('servers.sites.show', [
'server' => $this->server,
'site' => $this->site
])
Expand Down
5 changes: 3 additions & 2 deletions tests/Feature/Http/SitesTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,8 @@ public function test_create_site(): void

$this->actingAs($this->user);

\App\Models\SourceControl::factory()->create([
/** @var \App\Models\SourceControl $sourceControl */
$sourceControl = \App\Models\SourceControl::factory()->create([
'provider' => SourceControl::GITHUB,
]);

Expand All @@ -39,7 +40,7 @@ public function test_create_site(): void
->set('alias', 'www.example.com')
->set('php_version', '8.2')
->set('web_directory', 'public')
->set('source_control', SourceControl::GITHUB)
->set('source_control', $sourceControl->id)
->set('repository', 'test/test')
->set('branch', 'main')
->set('composer', true)
Expand Down
Loading

0 comments on commit 94aa003

Please sign in to comment.