Skip to content

Commit 13cd656

Browse files
committed
Replaced multiple jobs with parallel test execution within the same job.
1 parent 7b06257 commit 13cd656

10 files changed

Lines changed: 60 additions & 96 deletions

File tree

.github/workflows/ci.yaml

Lines changed: 7 additions & 66 deletions
Original file line numberDiff line numberDiff line change
@@ -75,45 +75,16 @@ jobs:
7575
name: build
7676

7777
- name: Test (Service Client)
78-
env:
79-
ITP_API_URL: ${{ vars.ITP_API_URL }}
80-
ITP_ISSUER_URL: ${{ vars.ITP_ISSUER_URL }}
81-
ITP_SERVICE_CLIENT_ID: ${{ vars.ITP_SERVICE_CLIENT_ID }}
82-
ITP_SERVICE_CLIENT_SECRET: ${{ secrets.ITP_SERVICE_CLIENT_SECRET }}
83-
ITP_MAILINATOR_API_KEY: ${{ secrets.ITP_MAILINATOR_API_KEY }}
84-
run: npm run test:service
85-
86-
test_service_populate:
87-
name: IModel Populate Tests (Service Client)
88-
runs-on: ubuntu-latest
89-
environment: QA
90-
needs: build
91-
92-
steps:
93-
- uses: actions/checkout@v3
94-
with:
95-
fetch-depth: 2
96-
97-
- uses: actions/setup-node@v3
98-
with:
99-
node-version: 20
100-
registry-url: https://registry.npmjs.org/
101-
102-
- name: Install dependencies
103-
run: npm ci
104-
105-
- uses: actions/download-artifact@v4
78+
uses: azure/powershell@v2
10679
with:
107-
name: build
108-
109-
- name: Test (Service Client)
80+
inlineScript: ./integration-tests/main-cases/service-client.ps1
81+
azPSVersion: "latest"
11082
env:
11183
ITP_API_URL: ${{ vars.ITP_API_URL }}
11284
ITP_ISSUER_URL: ${{ vars.ITP_ISSUER_URL }}
11385
ITP_SERVICE_CLIENT_ID: ${{ vars.ITP_SERVICE_CLIENT_ID }}
11486
ITP_SERVICE_CLIENT_SECRET: ${{ secrets.ITP_SERVICE_CLIENT_SECRET }}
11587
ITP_MAILINATOR_API_KEY: ${{ secrets.ITP_MAILINATOR_API_KEY }}
116-
run: npm run test:service-populate
11788

11889
test_native:
11990
name: Tests (Native Client)
@@ -139,44 +110,14 @@ jobs:
139110
name: build
140111

141112
- name: Test (Native Client)
142-
env:
143-
ITP_API_URL: ${{ vars.ITP_API_URL }}
144-
ITP_ISSUER_URL: ${{ vars.ITP_ISSUER_URL }}
145-
ITP_MAILINATOR_API_KEY: ${{ secrets.ITP_MAILINATOR_API_KEY }}
146-
ITP_NATIVE_TEST_CLIENT_ID: ${{ vars.ITP_NATIVE_TEST_CLIENT_ID }}
147-
ITP_TEST_USER_EMAIL: ${{ vars.ITP_TEST_USER_EMAIL }}
148-
ITP_TEST_USER_PASSWORD: ${{ secrets.ITP_TEST_USER_PASSWORD }}
149-
run: npm run test:native
150-
151-
test_native_populate:
152-
name: iModel Populate Tests (Native Client)
153-
runs-on: ubuntu-latest
154-
environment: QA
155-
needs: build
156-
157-
steps:
158-
- uses: actions/checkout@v3
159-
with:
160-
fetch-depth: 2
161-
162-
- uses: actions/setup-node@v3
163-
with:
164-
node-version: 20
165-
registry-url: https://registry.npmjs.org/
166-
167-
- name: Install dependencies
168-
run: npm ci
169-
170-
- uses: actions/download-artifact@v4
113+
uses: azure/powershell@v2
171114
with:
172-
name: build
173-
174-
- name: Test (Native Client)
115+
inlineScript: ./integration-tests/main-cases/service-client.ps1
116+
azPSVersion: "latest"
175117
env:
176118
ITP_API_URL: ${{ vars.ITP_API_URL }}
177119
ITP_ISSUER_URL: ${{ vars.ITP_ISSUER_URL }}
178120
ITP_MAILINATOR_API_KEY: ${{ secrets.ITP_MAILINATOR_API_KEY }}
179121
ITP_NATIVE_TEST_CLIENT_ID: ${{ vars.ITP_NATIVE_TEST_CLIENT_ID }}
180122
ITP_TEST_USER_EMAIL: ${{ vars.ITP_TEST_USER_EMAIL }}
181-
ITP_TEST_USER_PASSWORD: ${{ secrets.ITP_TEST_USER_PASSWORD }}
182-
run: npm run test:native-populate
123+
ITP_TEST_USER_PASSWORD: ${{ secrets.ITP_TEST_USER_PASSWORD }}

integration-tests/main-cases/native-client/native-client-populate.test.ts renamed to integration-tests/main-cases/native-client-parallel/native-client-populate.test.ts

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,16 +4,12 @@
44
*--------------------------------------------------------------------------------------------*/
55

66
import iModelPopulateTests from '../../imodel/populate.test';
7-
import { logoutFromCLI, nativeLoginToCli } from '../../utils/helpers';
7+
import { nativeLoginToCli } from '../../utils/helpers';
88

99
describe('Native Client Tests (imodel populate)', async () => {
1010
before(async () => {
1111
await nativeLoginToCli();
1212
})
13-
14-
after(async () => {
15-
await logoutFromCLI();
16-
})
1713

1814
iModelPopulateTests();
1915
});

integration-tests/main-cases/native-client/native-client.test.ts renamed to integration-tests/main-cases/native-client-parallel/native-client.test.ts

Lines changed: 1 addition & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -6,37 +6,24 @@
66
import accessControlTests from '../../access-control/access-control.test'
77
import accessControlNativeTests from '../../access-control-native/access-control-native.test'
88
import apiTests from '../../api.test'
9-
import authTests from '../../auth/auth.test'
109
import changedElementsTests from '../../changed-elements/changed-elements.test'
1110
import contextTests from '../../context/context.test'
1211
import imodelTests from '../../imodel/imodel.test'
1312
import itwinTests from '../../itwin/itwin.test'
1413
import storageTests from '../../storage/storage.test'
1514
import userTests from '../../user/user.test'
16-
import { logoutFromCLI, nativeLoginToCli } from '../../utils/helpers';
15+
import { nativeLoginToCli } from '../../utils/helpers';
1716

1817
describe('Native Client Tests', async () => {
1918
before(async () => {
2019
await nativeLoginToCli();
2120
})
2221

23-
after(async () => {
24-
await logoutFromCLI();
25-
})
26-
2722
describe('Access Control tests', () => {
2823
accessControlTests();
2924
accessControlNativeTests();
3025
});
3126

32-
describe('Authentication Integration Tests', async () => {
33-
after(async () => {
34-
await nativeLoginToCli();
35-
})
36-
37-
authTests();
38-
})
39-
4027
apiTests();
4128
changedElementsTests();
4229
contextTests();
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
/*---------------------------------------------------------------------------------------------
2+
* Copyright (c) Bentley Systems, Incorporated. All rights reserved.
3+
* See LICENSE.md in the project root for license terms and full copyright notice.
4+
*--------------------------------------------------------------------------------------------*/
5+
6+
import authTests from '../auth/auth.test'
7+
import { nativeLoginToCli } from '../utils/helpers';
8+
9+
describe('Native Client Tests (serial)', async () => {
10+
before(async () => {
11+
await nativeLoginToCli();
12+
})
13+
14+
describe('Authentication Integration Tests', async () => {
15+
after(async () => {
16+
await nativeLoginToCli();
17+
})
18+
19+
authTests();
20+
})
21+
});
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
Set-Location "$PSScriptRoot/../.."
2+
3+
./node_modules/.bin/mocha.ps1 --forbid-only integration-tests/main-cases/native-client-serial.test.ts
4+
5+
./node_modules/.bin/mocha.ps1 --forbid-only --parallel integration-tests/main-cases/native-client-parallel/*.test.ts

integration-tests/main-cases/service-client/service-client-populate.test.ts renamed to integration-tests/main-cases/service-client-parallel/service-client-populate.test.ts

File renamed without changes.

integration-tests/main-cases/service-client/service-client.test.ts renamed to integration-tests/main-cases/service-client-parallel/service-client.test.ts

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,6 @@
55

66
import accessControlTests from '../../access-control/access-control.test'
77
import apiTests from '../../api.test'
8-
import authTests from '../../auth/auth.test'
9-
import authTestsService from '../../auth-service/auth-service.test'
108
import changedElementsTests from '../../changed-elements/changed-elements.test'
119
import contextTests from '../../context/context.test'
1210
import imodelTests from '../../imodel/imodel.test'
@@ -21,11 +19,6 @@ describe('Service Client Tests', () => {
2119
})
2220
accessControlTests();
2321

24-
describe('Authentication Integration Tests', () => {
25-
authTestsService();
26-
authTests();
27-
});
28-
2922
apiTests();
3023
changedElementsTests();
3124
contextTests();
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
/*---------------------------------------------------------------------------------------------
2+
* Copyright (c) Bentley Systems, Incorporated. All rights reserved.
3+
* See LICENSE.md in the project root for license terms and full copyright notice.
4+
*--------------------------------------------------------------------------------------------*/
5+
6+
import authTests from '../auth/auth.test'
7+
import authTestsService from '../auth-service/auth-service.test'
8+
import { logoutFromCLI } from '../utils/helpers'
9+
10+
describe('Service Client Tests (serial)', () => {
11+
before(async () => {
12+
await logoutFromCLI();
13+
})
14+
describe('Authentication Integration Tests', () => {
15+
authTestsService();
16+
authTests();
17+
});
18+
});
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
Set-Location "$PSScriptRoot/../.."
2+
3+
./node_modules/.bin/mocha.ps1 --forbid-only integration-tests/main-cases/service-client-serial.test.ts
4+
5+
./node_modules/.bin/mocha.ps1 --forbid-only --parallel integration-tests/main-cases/service-client-parallel/*.test.ts

package.json

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -163,10 +163,8 @@
163163
"prepack": "oclif manifest && oclif readme",
164164
"test": "mocha --forbid-only \"integration-tests/main-cases/*.test.ts\"",
165165
"test:formatting": "mocha --forbid-only \"integration-tests/main-cases/formatting.test.ts\"",
166-
"test:service": "mocha --forbid-only \"integration-tests/main-cases/service-client/service-client.test.ts\"",
167-
"test:service-populate": "mocha --forbid-only \"integration-tests/main-cases/service-client/service-client-populate.test.ts\"",
168-
"test:native": "mocha --forbid-only \"integration-tests/main-cases/native-client/native-client.test.ts\"",
169-
"test:native-populate": "mocha --forbid-only \"integration-tests/main-cases/native-client/native-client-populate.test.ts\"",
166+
"test:service": "./integration-tests/main-cases/service-client.ps1",
167+
"test:native": "./integration-tests/main-cases/native-client.ps1",
170168
"version": "oclif readme && git add README.md"
171169
},
172170
"types": "dist/index.d.ts"

0 commit comments

Comments
 (0)