Skip to content

Commit 640d3a1

Browse files
authored
Updated ci.yaml pipeline to run service and native client tests in seperate jobs (#125)
* Updated ci.yaml pipeline to run service and native client tests in seperate jobs. * Updated getTokenPathByOS helper to ensure, that the cache path exists when os.type() == 'Linux'
1 parent fa4a648 commit 640d3a1

3 files changed

Lines changed: 62 additions & 4 deletions

File tree

.github/workflows/ci.yaml

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,11 @@ jobs:
3737
- name: Build
3838
run: npm run build
3939

40+
- uses: actions/upload-artifact@v4
41+
with:
42+
name: build
43+
path: dist
44+
4045
- name: Audit
4146
run: npm audit
4247

@@ -46,6 +51,29 @@ jobs:
4651
- name: Test (Formatting)
4752
run: npm run test:formatting
4853

54+
test_service:
55+
name: Test (Service Client)
56+
runs-on: ubuntu-latest
57+
environment: QA
58+
needs: build
59+
60+
steps:
61+
- uses: actions/checkout@v3
62+
with:
63+
fetch-depth: 2
64+
65+
- uses: actions/setup-node@v3
66+
with:
67+
node-version: 20
68+
registry-url: https://registry.npmjs.org/
69+
70+
- name: Install dependencies
71+
run: npm ci
72+
73+
- uses: actions/download-artifact@v4
74+
with:
75+
name: build
76+
4977
- name: Test (Service Client)
5078
env:
5179
ITP_API_URL: ${{ vars.ITP_API_URL }}
@@ -55,6 +83,29 @@ jobs:
5583
ITP_MAILINATOR_API_KEY: ${{ secrets.ITP_MAILINATOR_API_KEY }}
5684
run: npm run test:service
5785

86+
test_native:
87+
name: Test (Native 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
106+
with:
107+
name: build
108+
58109
- name: Test (Native Client)
59110
env:
60111
ITP_API_URL: ${{ vars.ITP_API_URL }}

integration-tests/itwin/list.test.ts

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,13 @@ const tests = () => describe('list', () => {
2424
});
2525

2626
after(async () => {
27-
await runCommand(`itwin delete --itwin-id ${testITwin1Child.id}`);
28-
await runCommand(`itwin delete --itwin-id ${testITwin1.id}`);
29-
await runCommand(`itwin delete --itwin-id ${testITwin2.id}`);
27+
const deleteResult1 = await runCommand(`itwin delete --itwin-id ${testITwin1Child.id}`);
28+
const deleteResult2 = await runCommand(`itwin delete --itwin-id ${testITwin1.id}`);
29+
const deleteResult3 = await runCommand(`itwin delete --itwin-id ${testITwin2.id}`);
30+
31+
expect(deleteResult1.result).to.have.property('result', 'deleted');
32+
expect(deleteResult2.result).to.have.property('result', 'deleted');
33+
expect(deleteResult3.result).to.have.property('result', 'deleted');
3034
})
3135

3236
it('should fail when provided bad subClass', async () => {

integration-tests/utils/helpers.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -204,7 +204,10 @@ export const isNativeAuthAccessTokenCached = (): boolean => {
204204
const getTokenPathByOS = () => {
205205
switch (os.type()) {
206206
case 'Linux': {
207-
return `${os.homedir()}/.cache/itp/token.json`
207+
const cachePath = `${os.homedir()}/.cache/itp`
208+
if(!fs.existsSync(cachePath))
209+
fs.mkdirSync(cachePath, {recursive: true})
210+
return `${cachePath}/token.json`
208211
}
209212

210213
case 'Windows_NT': {

0 commit comments

Comments
 (0)