From 0832d3f31d5cfe777bbf352c786be37ed1154a3b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ren=C3=A9=20Klatt?= Date: Fri, 19 Aug 2022 16:37:52 +0200 Subject: [PATCH] APPS-4767: Adjusted app workflow to improve it and to use Mini Framework. (#186) * Updated ACP related stuff. * Fixed tests * Fixed tests * Fixed tests --- .github/workflows/ci.yml | 2 +- composer.lock | 14 ++++----- config/packages/workflow.yaml | 29 +++++++++++++------ .../Task/AcpAppAsyncApiCodeGenerateTask.yaml | 2 +- .../Task/AcpAppOpenApiCodeGenerateTask.yaml | 6 ++-- src/Extension/Task/AppValidationTaskSet.yaml | 2 +- src/Extension/Task/CodesnifferFixerTask.yaml | 2 +- src/Extension/Task/CodesnifferTask.yaml | 2 +- src/Extension/Task/PhpMdTask.yaml | 2 +- src/Extension/Task/RunInstallTask.yaml | 8 +++++ .../ValueResolver/AppTypeValueResolver.php | 2 +- .../AppTypeValueResolverTest.php | 4 +-- 12 files changed, 47 insertions(+), 28 deletions(-) create mode 100644 src/Extension/Task/RunInstallTask.yaml diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index c53e633a0..1c02c9ce1 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -12,7 +12,7 @@ on: jobs: validation: name: "CS, PHPStan, Security" - runs-on: ubuntu-18.04 + runs-on: ubuntu-22.04 strategy: fail-fast: false matrix: diff --git a/composer.lock b/composer.lock index 7523b79a7..f9900cd4b 100644 --- a/composer.lock +++ b/composer.lock @@ -6196,16 +6196,16 @@ }, { "name": "spryker-sdk/spryk", - "version": "0.4.2", + "version": "0.4.4", "source": { "type": "git", "url": "https://github.com/spryker-sdk/spryk.git", - "reference": "1372d01fe0af2373f749c12ce78a3fba7f38a2d8" + "reference": "8040c877e17cf14e91dd8e5532d7076490dd893b" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/spryker-sdk/spryk/zipball/1372d01fe0af2373f749c12ce78a3fba7f38a2d8", - "reference": "1372d01fe0af2373f749c12ce78a3fba7f38a2d8", + "url": "https://api.github.com/repos/spryker-sdk/spryk/zipball/8040c877e17cf14e91dd8e5532d7076490dd893b", + "reference": "8040c877e17cf14e91dd8e5532d7076490dd893b", "shasum": "" }, "require": { @@ -6230,9 +6230,9 @@ "description": "Spryk module", "support": { "issues": "https://github.com/spryker-sdk/spryk/issues", - "source": "https://github.com/spryker-sdk/spryk/tree/0.4.2" + "source": "https://github.com/spryker-sdk/spryk/tree/0.4.4" }, - "time": "2022-07-12T08:56:13+00:00" + "time": "2022-08-08T12:15:51+00:00" }, { "name": "spryker-sdk/sync-api", @@ -14294,5 +14294,5 @@ "composer-runtime-api": "^2.1" }, "platform-dev": [], - "plugin-api-version": "2.3.0" + "plugin-api-version": "2.2.0" } diff --git a/config/packages/workflow.yaml b/config/packages/workflow.yaml index bb5208929..b97e3210e 100644 --- a/config/packages/workflow.yaml +++ b/config/packages/workflow.yaml @@ -38,7 +38,7 @@ framework: supports: - SprykerSdk\SdkContracts\Entity\WorkflowInterface initial_marking: start - places: + places: # states - start - app-skeleton - manifest @@ -50,8 +50,10 @@ framework: - asyncapi - asyncapi-validated - asyncapi-generate + - install - app-validate - app-validated + - done transitions: CreateAppSkeleton: from: start @@ -78,7 +80,8 @@ framework: to: acp-validated metadata: task: acp:app:validate - error: Now you need to fix manually and continue with the workflow afterwards. + error: Please fix the mentioned issues and re-run the workflow to continue. + CreateOpenApi: from: acp-validated to: openapi @@ -89,12 +92,13 @@ framework: to: openapi-validated metadata: task: acp:openapi:validate - error: Now you need to fix manually and continue with the workflow afterwards. - GenerateOpenApi: + error: Please fix the mentioned issues and re-run the workflow to continue. + GenerateOpenApiCode: from: openapi-validated to: app-validate metadata: task: acp:openapi:generate + CreateAsyncapi: from: app-validate to: asyncapi @@ -105,16 +109,23 @@ framework: to: asyncapi-validated metadata: task: acp:asyncapi:validate - error: Now you need to fix manually and continue with the workflow afterwards. + error: Please fix the mentioned issues and re-run the workflow to continue. GenerateAsyncapiCode: from: asyncapi-validated to: asyncapi-generate metadata: task: acp:asyncapi:generate - ValidateApp: - from: [app-validate, app-validated, asyncapi-generate] + + RunInstall: + from: [app-validate, asyncapi-generate] to: app-validated metadata: - task: acp:app:validate - error: Now you need to fix manually and continue with the workflow afterwards. + task: install + + ValidateProject: + from: [app-validated, asyncapi-generate] + to: done + metadata: + task: pbc:validate + error: Please fix the mentioned issues and re-run the workflow to continue. diff --git a/src/Extension/Task/AcpAppAsyncApiCodeGenerateTask.yaml b/src/Extension/Task/AcpAppAsyncApiCodeGenerateTask.yaml index 7588c96a1..d90b1424b 100644 --- a/src/Extension/Task/AcpAppAsyncApiCodeGenerateTask.yaml +++ b/src/Extension/Task/AcpAppAsyncApiCodeGenerateTask.yaml @@ -22,5 +22,5 @@ placeholders: optional: true configuration: name: "organization" - description: "Path to AsyncAPI file" + description: "The namespace that will be used for code generation e.g. Pyz" type: string diff --git a/src/Extension/Task/AcpAppOpenApiCodeGenerateTask.yaml b/src/Extension/Task/AcpAppOpenApiCodeGenerateTask.yaml index cf1cea903..9fbc87ed2 100644 --- a/src/Extension/Task/AcpAppOpenApiCodeGenerateTask.yaml +++ b/src/Extension/Task/AcpAppOpenApiCodeGenerateTask.yaml @@ -22,19 +22,19 @@ placeholders: optional: true configuration: name: "openapi-file" - description: "Namespace that should be used for the code builder. When set to Spryker code will be generated in the core modules" + description: "Path to OpenAPI file" type: string - name: "%organization%" value_resolver: OPTION optional: true configuration: name: "organization" - description: "Path to AsyncAPI file" + description: "The namespace that will be used for code generation e.g. Pyz" type: string - name: "%application-type%" value_resolver: OPTION optional: true configuration: name: "application-type" - description: "Application type" + description: "Application type e.g. JSON" type: string diff --git a/src/Extension/Task/AppValidationTaskSet.yaml b/src/Extension/Task/AppValidationTaskSet.yaml index 865440317..1a7113a0c 100644 --- a/src/Extension/Task/AppValidationTaskSet.yaml +++ b/src/Extension/Task/AppValidationTaskSet.yaml @@ -1,5 +1,5 @@ --- -id: "acp:app:validate" +id: "pbc:validate" short_description: "Validates your php code using different approaches like codestyle, architecural and static analysis" help: "Validates your php code using different approaches like codestyle, architecural and static analysis" stage: build diff --git a/src/Extension/Task/CodesnifferFixerTask.yaml b/src/Extension/Task/CodesnifferFixerTask.yaml index 0c3765173..285cdfcf6 100644 --- a/src/Extension/Task/CodesnifferFixerTask.yaml +++ b/src/Extension/Task/CodesnifferFixerTask.yaml @@ -16,7 +16,7 @@ placeholders: optional: true configuration: name: 'severity' - description: 'Severity level' + description: 'Severity level of the CodeSniffer' - name: "%config%" value_resolver: CONFIG_PATH optional: true diff --git a/src/Extension/Task/CodesnifferTask.yaml b/src/Extension/Task/CodesnifferTask.yaml index fc3526f50..ebe10e80b 100644 --- a/src/Extension/Task/CodesnifferTask.yaml +++ b/src/Extension/Task/CodesnifferTask.yaml @@ -39,7 +39,7 @@ placeholders: optional: true configuration: name: 'severity' - description: 'Severity level' + description: 'Severity level of the CodeSniffer' report_converter: name: CheckstyleViolationReportConverter configuration: diff --git a/src/Extension/Task/PhpMdTask.yaml b/src/Extension/Task/PhpMdTask.yaml index 5432a9646..2dbd4a109 100644 --- a/src/Extension/Task/PhpMdTask.yaml +++ b/src/Extension/Task/PhpMdTask.yaml @@ -31,7 +31,7 @@ placeholders: optional: false configuration: name: "priority" - description: "Minimal priority of rules to fail the validation" + description: "Minimal PHPMD priority of rules to fail the validation" minValue: 1 maxValue: 10 defaultValue: 2 diff --git a/src/Extension/Task/RunInstallTask.yaml b/src/Extension/Task/RunInstallTask.yaml new file mode 100644 index 000000000..2ed6c1bfa --- /dev/null +++ b/src/Extension/Task/RunInstallTask.yaml @@ -0,0 +1,8 @@ +--- +id: "install" +short_description: "Runs Sprykers install command." +help: ~ +stage: build +version: 0.1.0 +command: "php ./vendor/bin/install" +type: local_cli diff --git a/src/Extension/ValueResolver/AppTypeValueResolver.php b/src/Extension/ValueResolver/AppTypeValueResolver.php index 9c31c65d2..2c7ed7b5d 100644 --- a/src/Extension/ValueResolver/AppTypeValueResolver.php +++ b/src/Extension/ValueResolver/AppTypeValueResolver.php @@ -16,7 +16,7 @@ class AppTypeValueResolver extends AbstractValueResolver * @var array */ protected const REPOSITORIES = [ - 'boilerplate' => 'https://github.com/spryker/project-boilerplate', + 'boilerplate' => 'https://github.com/spryker-projects/mini-framework', ]; /** diff --git a/tests/Sdk/Unit/Extension/ValueResolver/AppTypeValueResolverTest.php b/tests/Sdk/Unit/Extension/ValueResolver/AppTypeValueResolverTest.php index 33304d130..e4e162819 100644 --- a/tests/Sdk/Unit/Extension/ValueResolver/AppTypeValueResolverTest.php +++ b/tests/Sdk/Unit/Extension/ValueResolver/AppTypeValueResolverTest.php @@ -43,7 +43,7 @@ public function testGetValueIfEmpty(): void { // Arrange $repositories = [ - 'boilerplate' => 'https://github.com/spryker/project-boilerplate', + 'boilerplate' => 'https://github.com/spryker-projects/mini-framework', ]; $receiverValue = new ReceiverValue( 'App template to use for creation', @@ -63,6 +63,6 @@ public function testGetValueIfEmpty(): void $value = $valueResolver->getValue($this->context, []); // Assert - $this->assertSame('https://github.com/spryker/project-boilerplate', $value); + $this->assertSame('https://github.com/spryker-projects/mini-framework', $value); } }