|
| 1 | +Name: build |
| 2 | +SchemaVersion: "1.0" |
| 3 | + |
| 4 | +# Optional - Set automatic triggers. |
| 5 | +Triggers: |
| 6 | + - Type: Push |
| 7 | + Branches: |
| 8 | + - main |
| 9 | + |
| 10 | +# Required - Define action configurations. |
| 11 | +Actions: |
| 12 | + List_Files: |
| 13 | + # Identifies the action. Do not modify this value. |
| 14 | + Identifier: aws/build@v1.0.0 |
| 15 | + |
| 16 | + # Specifies the source and/or artifacts to pass to the action as input. |
| 17 | + Inputs: |
| 18 | + # Optional |
| 19 | + Sources: |
| 20 | + - WorkflowSource # This specifies that the action requires this Workflow as a source |
| 21 | + |
| 22 | + # Defines the action's properties. |
| 23 | + Configuration: |
| 24 | + # Required - Steps are sequential instructions that run shell commands |
| 25 | + Steps: |
| 26 | + - Run: ls -l |
| 27 | + Mvn_Clean: |
| 28 | + DependsOn: |
| 29 | + - List_Files |
| 30 | + # Identifies the action. Do not modify this value. |
| 31 | + Identifier: aws/build@v1.0.0 |
| 32 | + |
| 33 | + # Specifies the source and/or artifacts to pass to the action as input. |
| 34 | + Inputs: |
| 35 | + # Optional |
| 36 | + Sources: |
| 37 | + - WorkflowSource # This specifies that the action requires this Workflow as a source |
| 38 | + |
| 39 | + # Defines the action's properties. |
| 40 | + Configuration: |
| 41 | + # Required - Steps are sequential instructions that run shell commands |
| 42 | + Steps: |
| 43 | + - Run: ./mvnw -ntp clean |
| 44 | + CodeGuruReview: |
| 45 | + DependsOn: |
| 46 | + - Mvn_Clean |
| 47 | + Identifier: aws/build@v1.0.0 |
| 48 | + Inputs: |
| 49 | + # Optional |
| 50 | + Sources: |
| 51 | + - WorkflowSource # This specifies that the action requires this Workflow as a source |
| 52 | + Outputs: |
| 53 | + Reports: |
| 54 | + MySAReport: |
| 55 | + Format: SARIFSA |
| 56 | + IncludePaths: |
| 57 | + - output/recommendations.sarif.json |
| 58 | + # SuccessCriteria: |
| 59 | + # StaticAnalysisBug: |
| 60 | + # Number: 25 |
| 61 | + # Severity: HIGH |
| 62 | + # StaticAnalysisSecurity: |
| 63 | + # Number: 5 |
| 64 | + # Severity: CRITICAL |
| 65 | + # StaticAnalysisQuality: |
| 66 | + # Number: 10 |
| 67 | + # Severity: INFORMATIONAL |
| 68 | + Configuration: |
| 69 | + # Required - Steps are sequential instructions that run shell commands |
| 70 | + Steps: |
| 71 | + # use run-tests $FRAMEWORK to enable advanced testing features such as test case retries |
| 72 | + # see info link in shell commands section for more details |
| 73 | + - Run: curl -OL https://github.com/aws/aws-codeguru-cli/releases/download/0.1.0/aws-codeguru-cli.zip |
| 74 | + - Run: unzip aws-codeguru-cli.zip |
| 75 | + - Run: export PATH=$PATH:./aws-codeguru-cli/bin |
| 76 | + - Run: ./mvnw -ntp verify |
| 77 | + - Run: aws-codeguru-cli --root-dir ./ --build target/classes --src src --output ./output --no-prompt |
| 78 | + Compute: |
| 79 | + Type: EC2 |
| 80 | + Environment: |
| 81 | + Connections: |
| 82 | + - Role: CodeCatalystTestEnvironmentRole |
| 83 | + Name: "123456789012" |
| 84 | + Name: TestEnvironment |
| 85 | + Mvn_Build_And_Deploy: |
| 86 | + DependsOn: |
| 87 | + - CodeGuruReview |
| 88 | + # Identifies the action. Do not modify this value. |
| 89 | + Identifier: aws/build@v1.0.0 |
| 90 | + # Specifies the source and/or artifacts to pass to the action as input. |
| 91 | + Inputs: |
| 92 | + # Optional |
| 93 | + Sources: |
| 94 | + - WorkflowSource # This specifies that the action requires this Workflow as a source |
| 95 | + Outputs: |
| 96 | + # Optional; Automatically discover reports for popular test frameworks |
| 97 | + AutoDiscoverReports: |
| 98 | + Enabled: true |
| 99 | + # Use as prefix for the report files |
| 100 | + ReportNamePrefix: AutoDiscovered |
| 101 | + Artifacts: |
| 102 | + - Name: jar_artifact |
| 103 | + Files: |
| 104 | + - target/*.jar |
| 105 | + # Defines the action's properties. |
| 106 | + Configuration: |
| 107 | + # Required - Steps are sequential instructions that run shell commands |
| 108 | + Steps: |
| 109 | + - Run: ./mvnw -ntp verify |
| 110 | + - Run: cp settings.xml $HOME/.m2/settings.xml |
| 111 | + - Run: ls $HOME/.m2/ |
| 112 | + - Run: export CODEARTIFACT_AUTH_TOKEN=`aws codeartifact get-authorization-token --domain artifact-store-demo --domain-owner 123456789012 --region us-east-1 --query authorizationToken --output text` |
| 113 | + - Run: mvn deploy |
| 114 | + Compute: |
| 115 | + Type: EC2 |
| 116 | + Environment: |
| 117 | + Connections: |
| 118 | + - Role: CodeCatalystTestEnvironmentRole |
| 119 | + Name: "123456789012" |
| 120 | + Name: TestEnvironment |
| 121 | + Build_Docker_Image: |
| 122 | + DependsOn: |
| 123 | + - Mvn_Build_And_Deploy |
| 124 | + # Identifies the action. Do not modify this value. |
| 125 | + Identifier: aws/managed-test@v1.0.0 |
| 126 | + |
| 127 | + # Specifies the source and/or artifacts to pass to the action as input. |
| 128 | + Inputs: |
| 129 | + # Optional |
| 130 | + Sources: |
| 131 | + - WorkflowSource # This specifies that the action requires this Workflow as a source |
| 132 | + Artifacts: |
| 133 | + - jar_artifact |
| 134 | + |
| 135 | + Outputs: |
| 136 | + # Optional; Automatically discover reports for popular test frameworks |
| 137 | + AutoDiscoverReports: |
| 138 | + Enabled: true |
| 139 | + # Use as prefix for the report files |
| 140 | + ReportNamePrefix: rpt |
| 141 | + |
| 142 | + # Defines the action's properties. |
| 143 | + Configuration: |
| 144 | + # Required - Steps are sequential instructions that run shell commands |
| 145 | + Steps: |
| 146 | + # use run-tests $FRAMEWORK to enable advanced testing features such as test case retries |
| 147 | + # see info link in shell commands section for more details |
| 148 | + - Run: mkdir target |
| 149 | + - Run: ls $CATALYST_SOURCE_DIR_jar_artifact |
| 150 | + - Run: cp $CATALYST_SOURCE_DIR_jar_artifact/target/*.jar ./target |
| 151 | + - Run: ls target/ |
| 152 | + - Run: export MVN_VERSION=`mvn help:evaluate -Dexpression=project.version -q -DforceStdout` |
| 153 | + - Run: docker login -u AWS -p $(aws ecr get-login-password --region us-east-1) 123456789012.dkr.ecr.us-east-1.amazonaws.com |
| 154 | + - Run: docker build -t rest-calculator . |
| 155 | + - Run: docker tag rest-calculator:latest 123456789012.dkr.ecr.us-east-1.amazonaws.com/rest-calculator:$MVN_VERSION |
| 156 | + - Run: docker push 123456789012.dkr.ecr.us-east-1.amazonaws.com/rest-calculator:$MVN_VERSION |
| 157 | + Compute: |
| 158 | + Type: EC2 |
| 159 | + Environment: |
| 160 | + Connections: |
| 161 | + - Role: CodeCatalystTestEnvironmentRole |
| 162 | + Name: "123456789012" |
| 163 | + Name: TestEnvironment |
0 commit comments