Skip to content

Commit 87f48e7

Browse files
authored
Capture build scans from TypeScript tests (#36197)
1 parent 75c3274 commit 87f48e7

6 files changed

Lines changed: 127 additions & 18 deletions

File tree

.github/workflows/typescript_tests.yml

Lines changed: 32 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,8 @@ on:
4242
concurrency:
4343
group: '${{ github.workflow }} @ ${{ github.event.issue.number || github.event.pull_request.head.label || github.sha || github.head_ref || github.ref }}-${{ github.event.schedule || github.event.comment.id || github.event.sender.login}}'
4444
cancel-in-progress: true
45+
env:
46+
DEVELOCITY_ACCESS_KEY: ${{ secrets.DEVELOCITY_ACCESS_KEY }}
4547
jobs:
4648
typescript_unit_tests:
4749
name: 'TypeScript Unit Tests'
@@ -59,19 +61,30 @@ jobs:
5961
- name: Install node
6062
uses: actions/setup-node@v5
6163
with:
62-
node-version: '16'
64+
node-version: '18'
65+
- name: Install Develocity npm Agent
66+
run: npm exec -y -- pacote extract @gradle-tech/develocity-agent@2.0.2 ~/.node_libraries/@gradle-tech/develocity-agent
67+
working-directory: ./sdks/typescript
6368
- run: npm ci
6469
working-directory: ./sdks/typescript
70+
env:
71+
NODE_OPTIONS: '-r @gradle-tech/develocity-agent/preload'
6572
- run: npm run build
6673
working-directory: ./sdks/typescript
74+
env:
75+
NODE_OPTIONS: '-r @gradle-tech/develocity-agent/preload'
6776
- run: npm run prettier-check
6877
working-directory: ./sdks/typescript
78+
env:
79+
NODE_OPTIONS: '-r @gradle-tech/develocity-agent/preload'
6980
if: contains(matrix.os, 'ubuntu-20.04')
7081
# - run: npm run codecovTest
7182
# working-directory: ./sdks/typescript
7283
# if: ${{ matrix.os == 'ubuntu-latest' }}
7384
- run: npm test
7485
working-directory: ./sdks/typescript
86+
env:
87+
NODE_OPTIONS: '-r @gradle-tech/develocity-agent/preload'
7588
# if: ${{ matrix.os != 'ubuntu-latest' }}
7689
typescript_xlang_tests:
7790
name: 'TypeScript xlang Tests'
@@ -90,7 +103,10 @@ jobs:
90103
- name: Install Node
91104
uses: actions/setup-node@v5
92105
with:
93-
node-version: '16'
106+
node-version: '18'
107+
- name: Install Develocity npm Agent
108+
run: npm exec -y -- pacote extract @gradle-tech/develocity-agent@2.0.2 ~/.node_libraries/@gradle-tech/develocity-agent
109+
working-directory: ./sdks/typescript
94110
- name: Install Python
95111
uses: actions/setup-python@v5
96112
with:
@@ -102,12 +118,17 @@ jobs:
102118
pip install -e .
103119
- run: npm ci
104120
working-directory: ./sdks/typescript
121+
env:
122+
NODE_OPTIONS: '-r @gradle-tech/develocity-agent/preload'
105123
- run: npm run build
106124
working-directory: ./sdks/typescript
125+
env:
126+
NODE_OPTIONS: '-r @gradle-tech/develocity-agent/preload'
107127
- run: npm test -- --grep "@xlang" --grep "@ulr"
108128
working-directory: ./sdks/typescript
109129
env:
110130
BEAM_SERVICE_OVERRIDES: '{"python:*": "python"}'
131+
NODE_OPTIONS: '-r @gradle-tech/develocity-agent/preload'
111132

112133
check_gcp_variables:
113134
timeout-minutes: 5
@@ -145,7 +166,10 @@ jobs:
145166
- name: Install node
146167
uses: actions/setup-node@v5
147168
with:
148-
node-version: '16'
169+
node-version: '18'
170+
- name: Install Develocity npm Agent
171+
run: npm exec -y -- pacote extract @gradle-tech/develocity-agent@2.0.2 ~/.node_libraries/@gradle-tech/develocity-agent
172+
working-directory: ./sdks/typescript
149173
- name: Install python
150174
uses: actions/setup-python@v5
151175
with:
@@ -157,12 +181,17 @@ jobs:
157181
pip install -e ".[gcp]"
158182
- run: npm ci
159183
working-directory: ./sdks/typescript
184+
env:
185+
NODE_OPTIONS: '-r @gradle-tech/develocity-agent/preload'
160186
- run: npm run build
161187
working-directory: ./sdks/typescript
188+
env:
189+
NODE_OPTIONS: '-r @gradle-tech/develocity-agent/preload'
162190
- run: npm test -- --grep "@dataflow"
163191
working-directory: ./sdks/typescript
164192
env:
165193
BEAM_SERVICE_OVERRIDES: '{"python:*": "python"}'
166194
GCP_PROJECT_ID: ${{ secrets.GCP_PROJECT_ID }}
167195
GCP_REGION: ${{ secrets.GCP_REGION }}
168196
GCP_TESTING_BUCKET: 'gs://${{ secrets.GCP_TESTING_BUCKET }}/tmp'
197+
NODE_OPTIONS: '-r @gradle-tech/develocity-agent/preload'

sdks/typescript/.mocharc.json

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
{
2+
"reporter": "cypress-multi-reporters",
3+
"reporter-option": [
4+
"configFile=reporterConfig.js"
5+
]
6+
}
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
// Licensed under the Apache License, Version 2.0 (the 'License'); you may not
2+
// use this file except in compliance with the License. You may obtain a copy of
3+
// the License at
4+
//
5+
// http://www.apache.org/licenses/LICENSE-2.0
6+
//
7+
// Unless required by applicable law or agreed to in writing, software
8+
// distributed under the License is distributed on an 'AS IS' BASIS, WITHOUT
9+
// WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
10+
// License for the specific language governing permissions and limitations under
11+
// the License.
12+
13+
module.exports = {
14+
projectId: 'beam',
15+
server: {
16+
url: 'https://develocity.apache.org',
17+
},
18+
}

sdks/typescript/package-lock.json

Lines changed: 53 additions & 15 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

sdks/typescript/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
"@typescript-eslint/eslint-plugin": "^5.24.0",
88
"@typescript-eslint/parser": "^5.24.0",
99
"codecov": "^3.8.3",
10+
"cypress-multi-reporters": "^2.0.5",
1011
"eslint": "^8.15.0",
1112
"istanbul": "^0.4.5",
1213
"js-yaml": "^4.1.0",

sdks/typescript/reporterConfig.js

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
// Licensed under the Apache License, Version 2.0 (the 'License'); you may not
2+
// use this file except in compliance with the License. You may obtain a copy of
3+
// the License at
4+
//
5+
// http://www.apache.org/licenses/LICENSE-2.0
6+
//
7+
// Unless required by applicable law or agreed to in writing, software
8+
// distributed under the License is distributed on an 'AS IS' BASIS, WITHOUT
9+
// WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
10+
// License for the specific language governing permissions and limitations under
11+
// the License.
12+
13+
const develocityReporter = require.resolve('@gradle-tech/develocity-agent/mocha-reporter');
14+
15+
module.exports = {
16+
reporterEnabled: ['spec', develocityReporter].join(', '),
17+
}

0 commit comments

Comments
 (0)