Skip to content

Commit 901bf41

Browse files
authored
Merge branch 'main' into tm-disable-client-sqs-context-test
2 parents a5bb350 + a8f3a3d commit 901bf41

File tree

8 files changed

+42
-81
lines changed

8 files changed

+42
-81
lines changed

.github/workflows/test-all-versions.pr.yml

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -16,22 +16,19 @@ jobs:
1616
env:
1717
PR_LABELS: ${{ toJSON(github.event.pull_request.labels.*.name) }}
1818
outputs:
19-
args: ${{ steps.lerna-args.outputs.args }}
19+
args: ${{ steps.npm-workspace-args.outputs.args }}
2020
steps:
2121
- name: Checkout
2222
uses: actions/checkout@v4
23-
# Need lerna to list all packages
24-
- name: Install lerna
25-
run: npm install -g lerna@6.6.2
26-
- name: Parse labels into lerna scope arguments
27-
id: lerna-args
23+
- name: Parse labels into npm workspace arguments
24+
id: npm-workspace-args
2825
run: |
29-
OUTPUT=`node scripts/parse-lerna-scopes.mjs "$PR_LABELS"`
26+
OUTPUT=`node scripts/pr-labels-to-npm-workspace-args.mjs "$PR_LABELS"`
3027
echo "args=$OUTPUT" >> $GITHUB_OUTPUT
3128
3229
tav:
3330
uses: ./.github/workflows/test-all-versions.yml
3431
needs: parse-labels
3532
with:
36-
lerna-args: ${{ needs.parse-labels.outputs.args }}
33+
npm-workspace-args: ${{ needs.parse-labels.outputs.args }}
3734
if: ${{ needs.parse-labels.outputs.args != '' }}

.github/workflows/test-all-versions.push.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,4 +10,4 @@ jobs:
1010
tav:
1111
uses: ./.github/workflows/test-all-versions.yml
1212
with:
13-
lerna-args: ""
13+
npm-workspace-args: ""

.github/workflows/test-all-versions.yml

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,11 @@ on:
44
- cron: "30 4 * * *"
55
workflow_dispatch:
66
inputs:
7-
lerna-args:
7+
npm-workspace-args:
88
type: string
99
workflow_call:
1010
inputs:
11-
lerna-args:
11+
npm-workspace-args:
1212
required: true
1313
type: string
1414

@@ -115,9 +115,6 @@ jobs:
115115
node-version: ${{ matrix.node }}
116116
- name: Set MySQL variables
117117
run: mysql --user=root --password=${MYSQL_ROOT_PASSWORD} --host=${MYSQL_HOST} --port=${MYSQL_PORT} -e "SET GLOBAL log_output='TABLE'; SET GLOBAL general_log = 1;" mysql
118-
- name: Legacy Peer Dependencies for npm 7
119-
if: matrix.node == '16'
120-
run: npm config set legacy-peer-deps=true
121118
- name: Update npm to a version that supports workspaces (v7 or later)
122119
if: ${{ matrix.node < 16 }}
123120
run: npm install -g npm@9 # npm@9 supports node >=14.17.0
@@ -126,4 +123,4 @@ jobs:
126123
- name: Build
127124
run: npm run compile
128125
- name: Run test-all-versions
129-
run: npx lerna run test-all-versions ${{ inputs.lerna-args }} ${{ matrix.lerna-extra-args }} --stream --concurrency 1
126+
run: npm run --if-present --workspaces test-all-versions ${{ inputs.npm-workspace-args }}

.github/workflows/unit-test.yml

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -123,9 +123,6 @@ jobs:
123123
node-version: ${{ matrix.node }}
124124
- name: Set MySQL variables
125125
run: mysql --user=root --password=${MYSQL_ROOT_PASSWORD} --host=${MYSQL_HOST} --port=${MYSQL_PORT} -e "SET GLOBAL log_output='TABLE'; SET GLOBAL general_log = 1;" mysql
126-
- name: Legacy Peer Dependencies for npm 7
127-
if: matrix.node == '16'
128-
run: npm config set legacy-peer-deps=true
129126
- name: Update npm to a version that supports workspaces (v7 or later)
130127
if: ${{ matrix.node < 16 }}
131128
run: npm install -g npm@9 # npm@9 supports node >=14.17.0
@@ -135,10 +132,10 @@ jobs:
135132
run: npm run compile
136133
- name: Unit tests (Full)
137134
if: matrix.code-coverage
138-
run: npm run test -- ${{ matrix.lerna-extra-args }}
135+
run: npm run test
139136
- name: Unit tests (Delta)
140137
if: ${{ !matrix.code-coverage }}
141-
run: npm run test:ci:changed -- ${{ matrix.lerna-extra-args }}
138+
run: npm run test:ci:changed
142139
- name: Build examples
143140
run: npm run compile:examples
144141
- name: Report Coverage

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
"test": "lerna run test",
2222
"test:ci:changed": "lerna run test --since origin/main",
2323
"test:browser": "lerna run test:browser --concurrency 1",
24+
"test-all-versions": "npm run --if-present --workspaces test-all-versions",
2425
"bump": "lerna publish",
2526
"changelog": "lerna-changelog",
2627
"lint": "lerna run lint",
Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,18 @@
11
"aws-sdk":
2-
# there are so many version to test, it can take forever.
3-
# we will just sample few of them
4-
versions: ">=2.1266.0 || 2.1262.0 || 2.1219.0 || 2.1048.0 || 2.1012.0 || 2.647.0 || 2.308.0"
2+
# A small subset of releases in the range [2.308.0, 3) to reduce testing time.
3+
versions: "2.308.0 || 2.548.0 || 2.785.0 || 2.1025.0 || 2.1265.0 || 2.1506.0 || >=2.1508.0"
54
commands:
65
- npm run test
76

87
"@aws-sdk/client-s3":
9-
versions: ">=3.223.0 || 3.218.0 || 3.216.0 || 3.154.0 || 3.107.0 || 3.54.0 || 3.6.1"
8+
# A small subset of releases in the range [3.6.1, 4) to reduce testing time.
9+
# - 3.377.0 was a bad release (see issue #1828).
10+
versions: "3.6.1 || 3.53.0 || 3.163.0 || 3.266.0 || 3.354.0 || 3.458.0 || >=3.462.0"
1011
commands:
1112
- npm run test
1213

1314
"@aws-sdk/client-sqs":
14-
versions: ">=3.216.0 || 3.171.0 || 3.58.0 || 3.54.0 || 3.43.0 || 3.24.0"
15+
# A small subset of releases in the range [3.24.0, 4) to reduce testing time.
16+
versions: "3.24.0 || 3.85.0 || 3.194.0 || 3.278.0 || 3.357.0 || 3.461.0 || >=3.462.0"
1517
commands:
1618
- npm run test

scripts/parse-lerna-scopes.mjs

Lines changed: 0 additions & 56 deletions
This file was deleted.
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
/**
2+
* Formats `-w WORKSPACE` arguments for `npm run` from "pkg:"-prefixed labels.
3+
* Takes a JSON string as an argument and returns the formatted args in stdout.
4+
*
5+
* arg: '["pkg:instrumentation-pino", "urgent", "pkg:instrumentation-fs"]'
6+
* stdout: '-w @opentelemetry/instrumentation-pino -w @opentelemetry/instrumentation-fs'
7+
*/
8+
9+
const labels = JSON.parse(process.argv[2]);
10+
11+
console.error('Labels:', labels);
12+
13+
const workspaces = labels
14+
.filter((l) => {
15+
return l.startsWith('pkg:');
16+
})
17+
.map((l) => {
18+
return l.replace(/^pkg:/, '@opentelemetry/');
19+
});
20+
21+
console.error('Workspaces:', workspaces);
22+
23+
console.log(workspaces.map((w) => { return `-w ${w}`; }).join(' '));

0 commit comments

Comments
 (0)