Skip to content

Commit d284bdb

Browse files
authored
Merge pull request #668 from aws-amplify/main
Release Amplify Codegen 08-15-2023
2 parents 612fd61 + cb28b9b commit d284bdb

File tree

20 files changed

+424
-347
lines changed

20 files changed

+424
-347
lines changed

.codebuild/cleanup_e2e_resources.yml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,4 +8,8 @@ env:
88
phases:
99
build:
1010
commands:
11-
- source ./shared-scripts.sh && _cleanupE2EResources
11+
- source ./shared-scripts.sh && _cleanupE2EResources
12+
artifacts:
13+
files:
14+
- '**/*'
15+
base-directory: $CODEBUILD_SRC_DIR/packages/amplify-codegen-e2e-tests/amplify-e2e-reports

.codebuild/cleanup_workflow.yml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,4 +9,8 @@ phases:
99
build:
1010
commands:
1111
- yarn production-build
12-
- cd packages/amplify-codegen-e2e-tests && yarn clean-e2e-resources
12+
- cd packages/amplify-codegen-e2e-tests && yarn clean-e2e-resources
13+
artifacts:
14+
files:
15+
- '**/*'
16+
base-directory: $CODEBUILD_SRC_DIR/packages/amplify-codegen-e2e-tests/amplify-e2e-reports

.codebuild/run_android_modelgen_e2e_test.yml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,10 +25,11 @@ phases:
2525
- source ./shared-scripts.sh && _runE2ETestsLinux
2626
post_build:
2727
commands:
28+
- source ./shared-scripts.sh && _unassumeTestAccountCredentials
2829
- aws sts get-caller-identity
2930
- source ./shared-scripts.sh && _scanArtifacts
3031

3132
artifacts:
3233
files:
33-
- $CODEBUILD_SRC_DIR/packages/amplify-codegen-e2e-tests/amplify-e2e-reports/*
34-
discard-paths: yes
34+
- '**/*'
35+
base-directory: $CODEBUILD_SRC_DIR/packages/amplify-codegen-e2e-tests/amplify-e2e-reports

.codebuild/run_e2e_tests.yml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,11 @@ phases:
1616
- source ./shared-scripts.sh && _runE2ETestsLinux
1717
post_build:
1818
commands:
19+
- source ./shared-scripts.sh && _unassumeTestAccountCredentials
1920
- aws sts get-caller-identity
2021
- source ./shared-scripts.sh && _scanArtifacts
2122

2223
artifacts:
2324
files:
24-
- $CODEBUILD_SRC_DIR/packages/amplify-codegen-e2e-tests/amplify-e2e-reports/*
25-
discard-paths: yes
25+
- '**/*'
26+
base-directory: $CODEBUILD_SRC_DIR/packages/amplify-codegen-e2e-tests/amplify-e2e-reports

.codebuild/run_ios_modelgen_e2e_test.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,5 +28,5 @@ phases:
2828

2929
artifacts:
3030
files:
31-
- $CODEBUILD_SRC_DIR/packages/amplify-codegen-e2e-tests/amplify-e2e-reports/*
32-
discard-paths: yes
31+
- '**/*'
32+
base-directory: $CODEBUILD_SRC_DIR/packages/amplify-codegen-e2e-tests/amplify-e2e-reports

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@
7070
"packages/*"
7171
],
7272
"devDependencies": {
73-
"@aws-amplify/amplify-cli-core": "^4.0.4",
73+
"@aws-amplify/amplify-cli-core": "^4.2.4-rc.43f73ab268.0",
7474
"@commitlint/cli": "^17.0.3",
7575
"@commitlint/config-conventional": "^17.0.3",
7676
"@commitlint/config-lerna-scopes": "^17.0.2",
@@ -119,7 +119,7 @@
119119
"typescript": "4.7.4"
120120
},
121121
"resolutions": {
122-
"@aws-amplify/amplify-cli-core": "4.0.4",
122+
"@aws-amplify/amplify-cli-core": "4.2.4-rc.43f73ab268.0",
123123
"minimist": "^1.2.6",
124124
"lodash": "^4.17.21",
125125
"node-fetch": "^2.6.7",

packages/amplify-codegen-e2e-core/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@
3939
"@types/ini": "^1.3.31"
4040
},
4141
"peerDependencies": {
42-
"@aws-amplify/amplify-cli-core": "^4.0.0",
42+
"@aws-amplify/amplify-cli-core": "^4.2.4-rc.43f73ab268.0",
4343
"amplify-headless-interface": "^1.13.1",
4444
"graphql-transformer-core": "^8.0.0"
4545
}

packages/amplify-codegen-e2e-core/src/nexpect-reporter.js

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -60,8 +60,10 @@ class AmplifyCLIExecutionReporter {
6060

6161
onRunComplete(contexts, results) {
6262
const { publicPath = process.cwd(), filename = 'jest_html_reporters.html', logoImgPath } = this._options;
63+
const runIdx = process.env['RUN_INDEX'] ?? '0';
6364
const logoImg = logoImgPath ? imgToBase64(logoImgPath) : undefined;
64-
fs.ensureDirSync(publicPath);
65+
const reportPath = path.join(publicPath, runIdx);
66+
fs.ensureDirSync(reportPath);
6567

6668
const processedResults = results.testResults.map(result => {
6769
const resultCopy = { ...result };
@@ -73,7 +75,7 @@ class AmplifyCLIExecutionReporter {
7375

7476
const recordingWithPath = recordings.map(r => {
7577
const castFile = `${uuid.v4()}.cast`;
76-
const castFilePath = path.join(publicPath, castFile);
78+
const castFilePath = path.join(reportPath, castFile);
7779
fs.writeFileSync(castFilePath, r.recording);
7880
const rCopy = { ...r };
7981
delete rCopy.recording;
@@ -98,7 +100,7 @@ class AmplifyCLIExecutionReporter {
98100
resultsWithRecordings._reporterOptions = { ...this._options, logoImg, customInfos: {} };
99101
const data = JSON.stringify(resultsWithRecordings);
100102

101-
const filePath = path.resolve(publicPath, filename);
103+
const filePath = path.resolve(reportPath, filename);
102104
// const filePathMock = path.resolve(publicPath, `devMock.json`);
103105
// fs.writeFileSync(filePathMock, data);
104106
const htmlTemplate = fs.readFileSync(localTemplatePath, 'utf-8');

packages/amplify-codegen-e2e-tests/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@
4141
"ts-node": "^8.10.1"
4242
},
4343
"peerDependencies": {
44-
"@aws-amplify/amplify-cli-core": "^4.0.0",
44+
"@aws-amplify/amplify-cli-core": "^4.2.4-rc.43f73ab268.0",
4545
"graphql-transformer-core": "^8.0.0"
4646
},
4747
"jest": {

packages/amplify-codegen-e2e-tests/src/cleanup-e2e-resources.ts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ const AWS_REGIONS_TO_RUN_TESTS = [
2020
'ap-southeast-2',
2121
];
2222

23-
const reportPath = path.normalize(path.join(__dirname, '..', 'amplify-e2e-reports', 'stale-resources.json'));
23+
const reportPathDir = path.normalize(path.join(__dirname, '..', 'amplify-e2e-reports'));
2424

2525
const MULTI_JOB_APP = '<Amplify App reused by multiple apps>';
2626
const ORPHAN = '<orphan>';
@@ -546,7 +546,8 @@ const deleteCfnStack = async (account: AWSAccountInfo, accountIndex: number, sta
546546
}
547547
};
548548

549-
const generateReport = (jobs: _.Dictionary<ReportEntry>): void => {
549+
const generateReport = (jobs: _.Dictionary<ReportEntry>, accountIdx: number): void => {
550+
const reportPath = path.join(reportPathDir, `stale-resources-${accountIdx}.json`);
550551
fs.ensureFileSync(reportPath);
551552
fs.writeFileSync(reportPath, JSON.stringify(jobs, null, 4));
552553
};
@@ -688,7 +689,7 @@ const cleanupAccount = async (account: AWSAccountInfo, accountIndex: number, fil
688689
const allResources = await mergeResourcesByCCIJob(apps, stacks, buckets, orphanBuckets, orphanIamRoles);
689690
const staleResources = _.pickBy(allResources, filterPredicate);
690691

691-
generateReport(staleResources);
692+
generateReport(staleResources, accountIndex);
692693
await deleteResources(account, accountIndex, staleResources);
693694
console.log(`${generateAccountInfo(account, accountIndex)} Cleanup done!`);
694695
};

0 commit comments

Comments
 (0)