Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 33 additions & 0 deletions .github/workflows/code-style.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
name: Code Style

on: [pull_request]

jobs:
style:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2

- name: Cache composer dependencies
uses: actions/cache@v4
with:
path: vendor
key: composer-${{ hashFiles('**/composer.lock') }}
restore-keys: |
composer-

- uses: shivammathur/setup-php@v2
with:
php-version: 8.3
coverage: none

- name: Install Composer dependencies
run: composer install --no-interaction --prefer-dist --optimize-autoloader

- name: Run Prettier & Pint
run: ./vendor/bin/pint

- uses: stefanzweifel/git-auto-commit-action@v4
with:
commit_message: Apply formatting changes
44 changes: 22 additions & 22 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
@@ -1,29 +1,29 @@
name: Tests
# name: Tests

on: [pull_request]
# on: [pull_request]

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

steps:
- uses: actions/checkout@v2
# steps:
# - uses: actions/checkout@v2

- name: Cache composer dependencies
uses: actions/cache@v4
with:
path: vendor
key: composer-${{ hashFiles('**/composer.lock') }}
restore-keys: |
composer-
# - name: Cache composer dependencies
# uses: actions/cache@v4
# with:
# path: vendor
# key: composer-${{ hashFiles('**/composer.lock') }}
# restore-keys: |
# composer-

- uses: shivammathur/setup-php@v2
with:
php-version: 8.2
coverage: none
# - uses: shivammathur/setup-php@v2
# with:
# php-version: 8.2
# coverage: none

- name: Install Composer dependencies
run: composer install --no-interaction --prefer-dist --optimize-autoloader
# - name: Install Composer dependencies
# run: composer install --no-interaction --prefer-dist --optimize-autoloader

- name: Run Test suite
run: php artisan test -p
# - name: Run Test suite
# run: php artisan test -p
11 changes: 9 additions & 2 deletions app/Commands/CreateCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

use App\Data\Sandbox;
use App\Services\GitHub;
use Exception;
use LaravelZero\Framework\Commands\Command;

class CreateCommand extends Command
Expand All @@ -24,11 +25,17 @@ class CreateCommand extends Command
public function handle()
{
$sandbox = new Sandbox;
$this->components->task('Creating sandbox', fn () => $sandbox->addSite());

// Check if the sandbox already exists
if ($sandbox->getSite()) {
throw new Exception('The sandbox already exists');
}

$this->components->task('Creating sandbox', fn () => $sandbox->createSite());
$this->components->task('Mounting the repository', fn () => $sandbox->mountRepository());
$this->components->task('Updating the deployment script', fn () => $sandbox->updateDeployScript());
$this->components->task('Updating the environment variables', fn () => $sandbox->updateEnvironmentVars());
$this->components->task('Initiating first deploy', fn () => $sandbox->deploy());
$this->components->task('Posting details to GitHub', fn () => GitHub::postDeployDetails());
$this->components->task('Posting details to GitHub', fn () => GitHub::postCreateDetails());
}
}
9 changes: 8 additions & 1 deletion app/Commands/DestroyCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
namespace App\Commands;

use App\Data\Sandbox;
use App\Services\GitHub;
use Exception;
use LaravelZero\Framework\Commands\Command;

class DestroyCommand extends Command
Expand All @@ -24,11 +26,16 @@ public function handle()
{
$sandbox = new Sandbox;

if (! $sandbox->getSite()) {
throw new Exception('There is no sandbox to destroy');
}

// Create a database backup if the site has a backup provider set
if (config('forge.backup_provider')) {
if (config('forge.enable_db') && config('forge.backup_provider')) {
$this->components->task('Creating database backup', fn () => $sandbox->createDbBackup());
}

$this->components->task('Destroying sandbox', fn () => $sandbox->destroy());
$this->components->task('Posting details to GitHub', fn () => GitHub::postDestroyDetails());
}
}
Loading
Loading