Skip to content

Commit 25c8201

Browse files
authored
ci: update circle ci config for all-nuts job (#178)
* ci: update circle ci config for all-nuts job * test: correct tests for windows
1 parent 26ff02e commit 25c8201

File tree

3 files changed

+101
-9
lines changed

3 files changed

+101
-9
lines changed

.circleci/config.yml

+78-8
Original file line numberDiff line numberDiff line change
@@ -1,43 +1,89 @@
11
version: 2.1
22
orbs:
33
release-management: salesforce/npm-release-management@4
4+
parameters:
5+
run-auto-workflows:
6+
description: >
7+
Boolean that controls when an workflow would run.
8+
9+
It is used to gate which workflows should run when github events occur.
10+
11+
This parameter is used by automation to determine if a workflow will run
12+
within a pipeline.
13+
default: true
14+
type: boolean
15+
run-just-nuts:
16+
description: >
17+
Boolean that controls when the just-nuts will run.
18+
19+
Default value is false and this parameter is used by automation to
20+
determine if
21+
22+
the just-nuts workflow will run.
23+
default: false
24+
type: boolean
25+
sfdx_version:
26+
description: |
27+
By default, the latest version of the standalone CLI will be installed.
28+
To install via npm, supply a version tag such as "latest" or "6".
29+
default: ''
30+
type: string
31+
repo_tag:
32+
description: "The tag of the module repo to checkout, '' defaults to branch/PR"
33+
default: ''
34+
type: string
35+
npm_module_name:
36+
description: 'The fully qualified npm module name, i.e. @salesforce/plugins-data'
37+
default: ''
38+
type: string
439
workflows:
540
version: 2
641
test-and-release:
42+
when: << pipeline.parameters.run-auto-workflows >>
743
jobs:
844
- release-management/validate-pr:
945
filters:
1046
branches:
1147
ignore: main
12-
# - release-management/test-package:
13-
# name: node-latest
14-
# node_version: latest
1548
- release-management/test-package:
16-
name: node-lts
17-
node_version: lts
49+
matrix:
50+
parameters:
51+
os:
52+
- linux
53+
- windows
54+
node_version:
55+
- latest
56+
- lts
57+
- maintenance
58+
exclude:
59+
- os: windows
60+
node_version: lts
61+
- os: windows
62+
node_version: maintenance
1863
- release-management/test-nut:
1964
name: nuts-on-linux
2065
node_version: lts
2166
size: large
2267
sfdx_version: latest
2368
requires:
24-
- node-lts
69+
- release-management/test-package
2570
- release-management/test-nut:
2671
name: nuts-on-windows
2772
sfdx_version: latest
2873
size: large
2974
node_version: lts
3075
os: windows
3176
requires:
32-
- node-lts
77+
- release-management/test-package
3378
- release-management/release-package:
3479
sign: true
3580
github-release: true
3681
requires:
37-
- node-lts
82+
- release-management/test-package
3883
filters:
3984
branches:
4085
only: main
86+
context: CLI_CTC
4187
test-ts-update:
4288
triggers:
4389
- schedule:
@@ -48,3 +94,27 @@ workflows:
4894
- main
4995
jobs:
5096
- release-management/test-ts-update
97+
just-nuts:
98+
when: << pipeline.parameters.run-just-nuts >>
99+
jobs:
100+
- release-management/test-nut:
101+
name: just-nuts-<< matrix.os >>
102+
sfdx_version: << pipeline.parameters.sfdx_version >>
103+
sfdx_executable_path: sfdx
104+
repo_tag: << pipeline.parameters.repo_tag >>
105+
matrix:
106+
parameters:
107+
os:
108+
- linux
109+
- windows
110+
npm_module_name: << pipeline.parameters.npm_module_name >>
111+
dependabot-automerge:
112+
triggers:
113+
- schedule:
114+
cron: '0 2,5,8,11 * * *'
115+
filters:
116+
branches:
117+
only:
118+
- main
119+
jobs:
120+
- release-management/dependabot-automerge

test/formatters/deployResultFormatter.test.ts

+12
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,12 @@
55
* For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause
66
*/
77

8+
import * as path from 'path';
89
import * as sinon from 'sinon';
910
import { expect } from 'chai';
1011
import { Logger } from '@salesforce/core';
1112
import { UX } from '@salesforce/command';
13+
import { FileResponse } from '@salesforce/source-deploy-retrieve';
1214
import { stubInterface } from '@salesforce/ts-sinon';
1315
import { getDeployResult } from '../commands/source/deployResponses';
1416
import { DeployCommandResult, DeployResultFormatter } from '../../src/formatters/deployResultFormatter';
@@ -28,6 +30,14 @@ describe('DeployResultFormatter', () => {
2830
let styledHeaderStub: sinon.SinonStub;
2931
let tableStub: sinon.SinonStub;
3032

33+
const resolveExpectedPaths = (fileResponses: FileResponse[]): void => {
34+
fileResponses.forEach((file) => {
35+
if (file.filePath) {
36+
file.filePath = path.relative(process.cwd(), file.filePath);
37+
}
38+
});
39+
};
40+
3141
beforeEach(() => {
3242
logStub = sandbox.stub();
3343
styledHeaderStub = sandbox.stub();
@@ -76,6 +86,7 @@ describe('DeployResultFormatter', () => {
7686
expect(tableStub.called).to.equal(true);
7787
expect(styledHeaderStub.firstCall.args[0]).to.contain('Deployed Source');
7888
const fileResponses = deployResultSuccess.getFileResponses();
89+
resolveExpectedPaths(fileResponses);
7990
expect(tableStub.firstCall.args[0]).to.deep.equal(fileResponses);
8091
});
8192

@@ -87,6 +98,7 @@ describe('DeployResultFormatter', () => {
8798
expect(tableStub.called).to.equal(true);
8899
expect(styledHeaderStub.firstCall.args[0]).to.contain('Component Failures [1]');
89100
const fileResponses = deployResultFailure.getFileResponses();
101+
resolveExpectedPaths(fileResponses);
90102
expect(tableStub.firstCall.args[0]).to.deep.equal(fileResponses);
91103
});
92104

test/formatters/retrieveResultFormatter.test.ts

+11-1
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,12 @@
55
* For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause
66
*/
77

8-
import { join } from 'path';
8+
import { join, relative } from 'path';
99
import * as sinon from 'sinon';
1010
import { expect } from 'chai';
1111
import { Logger } from '@salesforce/core';
1212
import { UX } from '@salesforce/command';
13+
import { FileResponse } from '@salesforce/source-deploy-retrieve';
1314
import { cloneJson } from '@salesforce/kit';
1415
import { stubInterface } from '@salesforce/ts-sinon';
1516
import { getRetrieveResult } from '../commands/source/retrieveResponses';
@@ -31,6 +32,14 @@ describe('RetrieveResultFormatter', () => {
3132
let styledHeaderStub: sinon.SinonStub;
3233
let tableStub: sinon.SinonStub;
3334

35+
const resolveExpectedPaths = (fileResponses: FileResponse[]): void => {
36+
fileResponses.forEach((file) => {
37+
if (file.filePath) {
38+
file.filePath = relative(process.cwd(), file.filePath);
39+
}
40+
});
41+
};
42+
3443
beforeEach(() => {
3544
logStub = sandbox.stub();
3645
styledHeaderStub = sandbox.stub();
@@ -115,6 +124,7 @@ describe('RetrieveResultFormatter', () => {
115124
expect(tableStub.called).to.equal(true);
116125
expect(styledHeaderStub.firstCall.args[0]).to.contain('Retrieved Source');
117126
const fileResponses = retrieveResultSuccess.getFileResponses();
127+
resolveExpectedPaths(fileResponses);
118128
expect(tableStub.firstCall.args[0]).to.deep.equal(fileResponses);
119129
});
120130

0 commit comments

Comments
 (0)