Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ci: update circle ci config for all-nuts job #178

Merged
merged 2 commits into from
Aug 25, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
86 changes: 78 additions & 8 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
@@ -1,43 +1,89 @@
version: 2.1
orbs:
release-management: salesforce/npm-release-management@4
parameters:
run-auto-workflows:
description: >
Boolean that controls when an workflow would run.

It is used to gate which workflows should run when github events occur.

This parameter is used by automation to determine if a workflow will run
within a pipeline.
default: true
type: boolean
run-just-nuts:
description: >
Boolean that controls when the just-nuts will run.

Default value is false and this parameter is used by automation to
determine if

the just-nuts workflow will run.
default: false
type: boolean
sfdx_version:
description: |
By default, the latest version of the standalone CLI will be installed.
To install via npm, supply a version tag such as "latest" or "6".
default: ''
type: string
repo_tag:
description: "The tag of the module repo to checkout, '' defaults to branch/PR"
default: ''
type: string
npm_module_name:
description: 'The fully qualified npm module name, i.e. @salesforce/plugins-data'
default: ''
type: string
workflows:
version: 2
test-and-release:
when: << pipeline.parameters.run-auto-workflows >>
jobs:
- release-management/validate-pr:
filters:
branches:
ignore: main
# - release-management/test-package:
# name: node-latest
# node_version: latest
- release-management/test-package:
name: node-lts
node_version: lts
matrix:
parameters:
os:
- linux
- windows
node_version:
- latest
- lts
- maintenance
exclude:
- os: windows
node_version: lts
- os: windows
node_version: maintenance
- release-management/test-nut:
name: nuts-on-linux
node_version: lts
size: large
sfdx_version: latest
requires:
- node-lts
- release-management/test-package
- release-management/test-nut:
name: nuts-on-windows
sfdx_version: latest
size: large
node_version: lts
os: windows
requires:
- node-lts
- release-management/test-package
- release-management/release-package:
sign: true
github-release: true
requires:
- node-lts
- release-management/test-package
filters:
branches:
only: main
context: CLI_CTC
test-ts-update:
triggers:
- schedule:
Expand All @@ -48,3 +94,27 @@ workflows:
- main
jobs:
- release-management/test-ts-update
just-nuts:
when: << pipeline.parameters.run-just-nuts >>
jobs:
- release-management/test-nut:
name: just-nuts-<< matrix.os >>
sfdx_version: << pipeline.parameters.sfdx_version >>
sfdx_executable_path: sfdx
repo_tag: << pipeline.parameters.repo_tag >>
matrix:
parameters:
os:
- linux
- windows
npm_module_name: << pipeline.parameters.npm_module_name >>
dependabot-automerge:
triggers:
- schedule:
cron: '0 2,5,8,11 * * *'
filters:
branches:
only:
- main
jobs:
- release-management/dependabot-automerge
12 changes: 12 additions & 0 deletions test/formatters/deployResultFormatter.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,12 @@
* For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause
*/

import * as path from 'path';
import * as sinon from 'sinon';
import { expect } from 'chai';
import { Logger } from '@salesforce/core';
import { UX } from '@salesforce/command';
import { FileResponse } from '@salesforce/source-deploy-retrieve';
import { stubInterface } from '@salesforce/ts-sinon';
import { getDeployResult } from '../commands/source/deployResponses';
import { DeployCommandResult, DeployResultFormatter } from '../../src/formatters/deployResultFormatter';
Expand All @@ -28,6 +30,14 @@ describe('DeployResultFormatter', () => {
let styledHeaderStub: sinon.SinonStub;
let tableStub: sinon.SinonStub;

const resolveExpectedPaths = (fileResponses: FileResponse[]): void => {
fileResponses.forEach((file) => {
if (file.filePath) {
file.filePath = path.relative(process.cwd(), file.filePath);
}
});
};

beforeEach(() => {
logStub = sandbox.stub();
styledHeaderStub = sandbox.stub();
Expand Down Expand Up @@ -76,6 +86,7 @@ describe('DeployResultFormatter', () => {
expect(tableStub.called).to.equal(true);
expect(styledHeaderStub.firstCall.args[0]).to.contain('Deployed Source');
const fileResponses = deployResultSuccess.getFileResponses();
resolveExpectedPaths(fileResponses);
expect(tableStub.firstCall.args[0]).to.deep.equal(fileResponses);
});

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

Expand Down
12 changes: 11 additions & 1 deletion test/formatters/retrieveResultFormatter.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,12 @@
* For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause
*/

import { join } from 'path';
import { join, relative } from 'path';
import * as sinon from 'sinon';
import { expect } from 'chai';
import { Logger } from '@salesforce/core';
import { UX } from '@salesforce/command';
import { FileResponse } from '@salesforce/source-deploy-retrieve';
import { cloneJson } from '@salesforce/kit';
import { stubInterface } from '@salesforce/ts-sinon';
import { getRetrieveResult } from '../commands/source/retrieveResponses';
Expand All @@ -31,6 +32,14 @@ describe('RetrieveResultFormatter', () => {
let styledHeaderStub: sinon.SinonStub;
let tableStub: sinon.SinonStub;

const resolveExpectedPaths = (fileResponses: FileResponse[]): void => {
fileResponses.forEach((file) => {
if (file.filePath) {
file.filePath = relative(process.cwd(), file.filePath);
}
});
};

beforeEach(() => {
logStub = sandbox.stub();
styledHeaderStub = sandbox.stub();
Expand Down Expand Up @@ -115,6 +124,7 @@ describe('RetrieveResultFormatter', () => {
expect(tableStub.called).to.equal(true);
expect(styledHeaderStub.firstCall.args[0]).to.contain('Retrieved Source');
const fileResponses = retrieveResultSuccess.getFileResponses();
resolveExpectedPaths(fileResponses);
expect(tableStub.firstCall.args[0]).to.deep.equal(fileResponses);
});

Expand Down