Skip to content

Commit

Permalink
Merge pull request #80 from Hi-Folks/develop
Browse files Browse the repository at this point in the history
v0.3.5
  • Loading branch information
roberto-butti authored May 17, 2021
2 parents 1c1a91b + 95a2238 commit 39e6128
Show file tree
Hide file tree
Showing 10 changed files with 99 additions and 12 deletions.
17 changes: 14 additions & 3 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
# Changelog

## 0.3.5 - 2021-05-17

### Add
- Deploy step with Ploi service. Thank you to @ashwind-19

## 0.3.4 - 2021-05-13

### Add
- Add wildcard for branch names
### Change
Expand All @@ -9,30 +15,35 @@
- cleaning some test workflows for GitHub Actions

## 0.3.3 - 2021-04-24

### Add
- Psalm as Static Code Analysis Tool
- Add composer install --no-dev before deploy

## 0.3.2 - 2021-04-22

### Add
- Postgresql template option

### Change
- Update some style (template cards and header)

## 0.3.1 - 2021-04-18

### Change
- Update default Node version to 15.x (stable)
- Fix some typos in the help labels in the Form
- Upgraded Node packages

## 0.3.0 - 2021-04-15

### Add
- Select Template option: Laravel application, PHP package, Laravel package ( #62 );
- Select tool for code static analysis ( #63 )


## 0.2.5 - 2021-04-12

### Add
- New option for installing phpstan in workflow
- New option for installing phpcs in workflow
Expand All @@ -47,22 +58,22 @@


## 0.2.4 - 2021-04-05

### Add
- Add Postgresql database

### Change
- Fix Dashboard when some old data is loaded (isMysqlService vs dataType)

## 0.2.3 - 2021-04-04

### Add
- Add Sqlite (in memory) support in your workflow (now the user can select: none, mysql or sqlite);
- Add Validation for Laravel version


### Change


## 0.2.2 - 2021-03-07

### Add
- All Hashcode configurations are logged into log_configurations table;
- Dashboard: Show the total configurations created daily;
Expand Down
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ __Ghygen__ allows you creating your __Yaml__ file for __GitHub Actions__, for La
- code sniffer (via phpcs for __PSR12__ compatibility);
- __validate Yaml__ file;
- execute __Browser Test__ via Laravel Dusk.
- Run __Deployments__ via Ploi using [Ploi Deploy Action](https://github.com/Glennmen/ploi-deploy-action).

This is a Work In Progress, we are adding new features...

Expand Down
12 changes: 10 additions & 2 deletions app/Http/Livewire/ConfiguratorForm.php
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,9 @@ class ConfiguratorForm extends Component
public $stepCachePackages; //true
public $stepCacheVendors; //true
public $stepCacheNpmModules; // true

public $stepDeployType;
public $stepDeployWebhookType;
public $stepDeployWebhookUrl;


public $result;
Expand Down Expand Up @@ -115,6 +117,9 @@ private function loadDefaults(): void
$this->stepCachePackages = true;
$this->stepCacheVendors = true;
$this->stepCacheNpmModules = true;
$this->stepDeployType = 'none';
$this->stepDeployWebhookType = 'secret';
$this->stepDeployWebhookUrl = "WEBHOOK_URL";

$this->loadDefaultsCodeQuality();
$this->loadDefaultsLaravelStuff();
Expand Down Expand Up @@ -329,7 +334,10 @@ public function submitForm()
"stepNodejsVersion",
"stepCachePackages",
"stepCacheVendors",
"stepCacheNpmModules"
"stepCacheNpmModules",
"stepDeployType",
"stepDeployWebhookType",
"stepDeployWebhookUrl"
);
$data = $this->setDataCodeQuality($data);
$data = $this->setDataLaravelStuff($data);
Expand Down
4 changes: 4 additions & 0 deletions resources/views/action_yaml.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -113,3 +113,7 @@
run: php --version

@include('yaml.code_quality')

@if ($stepDeployType === "ploi")
@include('yaml.deploy_ploi')
@endif
6 changes: 3 additions & 3 deletions resources/views/livewire/configurator-form.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@
model="mysqlPassword"
name="mysqlPassword"
label="MySql Password"
help="For secret, fill with the name of your parameter for example DB_PASSOWORD, for Hardcoded, fill with your password (valid only for CICD, not production or stage)">
help="For secret, fill with the name of your parameter for example DB_PASSWORD, for Hardcoded, fill with your password (valid only for CICD, not production or stage)">
</x-form.input-text>
</div>
</div>
Expand Down Expand Up @@ -227,7 +227,7 @@
model="postgresqlPassword"
name="postgresqlPassword"
label="Postgresqll Password"
help="For secret, fill with the name of your parameter for example DB_PASSOWORD, for Hardcoded, fill with your password (valid only for CICD, not production or stage)">
help="For secret, fill with the name of your parameter for example DB_PASSWORD, for Hardcoded, fill with your password (valid only for CICD, not production or stage)">
</x-form.input-text>
</div>
</div>
Expand Down Expand Up @@ -315,7 +315,7 @@

@include('livewire.form.laravel-stuff')
@include('livewire.form.code-quality')

@include('livewire.form.deploy')
</div>

<div class="border-2 border-blue-200 shadow-xl p-1 rounded-xl flex flex-row w-full text-right">
Expand Down
20 changes: 20 additions & 0 deletions resources/views/livewire/form/deploy.blade.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
<fieldset class="border-2 border-blue-200 shadow-xl p-4 rounded-xl" x-data="{ showPloiService: {{ $stepDeployType === 'ploi' ? 'true' : 'false' }}}">
<legend class="text-xl font-medium text-gray-900 px-2 pb-2">Deployment (Experimental feature)</legend>
<x-form.input-select model="stepDeployType" name="stepDeployType" label="Select Deployment Step" :list="['none'=>'None', 'ploi'=>'Ploi']" help="Deployment: *None* if you don't want to deploy the code in your workflow. Otherwise select from available options" multiselect=0 onChange='showPloiService= $event.target.value==="ploi";'>
</x-form.input-select>

<div x-show="showPloiService">
<div class="md:grid md:grid-cols-3 md:gap-3">

<div class="col-span-2">
<x-form.input-select model="stepDeployWebhookType" name="stepDeployWebhookType" label="Ploi Webhook URL: Read from secret or hardcoded" :list="['secret'=>'From Secret', 'hardcoded' => 'Hardcoded']" help="Ploi Webhook URL: Read from secret or hardcoded" multiselect=0>
</x-form.input-select>
</div>
<div class="col-span-1">
<x-form.input-text model="stepDeployWebhookUrl" name="stepDeployWebhookUrl" label="Webhook URL" help="For secret, fill with the name of your parameter for example WEBHOOK_URL, for Hardcoded, fill with your webhook URL">
</x-form.input-text>
</div>
</div>
</div>

</fieldset>
5 changes: 1 addition & 4 deletions resources/views/yaml/code_quality.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -44,9 +44,6 @@
@endif
@endif




@if ($stepDusk)
- name: Browser Test - upgrade and start Chrome Driver
run: |
Expand All @@ -62,4 +59,4 @@
@endif
php artisan dusk
@include('yaml.set_env')
@endif
@endif
12 changes: 12 additions & 0 deletions resources/views/yaml/deploy_ploi.blade.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# Deployment Step
- name: Deploy via Ploi
uses: Glennmen/ploi-deploy-action@v1.2.0
with:
@if ( $stepDeployWebhookType === 'secret' )
# loaded from secret
webhook_url: $@{{ secrets.WEBHOOK_URL }}
@endif
@if ( $stepDeployWebhookType === 'hardcoded' )
# loaded hardcoded
webhook_url: {{ $stepDeployWebhookUrl }}
@endif
28 changes: 28 additions & 0 deletions tests/Feature/DeployTest.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
<?php

namespace Tests\Feature;

use Illuminate\Foundation\Testing\DatabaseMigrations;
use Illuminate\Foundation\Testing\RefreshDatabase;
use Tests\TestCase;
use Livewire\Livewire;
use App\Http\Livewire\ConfiguratorForm;

class DeployTest extends TestCase
{

use DatabaseMigrations;

const DIR_MOCK ="tests/Feature/mock-asserts/";

public function testPloiDeploy()
{
Livewire::test(ConfiguratorForm::class)
->set("name","Test")
->set("stepDeployType","ploi")
->set("stepDeployWebhookType","secret")
->call('submitForm')
->assertSee(file_get_contents(base_path(self::DIR_MOCK."ploi-deploy.yaml")));
}

}
6 changes: 6 additions & 0 deletions tests/Feature/mock-asserts/ploi-deploy.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# Deployment Step
- name: Deploy via Ploi
uses: Glennmen/ploi-deploy-action@v1.2.0
with:
# loaded from secret
webhook_url: ${{ secrets.WEBHOOK_URL }}

0 comments on commit 39e6128

Please sign in to comment.