forked from entanet-devops/application
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request entanet-devops#4 from entanet-devops/PLAT-4359
Plat 4359
- Loading branch information
Showing
8 changed files
with
199 additions
and
95 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
|
||
.idea/ | ||
|
||
.DS_Store |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
- name: Print Craft CMS framework version | ||
debug: | ||
var: fact_craftcms_version | ||
verbosity: 1 | ||
|
||
- name: Check for outdated Craft CMS framework | ||
debug: | ||
msg: Craft CMS version ({{ fact_craftcms_version }}) is too old to deploy. Please update framework to v{{ minimum_craftcms_version }} or request a Platform override. | ||
verbosity: 0 | ||
when: fact_craftcms_version | regex_search('\d+[.]?\d*[.]?\d*') is not version(minimum_craftcms_version, '>=', strict=true) | ||
|
||
- include_tasks: platform-override.yml | ||
when: fact_craftcms_version | regex_search('\d+[.]?\d*[.]?\d*') is not version(minimum_craftcms_version, '>=', strict=true) | ||
|
||
- name: Check for codeception.yml | ||
stat: | ||
path: "{{ app_directory }}/codeception.yml" | ||
register: codeception_conf | ||
failed_when: not codeception_conf.stat.exists | ||
|
||
- name: Check for testing .env | ||
stat: | ||
path: "{{ app_directory }}/tests/.env" | ||
register: codeception_env | ||
failed_when: not codeception_env.stat.exists | ||
|
||
- name: Install mysql-client | ||
apt: | ||
name: mysql-client | ||
state: present | ||
install_recommends: no |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
- name: Print Laravel framework version | ||
debug: | ||
var: fact_laravel_version | ||
verbosity: 1 | ||
|
||
- name: Check for outdated Laravel framework | ||
debug: | ||
msg: Laravel version ({{ fact_laravel_version }}) is too old to deploy. Please update laravel framework to v{{ minimum_laravel_version }} or request a Platform override. | ||
verbosity: 0 | ||
when: fact_laravel_version | regex_search('\d+[.]?\d*[.]?\d*') is not version(minimum_laravel_version, '>=', strict=true) | ||
|
||
- include_tasks: platform-override.yml | ||
when: fact_laravel_version | regex_search('\d+[.]?\d*[.]?\d*') is not version(minimum_laravel_version, '>=', strict=true) | ||
|
||
- name: Check for .env.testing | ||
stat: | ||
path: "{{ app_directory }}/.env.testing" | ||
register: testing_env | ||
failed_when: not testing_env.stat.exists | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
- name: Awaiting Platform override... | ||
wait_for: | ||
path: /tmp/platform | ||
search_regex: ok | ||
state: present | ||
timeout: 3600 | ||
msg: Platform override timeout. | ||
|
||
- name: Platform override post actions | ||
file: | ||
path: /tmp/platform | ||
state: absent |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,29 +1,11 @@ | ||
- name: Check testing env | ||
stat: | ||
path: "{{ app_directory }}/.env.testing" | ||
register: run_tests | ||
|
||
- name: Check testing directory | ||
stat: | ||
path: "{{ app_directory }}/tests" | ||
register: has_tests | ||
|
||
- name: Run PHPUnit tests. | ||
block: | ||
- name: Copy testing env file | ||
copy: | ||
src: "{{ app_directory }}/.env.testing" | ||
dest: "{{ app_directory }}/.env" | ||
|
||
- name: Exec PHPUnit | ||
shell: './vendor/bin/phpunit' | ||
args: | ||
chdir: "{{ app_directory }}" | ||
when: run_tests.stat.exists | ||
|
||
- name: Remove testing env. | ||
file: | ||
path: "{{ app_directory }}/.env" | ||
state: absent | ||
when: delete_env_after_test | ||
when: run_tests.stat.exists and has_tests.stat.exists | ||
- name: Run PHPUnit | ||
shell: './vendor/bin/phpunit' | ||
args: | ||
chdir: "{{ app_directory }}" | ||
when: fact_laravel_version | length > 0 | ||
|
||
- name: Run Codeception | ||
shell: './vendor/bin/codecept run Unit' | ||
args: | ||
chdir: "{{ app_directory }}" | ||
when: fact_craftcms_version | length > 0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
- name: Load composer file | ||
shell: "cat {{ app_directory }}/composer.json" | ||
register: composer | ||
|
||
- name: Save composer output | ||
set_fact: | ||
jsondata: "{{ composer.stdout | from_json }}" | ||
|
||
- name: Check for Laravel framework | ||
set_fact: | ||
fact_laravel_version: "{{ jsondata | json_query(jmesquery) }}" | ||
vars: | ||
jmesquery: 'require."laravel/framework"' | ||
|
||
- name: Check for Craft CMS framework | ||
set_fact: | ||
fact_craftcms_version: "{{ jsondata | json_query(jmesquery) }}" | ||
vars: | ||
jmesquery: 'require."craftcms/cms"' | ||
|
||
- name: Check for unknown framework | ||
fail: | ||
msg: Could not recognise PHP framework. | ||
when: fact_laravel_version | length == 0 and fact_craftcms_version | length == 0 | ||
|
||
- name: Include Laravel tasks | ||
include_tasks: laravel.yml | ||
when: fact_laravel_version | length > 0 | ||
|
||
- name: Include Craft CMS tasks | ||
include_tasks: craftcms.yml | ||
when: fact_craftcms_version | length > 0 |