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(github): yarn lint job now fails if formatting was needed #3332

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
2 changes: 2 additions & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,8 @@ weaver/samples/fabric/fabric-cli/src/helpers/fabric-functions.ts
weaver/samples/fabric/fabric-cli/src/helpers/helpers.ts
weaver/samples/fabric/fabric-cli/src/helpers/interop-setup/configure-network.ts
weaver/sdks/besu/node/src/AssetManager.ts
weaver/sdks/fabric/interoperation-node-sdk/build/
weaver/sdks/fabric/interoperation-node-sdk/coverage/prettify.js
weaver/sdks/fabric/interoperation-node-sdk/src/AssetManager.ts
weaver/sdks/fabric/interoperation-node-sdk/src/EventsManager.ts
weaver/sdks/fabric/interoperation-node-sdk/src/HashFunctions.ts
Expand Down
40 changes: 40 additions & 0 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -231,7 +231,47 @@ jobs:
restore-keys: |
${{ runner.os }}-yarn-${{ hashFiles('./yarn.lock') }}
- run: ./tools/ci.sh
- run: git status --porcelain
- run: git status --porcelain | wc -l
- run: yarn lint
- run: git status --porcelain
- run: git status --porcelain | wc -l

- name: Set env.GIT_INDEX_FILE_COUNT
id: set_env_git_index_file_count
run: |
echo "GIT_INDEX_FILE_COUNT=$(git status --porcelain | wc -l)" >> "$GITHUB_ENV"

- name: Print env.GIT_INDEX_FILE_COUNT
id: print_env_git_index_file_count
run: |
echo "${{ env.GIT_INDEX_FILE_COUNT }}"
- uses: actions/github-script@v6.4.1
id: set-result-git_index_file_count
with:
script: |
const { GIT_INDEX_FILE_COUNT } = process.env;
console.log(`env.GIT_INDEX_FILE_COUNT ${GIT_INDEX_FILE_COUNT}`);
return parseInt(GIT_INDEX_FILE_COUNT, 10);
result-encoding: string

- name: Get result Git Index File Count
id: get_result_git_index_file_count
run: echo "${{steps.set-result-git_index_file_count.outputs.result}}"

- name: Check Lint Side-effects
if: ${{ steps.set-result-git_index_file_count.outputs.result != 0 }}
uses: actions/github-script@v6.4.1
with:
script: |
const failMsg = "yarn lint script produced version control " +
"side-effects: source files have been changed by it that are " +
"otherwise are under version control. " +
"This means (99% of the time) that you need to run the " +
"yarn lint script locally and then include the changes it " +
"makes in your own commit when submitting your pull request.";
core.setFailed(failMsg)

yarn_codegen:
continue-on-error: false
env:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ export async function launchApp(
exampleConfig.authorizationConfigJson,
) as unknown as IAuthorizationConfig;
exampleConfig.authorizationProtocol = AuthorizationProtocol.NONE;

const convictConfig =
await configService.newExampleConfigConvict(exampleConfig);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ export class CbdcBridgingApp {
nodeApiHostB,
this.options.serverGatewayKeyPair,
);

const clientPluginRegistry = new PluginRegistry({
plugins: [
new PluginKeychainMemory({
Expand All @@ -132,18 +132,32 @@ export class CbdcBridgingApp {
}),
],
});

clientPluginRegistry.add(fabricPlugin);
clientPluginRegistry.add(fabricSatpGateway);

serverPluginRegistry.add(besuPlugin);
serverPluginRegistry.add(besuSatpGateway);

const crpcOptionsServer1 = {host: this.options.apiCrpcHost, port: this.options.apiServer1CrpcPort};
const apiServer1 = await this.startNode(httpApiA, clientPluginRegistry, crpcOptionsServer1);

const crpcOptionsServer2 = {host: this.options.apiCrpcHost, port: this.options.apiServer2CrpcPort};
const apiServer2 = await this.startNode(httpApiB, serverPluginRegistry, crpcOptionsServer2);
const crpcOptionsServer1 = {
host: this.options.apiCrpcHost,
port: this.options.apiServer1CrpcPort,
};
const apiServer1 = await this.startNode(
httpApiA,
clientPluginRegistry,
crpcOptionsServer1,
);

const crpcOptionsServer2 = {
host: this.options.apiCrpcHost,
port: this.options.apiServer2CrpcPort,
};
const apiServer2 = await this.startNode(
httpApiB,
serverPluginRegistry,
crpcOptionsServer2,
);

const fabricApiClient = new FabricApi(
new Configuration({ basePath: nodeApiHostA }),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -89,9 +89,7 @@ export class CbdcBridgingAppDummyInfrastructure {
publishAllPorts: true,
imageName: DEFAULT_FABRIC_2_AIO_IMAGE_NAME,
imageVersion: FABRIC_25_LTS_AIO_IMAGE_VERSION,
envVars: new Map([
["FABRIC_VERSION", FABRIC_25_LTS_AIO_FABRIC_VERSION],
]),
envVars: new Map([["FABRIC_VERSION", FABRIC_25_LTS_AIO_FABRIC_VERSION]]),
logLevel: level || "DEBUG",
});
}
Expand Down Expand Up @@ -387,7 +385,8 @@ export class CbdcBridgingAppDummyInfrastructure {
sourceFiles,
ccName: contractName,
targetOrganizations: [this.org1Env, this.org2Env],
caFile: FABRIC_25_LTS_FABRIC_SAMPLES_ENV_INFO_ORG_1.ORDERER_TLS_ROOTCERT_FILE,
caFile:
FABRIC_25_LTS_FABRIC_SAMPLES_ENV_INFO_ORG_1.ORDERER_TLS_ROOTCERT_FILE,
ccLabel: "asset-reference-contract",
ccLang: ChainCodeProgrammingLanguage.Typescript,
ccSequence: 1,
Expand Down Expand Up @@ -514,7 +513,8 @@ export class CbdcBridgingAppDummyInfrastructure {
sourceFiles,
ccName: contractName,
targetOrganizations: [this.org1Env, this.org2Env],
caFile: FABRIC_25_LTS_FABRIC_SAMPLES_ENV_INFO_ORG_1.ORDERER_TLS_ROOTCERT_FILE,
caFile:
FABRIC_25_LTS_FABRIC_SAMPLES_ENV_INFO_ORG_1.ORDERER_TLS_ROOTCERT_FILE,
ccLabel: "cbdc",
ccLang: ChainCodeProgrammingLanguage.Javascript,
ccSequence: 1,
Expand Down
6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,9 @@
"start:example-cbdc-bridging-app": "node -r ts-node/register examples/cactus-example-cbdc-bridging-backend/dist/lib/main/typescript/cbdc-bridging-app-cli.js dotenv_config_path=examples/cactus-example-cbdc-bridging-backend/process.env",
"purge-build-cache": "del-cli .build-cache/*",
"clean": "npm run purge-build-cache && del-cli \"./{packages,examples,extensions}/cactus-*/{dist,.nyc_output,src/main/kotlin/generated/openapi/kotlin-client/*,src/main/proto/generated/*,src/main/typescript/generated/openapi/typescript-axios/*,src/main-server/kotlin/gen/kotlin-spring/src/**/{model,api}/*}\" \"!**/.openapi-generator-ignore\"",
"lint": "yarn run format && yarn run spellcheck",
"format": "eslint '**/*.{js,ts}' --quiet --fix",
"lint": "run-s format:eslint format:prettier spellcheck",
"format:eslint": "eslint '**/*.{js,ts}' --quiet --fix",
"format:prettier": "prettier --write --config .prettierrc.js \"./**/{openapi.json,*.ts,*.js}\"",
"spellcheck": "cspell lint --no-progress \"*/*/src/**/*.{js,ts}\"",
"tsc": "NODE_OPTIONS=\"--max_old_space_size=3072\" tsc --build --verbose",
"codegen": "run-s 'codegen:warmup-*' codegen:lerna codegen:cleanup",
Expand All @@ -79,7 +80,6 @@
"test:jest:all": "NODE_OPTIONS=\"--max_old_space_size=3072 --experimental-vm-modules\" jest",
"test:tap:all": "NODE_OPTIONS=\"--experimental-vm-modules\" tap",
"test:all": "NODE_OPTIONS=\"--experimental-vm-modules\" yarn test:jest:all && yarn test:tap:all",
"prettier": "prettier --write --config .prettierrc.js \"./**/{openapi.json,*.ts,*.js}\"",
"lerna-publish-canary": "lerna publish --canary --force-publish --dist-tag $(git branch --show-current) --preid $(git branch --show-current) --loglevel=silly --ignore-scripts --ignore-prepublish",
"prepare": "husky install",
"init-registries": "npm config set @iroha2:registry=https://nexus.iroha.tech/repository/npm-group/"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -340,7 +340,10 @@ test("test merging views, and integrated view proofs", async () => {
signature: view.signature,
}),
// eslint-disable-next-line prettier/prettier
JSON.stringify({ view: JSON.stringify(view2.view as View), signature: view2.signature }),
JSON.stringify({
view: JSON.stringify(view2.view as View),
signature: view2.signature,
}),
],
mergePolicy: MergePolicyOpts.NONE,
});
Expand Down Expand Up @@ -384,7 +387,9 @@ test("test merging views, and integrated view proofs", async () => {

//0 transactions captured in first view, and 1 in the second (because of policy)
// eslint-disable-next-line prettier/prettier
expect(mergeViewsWithPolicy.integratedView.getAllTransactions().length).toBe(1);
expect(mergeViewsWithPolicy.integratedView.getAllTransactions().length).toBe(
1,
);
//0 state captured in first view, and 1 in the second (because of policy)
expect(mergeViewsWithPolicy.integratedView.getAllStates().length).toBe(1);

Expand All @@ -397,7 +402,9 @@ test("test merging views, and integrated view proofs", async () => {

//1 transactions captured in first view, and 1 in the second (because of policy)
// eslint-disable-next-line prettier/prettier
expect(mergeViewsWithPolicy2.integratedView.getAllTransactions().length).toBe(2);
expect(mergeViewsWithPolicy2.integratedView.getAllTransactions().length).toBe(
2,
);
//1 state captured in first view, and only 1 in the second (because of policy)
expect(mergeViewsWithPolicy2.integratedView.getAllStates().length).toBe(2);
});
Expand Down
Loading
Loading