Skip to content

Commit b03ce85

Browse files
Muzaffer AydinMuzaffer Aydin
authored andcommitted
Merge branch 'master' into muaydin/docdb-polling-bug-fix
2 parents bbe560a + 0536f09 commit b03ce85

File tree

530 files changed

+45107
-10955
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

530 files changed

+45107
-10955
lines changed

.eslintrc.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -162,7 +162,8 @@ module.exports = {
162162
'aws-toolkits/no-incorrect-once-usage': 'error',
163163
'aws-toolkits/no-string-exec-for-child-process': 'error',
164164
'aws-toolkits/no-console-log': 'error',
165-
165+
'aws-toolkits/no-json-stringify-in-log': 'error',
166+
'aws-toolkits/no-printf-mismatch': 'error',
166167
'no-restricted-imports': [
167168
'error',
168169
{
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
---
2+
name: unreliable test
3+
about: Help us monitor our test suite by reporting flaky tests.
4+
labels: tests-ci-cd
5+
---
6+
7+
## Test Details
8+
9+
- Name of test:
10+
- OS of failure:
11+
- VSCode version of failure (minimum/insider/stable):
12+
- Link to failing run:
13+
- Link to failing test:
14+
15+
## Log of Test Failure
16+
17+
## Additional Information
Lines changed: 86 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,86 @@
1+
# # github actions: https://docs.github.com/en/actions/use-cases-and-examples/building-and-testing/building-and-testing-nodejs
2+
# # setup-node: https://github.com/actions/setup-node
3+
4+
# name: Copy-Paste Detection
5+
6+
# on:
7+
# pull_request:
8+
# branches: [master, feature/*, staging]
9+
10+
# jobs:
11+
# jscpd:
12+
# runs-on: ubuntu-latest
13+
# strategy:
14+
# matrix:
15+
# node-version: [18.x]
16+
# env:
17+
# NODE_OPTIONS: '--max-old-space-size=8192'
18+
19+
# steps:
20+
# - uses: actions/checkout@v4
21+
# with:
22+
# fetch-depth: 0
23+
24+
# - name: Use Node.js ${{ matrix.node-version }}
25+
# uses: actions/setup-node@v4
26+
# with:
27+
# node-version: ${{ matrix.node-version }}
28+
29+
# - name: Fetch fork upstream
30+
# run: |
31+
# git remote add forkUpstream https://github.com/${{ github.event.pull_request.head.repo.full_name }} # URL of the fork
32+
# git fetch forkUpstream # Fetch fork
33+
34+
# - name: Determine base and target branches for comparison.
35+
# run: |
36+
# echo "CURRENT_BRANCH=${{ github.head_ref }}" >> $GITHUB_ENV
37+
# echo "TARGET_BRANCH=${{ github.event.pull_request.base.ref }}" >> $GITHUB_ENV
38+
# - run: git diff --name-only origin/$TARGET_BRANCH forkUpstream/$CURRENT_BRANCH > diff_output.txt
39+
# - run: |
40+
# npm install -g jscpd
41+
42+
# - run: jscpd --config "$GITHUB_WORKSPACE/.github/workflows/jscpd.json"
43+
44+
# - if: always()
45+
# uses: actions/upload-artifact@v4
46+
# with:
47+
# name: unfiltered-jscpd-report
48+
# path: ./jscpd-report.json
49+
50+
# - name: Filter jscpd report for changed files
51+
# run: |
52+
# if [ ! -f ./jscpd-report.json ]; then
53+
# echo "jscpd-report.json not found"
54+
# exit 1
55+
# fi
56+
# echo "Filtering jscpd report for changed files..."
57+
# CHANGED_FILES=$(jq -R -s -c 'split("\n")[:-1]' diff_output.txt)
58+
# echo "Changed files: $CHANGED_FILES"
59+
# jq --argjson changed_files "$CHANGED_FILES" '
60+
# .duplicates | map(select(
61+
# (.firstFile?.name as $fname | $changed_files | any(. == $fname)) or
62+
# (.secondFile?.name as $sname | $changed_files | any(. == $sname))
63+
# ))
64+
# ' ./jscpd-report.json > filtered-jscpd-report.json
65+
# cat filtered-jscpd-report.json
66+
67+
# - name: Check for duplicates
68+
# run: |
69+
# if [ $(wc -l < ./filtered-jscpd-report.json) -gt 1 ]; then
70+
# echo "filtered_report_exists=true" >> $GITHUB_ENV
71+
# else
72+
# echo "filtered_report_exists=false" >> $GITHUB_ENV
73+
# fi
74+
# - name: upload filtered report (if applicable)
75+
# if: env.filtered_report_exists == 'true'
76+
# uses: actions/upload-artifact@v4
77+
# with:
78+
# name: filtered-jscpd-report
79+
# path: ./filtered-jscpd-report.json
80+
81+
# - name: Fail and log found duplicates.
82+
# if: env.filtered_report_exists == 'true'
83+
# run: |
84+
# cat ./filtered-jscpd-report.json
85+
# echo "Duplications found, failing the check."
86+
# exit 1

.github/workflows/jscpd.json

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
{
2+
"pattern": "packages/**/*.ts",
3+
"ignore": ["**node_modules**", "**dist**", "**/scripts/**"],
4+
"gitignore": true,
5+
"threshold": 3.0,
6+
"minLines": 10,
7+
"output": "./",
8+
"reporters": ["json"]
9+
}

.github/workflows/node.js.yml

Lines changed: 7 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ jobs:
4141
runs-on: ubuntu-latest
4242
strategy:
4343
matrix:
44-
node-version: [16.x]
44+
node-version: [18.x]
4545
vscode-version: [stable]
4646
env:
4747
NODE_OPTIONS: '--max-old-space-size=8192'
@@ -62,7 +62,7 @@ jobs:
6262
strategy:
6363
fail-fast: false
6464
matrix:
65-
node-version: [16.x]
65+
node-version: [18.x]
6666
vscode-version: [minimum, stable, insiders]
6767
env:
6868
VSCODE_TEST_VERSION: ${{ matrix.vscode-version }}
@@ -80,23 +80,12 @@ jobs:
8080
uses: coactions/setup-xvfb@v1
8181
with:
8282
run: npm test
83-
- name: Code coverage (Core)
84-
env:
85-
# Unset NODE_OPTIONS because of https://github.com/codecov/uploader/issues/475
86-
NODE_OPTIONS: ''
87-
if: ${{ github.repository == 'aws/aws-toolkit-vscode' && github.ref == 'master' }}
88-
uses: codecov/codecov-action@v4
89-
with:
90-
flags: macos-core-unittests
91-
verbose: true
92-
file: ./coverage/core/lcov.info
93-
token: ${{ secrets.CODECOV_TOKEN }}
9483
- name: Code coverage (Toolkit)
9584
env:
9685
# Unset NODE_OPTIONS because of https://github.com/codecov/uploader/issues/475
9786
NODE_OPTIONS: ''
9887
if: ${{ github.repository == 'aws/aws-toolkit-vscode' && github.ref == 'master' }}
99-
uses: codecov/codecov-action@v4
88+
uses: codecov/codecov-action@v5
10089
with:
10190
flags: macos-toolkit-unittests
10291
verbose: true
@@ -107,23 +96,12 @@ jobs:
10796
# Unset NODE_OPTIONS because of https://github.com/codecov/uploader/issues/475
10897
NODE_OPTIONS: ''
10998
if: ${{ github.repository == 'aws/aws-toolkit-vscode' && github.ref == 'master' }}
110-
uses: codecov/codecov-action@v4
99+
uses: codecov/codecov-action@v5
111100
with:
112101
flags: macos-amazonq-unittests
113102
verbose: true
114103
file: ./coverage/amazonq/lcov.info
115104
token: ${{ secrets.CODECOV_TOKEN }}
116-
- name: Code coverage (CodeWhisperer)
117-
env:
118-
# Unset NODE_OPTIONS because of https://github.com/codecov/uploader/issues/475
119-
NODE_OPTIONS: ''
120-
if: ${{ github.repository == 'aws/aws-toolkit-vscode' && github.ref == 'master' }}
121-
uses: codecov/codecov-action@v4
122-
with:
123-
flags: codewhisperer
124-
verbose: true
125-
file: ./coverage/core/lcov.info
126-
token: ${{ secrets.CODECOV_TOKEN }}
127105

128106
web:
129107
needs: lint-commits
@@ -132,7 +110,7 @@ jobs:
132110
strategy:
133111
fail-fast: true
134112
matrix:
135-
node-version: [16.x]
113+
node-version: [18.x]
136114
vscode-version: [stable, insiders]
137115
env:
138116
VSCODE_TEST_VERSION: ${{ matrix.vscode-version }}
@@ -158,7 +136,7 @@ jobs:
158136
strategy:
159137
fail-fast: false
160138
matrix:
161-
node-version: [16.x]
139+
node-version: [18.x]
162140
vscode-version: [stable, insiders]
163141
env:
164142
VSCODE_TEST_VERSION: ${{ matrix.vscode-version }}
@@ -177,7 +155,7 @@ jobs:
177155
# Unset NODE_OPTIONS because of https://github.com/codecov/uploader/issues/475
178156
NODE_OPTIONS: ''
179157
if: ${{ github.repository == 'aws/aws-toolkit-vscode' && github.ref == 'master' }}
180-
uses: codecov/codecov-action@v4
158+
uses: codecov/codecov-action@v5
181159
with:
182160
flags: windows-unittests
183161
verbose: true

.github/workflows/notification.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ jobs:
3737
if: github.event_name == 'pull_request_target'
3838
with:
3939
node-version: '20'
40-
- name: Check for tests
40+
- name: Comment about contribution guidelines
4141
uses: actions/github-script@v7
4242
if: github.event_name == 'pull_request_target'
4343
with:

.github/workflows/notify.js

Lines changed: 16 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,10 @@
66
const { hasPath, dedupComment } = require('./utils')
77

88
const testFilesMessage =
9-
'This pull request modifies code in src/ but no tests were added/updated. Confirm whether tests should be added or ensure the PR description explains why tests are not required.'
9+
'- This pull request modifies code in `src/*` but no tests were added/updated.\n - Confirm whether tests should be added or ensure the PR description explains why tests are not required.\n'
1010

11-
const changelogMessage = `This pull request implements a feature or fix, so it must include a changelog entry. See [CONTRIBUTING.md#changelog](https://github.com/aws/aws-toolkit-vscode/blob/master/CONTRIBUTING.md#changelog) for instructions.`
11+
const changelogMessage =
12+
'- This pull request implements a `feat` or `fix`, so it must include a changelog entry (unless the fix is for an *unreleased* feature). Review the [changelog guidelines](https://github.com/aws/aws-toolkit-vscode/blob/master/CONTRIBUTING.md#changelog).\n - Note: beta or "experiment" features that have active users *should* announce fixes in the changelog.\n - If this is not a feature or fix, use an appropriate type from the [title guidelines](https://github.com/aws/aws-toolkit-vscode/blob/master/CONTRIBUTING.md#pull-request-title). For example, telemetry-only changes should use the `telemetry` type.\n'
1213

1314
/**
1415
* Remind partner teams that tests are required. We don't need to remind them if:
@@ -44,12 +45,16 @@ module.exports = async ({ github, context }) => {
4445
issue_number: pullRequestId,
4546
})
4647

48+
let msg = ''
4749
if (shouldAddTestFileMessage) {
48-
await dedupComment({ github, comments, owner, repo, pullRequestId, message: testFilesMessage })
50+
msg += testFilesMessage
4951
}
50-
5152
if (shouldAddChangelogMessage) {
52-
await dedupComment({ github, comments, owner, repo, pullRequestId, message: changelogMessage })
53+
msg += changelogMessage
54+
}
55+
56+
if (shouldAddTestFileMessage || shouldAddChangelogMessage) {
57+
await dedupComment({ github, comments, owner, repo, pullRequestId, message: msg })
5358
}
5459
}
5560

@@ -69,7 +74,12 @@ function requiresChangelogMessage(filenames, title) {
6974
* Require the test files message if there are changes to source files but aren't any
7075
* changes to the test files
7176
*/
72-
function requiresTestFilesMessage(filenames) {
77+
function requiresTestFilesMessage(filenames, title) {
78+
if (/^\s*[mM]erge/.test(title)) {
79+
console.log('"Merge" pull request')
80+
return
81+
}
82+
7383
// Check if src directory changed
7484
if (!hasPath(filenames, 'src/')) {
7585
console.log('Did not find src files in the code changes')

CONTRIBUTING.md

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -188,11 +188,11 @@ To run a single test in VSCode, do any one of:
188188
189189
- Unix/macOS/POSIX shell:
190190
```
191-
TEST_FILE=src/test/foo.test.ts npm run test
191+
TEST_FILE=../core/src/test/foo.test.ts npm run test
192192
```
193193
- Powershell:
194194
```
195-
$Env:TEST_FILE = "src/test/foo.test.ts"; npm run test
195+
$Env:TEST_FILE = "../core/src/test/foo.test.ts"; npm run test
196196
```
197197
198198
- To run all tests in a particular subdirectory, you can edit
@@ -209,16 +209,26 @@ To run tests against a specific folder in VSCode, do any one of:
209209
- Run in your terminal
210210
- Unix/macOS/POSIX shell:
211211
```
212-
TEST_DIR=src/test/foo npm run test
212+
TEST_DIR=../core/src/test/foo npm run test
213213
```
214214
- Powershell:
215215
```
216-
$Env:TEST_DIR = "src/test/foo"; npm run test
216+
$Env:TEST_DIR = "../core/src/test/foo"; npm run test
217217
```
218218
219+
#### Run jscpd ("Copy-Paste Detection")
220+
221+
If the "Copy-Paste Detection" CI job fails, you will find it useful to check things locally. To
222+
check a specific file:
223+
224+
npx jscpd --config .github/workflows/jscpd.json --pattern packages/…/src/foo.ts
225+
226+
See the [jscpd cli documentation](https://github.com/kucherenko/jscpd/tree/master/apps/jscpd) for
227+
more options.
228+
219229
### Coverage report
220230
221-
You can find the coverage report at `./coverage/amazonq/lcov-report/index.html` and `./coverage/core/lcov-report/index.html` after running the tests. Tests ran from the workspace launch config won't generate a coverage report automatically because it can break file watching.
231+
You can find the coverage report at `./coverage/amazonq/lcov-report/index.html` and `./coverage/toolkit/lcov-report/index.html` after running the tests. Tests ran from the workspace launch config won't generate a coverage report automatically because it can break file watching.
222232
223233
### CodeCatalyst Blueprints
224234

buildspec/linuxE2ETests.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ phases:
4141
- VCS_COMMIT_ID="${CODEBUILD_RESOLVED_SOURCE_VERSION}"
4242
- CI_BUILD_URL=$(echo $CODEBUILD_BUILD_URL | sed 's/#/%23/g')
4343
- CI_BUILD_ID="${CODEBUILD_BUILD_ID}"
44-
- test -n "${CODECOV_TOKEN}" && [ "$TARGET_BRANCH" = "master" ] && ./codecov --token=${CODECOV_TOKEN} --branch=${CODEBUILD_RESOLVED_SOURCE_VERSION} --repository=${CODEBUILD_SOURCE_REPO_URL} --file=./coverage/core/lcov.info --file=./coverage/amazonq/lcov.info --file=./coverage/toolkit/lcov.info
44+
- test -n "${CODECOV_TOKEN}" && [ "$TARGET_BRANCH" = "master" ] && ./codecov --token=${CODECOV_TOKEN} --branch=${CODEBUILD_RESOLVED_SOURCE_VERSION} --repository=${CODEBUILD_SOURCE_REPO_URL} --file=./coverage/amazonq/lcov.info --file=./coverage/toolkit/lcov.info
4545
finally:
4646
- rm -rf ~/.aws/sso/cache || true
4747
reports:

buildspec/linuxIntegrationTests.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ phases:
2121
install:
2222
run-as: root
2323
runtime-versions:
24-
nodejs: 16
24+
nodejs: 18
2525
dotnet: 6.0
2626
java: latest
2727

@@ -75,7 +75,7 @@ phases:
7575
- VCS_COMMIT_ID="${CODEBUILD_RESOLVED_SOURCE_VERSION}"
7676
- CI_BUILD_URL=$(echo $CODEBUILD_BUILD_URL | sed 's/#/%23/g')
7777
- CI_BUILD_ID="${CODEBUILD_BUILD_ID}"
78-
- test -n "${CODECOV_TOKEN}" && [ "$TARGET_BRANCH" = "master" ] && ./codecov --token=${CODECOV_TOKEN} --branch=${CODEBUILD_RESOLVED_SOURCE_VERSION} --repository=${CODEBUILD_SOURCE_REPO_URL} --file=./coverage/core/lcov.info --file=./coverage/amazonq/lcov.info --file=./coverage/toolkit/lcov.info
78+
- test -n "${CODECOV_TOKEN}" && [ "$TARGET_BRANCH" = "master" ] && ./codecov --token=${CODECOV_TOKEN} --branch=${CODEBUILD_RESOLVED_SOURCE_VERSION} --repository=${CODEBUILD_SOURCE_REPO_URL} --file=./coverage/amazonq/lcov.info --file=./coverage/toolkit/lcov.info
7979
post_build:
8080
commands:
8181
# Destroy .netrc to avoid leaking $GITHUB_READONLY_TOKEN.

0 commit comments

Comments
 (0)