Skip to content

Commit

Permalink
Add test and deploy action
Browse files Browse the repository at this point in the history
Also removed some tests
  • Loading branch information
rajabilal555 committed Sep 15, 2024
1 parent e3a8a97 commit dc5bf49
Show file tree
Hide file tree
Showing 18 changed files with 106 additions and 354 deletions.
61 changes: 61 additions & 0 deletions .github/workflows/test-and-deploy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
name: Test and Deploy

on:
push:
branches: [ "main", "production" ]

jobs:
laravel-tests:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: 8.2
tools: composer:v2
- uses: pnpm/action-setup@v4
name: Install pnpm
with:
run_install: false
- name: Install Node.js
uses: actions/setup-node@v4
with:
node-version: 18
cache: 'pnpm'


- name: Copy .env
run: php -r "file_exists('.env') || copy('.env.example', '.env');"
- name: Install Dependencies
run: composer install -q --no-ansi --no-interaction --no-scripts --no-progress --prefer-dist
- name: Install dependencies
run: pnpm install
- name: Generate key
run: php artisan key:generate
- name: Directory Permissions
run: chmod -R 777 storage bootstrap/cache
- name: Run NPM Build
run: pnpm run build
- name: Create Database
run: |
mkdir -p database
touch database/database.sqlite
- name: Execute tests (Unit and Feature tests) via Pest
env:
DB_CONNECTION: sqlite
DB_DATABASE: database/database.sqlite
run: vendor/bin/pest --ci

deploy:
needs: laravel-tests
environment:
name: production
url: https://tekki.dev
runs-on: ubuntu-latest
if: github.ref == 'refs/heads/production'
steps:
# call the webhook
- name: Call the deployment webhook
run: 'curl -X POST "${{ secrets.CAPROVER_WEBHOOK_URL }}"'
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
"laravel/sail": "^1.26",
"mockery/mockery": "^1.6",
"nunomaduro/collision": "^8.0",
"pestphp/pest": "^2.0",
"pestphp/pest": "^2.35",
"pestphp/pest-plugin-laravel": "^2.0",
"spatie/laravel-ignition": "^2.4"
},
Expand Down
16 changes: 8 additions & 8 deletions composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 5 additions & 0 deletions database/factories/UserFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,11 @@ public function definition(): array
'name' => fake()->name(),
'email' => fake()->unique()->safeEmail(),
'email_verified_at' => now(),
'first_name' => fake()->firstName(),
'last_name' => fake()->lastName(),
'nick_name' => fake()->userName(),
'short_about' => fake()->sentence(),
'about' => fake()->paragraph(),
'password' => static::$password ??= Hash::make('password'),
'remember_token' => Str::random(10),
];
Expand Down
2 changes: 0 additions & 2 deletions database/seeders/DatabaseSeeder.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,6 @@ class DatabaseSeeder extends Seeder
*/
public function run(): void
{
// User::factory(10)->create();

User::factory()->create([
'name' => 'Test User',
'email' => 'test@example.com',
Expand Down
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
{
"private": true,
"type": "module",
"packageManager": "pnpm@9.10.0",
"scripts": {
"dev": "vite",
"build": "tsc && vite build && vite build --ssr"
Expand Down
41 changes: 0 additions & 41 deletions tests/Feature/Auth/AuthenticationTest.php

This file was deleted.

52 changes: 0 additions & 52 deletions tests/Feature/Auth/EmailVerificationTest.php

This file was deleted.

32 changes: 0 additions & 32 deletions tests/Feature/Auth/PasswordConfirmationTest.php

This file was deleted.

60 changes: 0 additions & 60 deletions tests/Feature/Auth/PasswordResetTest.php

This file was deleted.

40 changes: 0 additions & 40 deletions tests/Feature/Auth/PasswordUpdateTest.php

This file was deleted.

Loading

0 comments on commit dc5bf49

Please sign in to comment.