Skip to content

Commit 39e6128

Browse files
Merge pull request #80 from Hi-Folks/develop
v0.3.5
2 parents 1c1a91b + 95a2238 commit 39e6128

File tree

10 files changed

+99
-12
lines changed

10 files changed

+99
-12
lines changed

CHANGELOG.md

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,12 @@
11
# Changelog
22

3+
## 0.3.5 - 2021-05-17
4+
5+
### Add
6+
- Deploy step with Ploi service. Thank you to @ashwind-19
7+
38
## 0.3.4 - 2021-05-13
9+
410
### Add
511
- Add wildcard for branch names
612
### Change
@@ -9,30 +15,35 @@
915
- cleaning some test workflows for GitHub Actions
1016

1117
## 0.3.3 - 2021-04-24
18+
1219
### Add
1320
- Psalm as Static Code Analysis Tool
1421
- Add composer install --no-dev before deploy
1522

1623
## 0.3.2 - 2021-04-22
24+
1725
### Add
1826
- Postgresql template option
1927

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

2331
## 0.3.1 - 2021-04-18
32+
2433
### Change
2534
- Update default Node version to 15.x (stable)
2635
- Fix some typos in the help labels in the Form
2736
- Upgraded Node packages
2837

2938
## 0.3.0 - 2021-04-15
39+
3040
### Add
3141
- Select Template option: Laravel application, PHP package, Laravel package ( #62 );
3242
- Select tool for code static analysis ( #63 )
3343

3444

3545
## 0.2.5 - 2021-04-12
46+
3647
### Add
3748
- New option for installing phpstan in workflow
3849
- New option for installing phpcs in workflow
@@ -47,22 +58,22 @@
4758

4859

4960
## 0.2.4 - 2021-04-05
61+
5062
### Add
5163
- Add Postgresql database
5264

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

5668
## 0.2.3 - 2021-04-04
69+
5770
### Add
5871
- Add Sqlite (in memory) support in your workflow (now the user can select: none, mysql or sqlite);
5972
- Add Validation for Laravel version
6073

6174

62-
### Change
63-
64-
6575
## 0.2.2 - 2021-03-07
76+
6677
### Add
6778
- All Hashcode configurations are logged into log_configurations table;
6879
- Dashboard: Show the total configurations created daily;

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ __Ghygen__ allows you creating your __Yaml__ file for __GitHub Actions__, for La
2626
- code sniffer (via phpcs for __PSR12__ compatibility);
2727
- __validate Yaml__ file;
2828
- execute __Browser Test__ via Laravel Dusk.
29+
- Run __Deployments__ via Ploi using [Ploi Deploy Action](https://github.com/Glennmen/ploi-deploy-action).
2930

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

app/Http/Livewire/ConfiguratorForm.php

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,9 @@ class ConfiguratorForm extends Component
6666
public $stepCachePackages; //true
6767
public $stepCacheVendors; //true
6868
public $stepCacheNpmModules; // true
69-
69+
public $stepDeployType;
70+
public $stepDeployWebhookType;
71+
public $stepDeployWebhookUrl;
7072

7173

7274
public $result;
@@ -115,6 +117,9 @@ private function loadDefaults(): void
115117
$this->stepCachePackages = true;
116118
$this->stepCacheVendors = true;
117119
$this->stepCacheNpmModules = true;
120+
$this->stepDeployType = 'none';
121+
$this->stepDeployWebhookType = 'secret';
122+
$this->stepDeployWebhookUrl = "WEBHOOK_URL";
118123

119124
$this->loadDefaultsCodeQuality();
120125
$this->loadDefaultsLaravelStuff();
@@ -329,7 +334,10 @@ public function submitForm()
329334
"stepNodejsVersion",
330335
"stepCachePackages",
331336
"stepCacheVendors",
332-
"stepCacheNpmModules"
337+
"stepCacheNpmModules",
338+
"stepDeployType",
339+
"stepDeployWebhookType",
340+
"stepDeployWebhookUrl"
333341
);
334342
$data = $this->setDataCodeQuality($data);
335343
$data = $this->setDataLaravelStuff($data);

resources/views/action_yaml.blade.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -113,3 +113,7 @@
113113
run: php --version
114114

115115
@include('yaml.code_quality')
116+
117+
@if ($stepDeployType === "ploi")
118+
@include('yaml.deploy_ploi')
119+
@endif

resources/views/livewire/configurator-form.blade.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -176,7 +176,7 @@
176176
model="mysqlPassword"
177177
name="mysqlPassword"
178178
label="MySql Password"
179-
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)">
179+
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)">
180180
</x-form.input-text>
181181
</div>
182182
</div>
@@ -227,7 +227,7 @@
227227
model="postgresqlPassword"
228228
name="postgresqlPassword"
229229
label="Postgresqll Password"
230-
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)">
230+
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)">
231231
</x-form.input-text>
232232
</div>
233233
</div>
@@ -315,7 +315,7 @@
315315

316316
@include('livewire.form.laravel-stuff')
317317
@include('livewire.form.code-quality')
318-
318+
@include('livewire.form.deploy')
319319
</div>
320320

321321
<div class="border-2 border-blue-200 shadow-xl p-1 rounded-xl flex flex-row w-full text-right">
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
<fieldset class="border-2 border-blue-200 shadow-xl p-4 rounded-xl" x-data="{ showPloiService: {{ $stepDeployType === 'ploi' ? 'true' : 'false' }}}">
2+
<legend class="text-xl font-medium text-gray-900 px-2 pb-2">Deployment (Experimental feature)</legend>
3+
<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";'>
4+
</x-form.input-select>
5+
6+
<div x-show="showPloiService">
7+
<div class="md:grid md:grid-cols-3 md:gap-3">
8+
9+
<div class="col-span-2">
10+
<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>
11+
</x-form.input-select>
12+
</div>
13+
<div class="col-span-1">
14+
<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">
15+
</x-form.input-text>
16+
</div>
17+
</div>
18+
</div>
19+
20+
</fieldset>

resources/views/yaml/code_quality.blade.php

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -44,9 +44,6 @@
4444
@endif
4545
@endif
4646

47-
48-
49-
5047
@if ($stepDusk)
5148
- name: Browser Test - upgrade and start Chrome Driver
5249
run: |
@@ -62,4 +59,4 @@
6259
@endif
6360
php artisan dusk
6461
@include('yaml.set_env')
65-
@endif
62+
@endif
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
# Deployment Step
2+
- name: Deploy via Ploi
3+
uses: Glennmen/ploi-deploy-action@v1.2.0
4+
with:
5+
@if ( $stepDeployWebhookType === 'secret' )
6+
# loaded from secret
7+
webhook_url: $@{{ secrets.WEBHOOK_URL }}
8+
@endif
9+
@if ( $stepDeployWebhookType === 'hardcoded' )
10+
# loaded hardcoded
11+
webhook_url: {{ $stepDeployWebhookUrl }}
12+
@endif

tests/Feature/DeployTest.php

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
<?php
2+
3+
namespace Tests\Feature;
4+
5+
use Illuminate\Foundation\Testing\DatabaseMigrations;
6+
use Illuminate\Foundation\Testing\RefreshDatabase;
7+
use Tests\TestCase;
8+
use Livewire\Livewire;
9+
use App\Http\Livewire\ConfiguratorForm;
10+
11+
class DeployTest extends TestCase
12+
{
13+
14+
use DatabaseMigrations;
15+
16+
const DIR_MOCK ="tests/Feature/mock-asserts/";
17+
18+
public function testPloiDeploy()
19+
{
20+
Livewire::test(ConfiguratorForm::class)
21+
->set("name","Test")
22+
->set("stepDeployType","ploi")
23+
->set("stepDeployWebhookType","secret")
24+
->call('submitForm')
25+
->assertSee(file_get_contents(base_path(self::DIR_MOCK."ploi-deploy.yaml")));
26+
}
27+
28+
}
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
# Deployment Step
2+
- name: Deploy via Ploi
3+
uses: Glennmen/ploi-deploy-action@v1.2.0
4+
with:
5+
# loaded from secret
6+
webhook_url: ${{ secrets.WEBHOOK_URL }}

0 commit comments

Comments
 (0)