diff --git a/.github/workflows/zxc-compile-code.yaml b/.github/workflows/zxc-compile-code.yaml index 030922bf5..c66fab57f 100644 --- a/.github/workflows/zxc-compile-code.yaml +++ b/.github/workflows/zxc-compile-code.yaml @@ -65,7 +65,12 @@ permissions: jobs: compile: name: ${{ inputs.custom-job-label || 'Compiles' }} - runs-on: [self-hosted, Linux, medium, ephemeral] + runs-on: ${{ matrix.os }} + strategy: + matrix: + os: + - windows-2022 + - [self-hosted, Linux, medium, ephemeral] steps: - name: Checkout Code uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 @@ -78,7 +83,7 @@ jobs: - name: Setup Kind uses: helm/kind-action@99576bfa6ddf9a8e612d83b513da5a75875caced # v1.9.0 - if: ${{ inputs.enable-e2e-tests && !cancelled() && !failure() }} + if: ${{ runner.os == 'linux' && inputs.enable-e2e-tests && !cancelled() && !failure() }} with: install_only: true node_image: kindest/node:v1.27.3@sha256:3966ac761ae0136263ffdb6cfd4db23ef8a83cba8a463690e98317add2c9ba72 @@ -92,43 +97,50 @@ jobs: run: npm ci - name: Check Code Style - if: ${{ inputs.enable-code-style-check && !cancelled() && !failure() }} + if: ${{ runner.os == 'linux' && inputs.enable-code-style-check && !cancelled() && !failure() }} run: npm run check - name: Run Unit Tests if: ${{ inputs.enable-unit-tests && !cancelled() && !failure() }} run: npm test - - name: Publish Unit Test Report + - name: Publish Windows Unit Test Report + uses: EnricoMi/publish-unit-test-result-action/windows/bash@v2.15.1 + if: ${{ runner.os == 'Windows' && inputs.enable-unit-tests && steps.npm-deps.conclusion == 'success' && !cancelled() }} + with: + check_name: 'Unit Test Results - ${{ runner.os }}' + files: "junit.xml" + + - name: Publish Linux Unit Test Report uses: EnricoMi/publish-unit-test-result-action@f355d34d53ad4e7f506f699478db2dd71da9de5f # v2.15.1 - if: ${{ inputs.enable-unit-tests && steps.npm-deps.conclusion == 'success' && !cancelled() }} + if: ${{ runner.os == 'linux' && inputs.enable-unit-tests && steps.npm-deps.conclusion == 'success' && !cancelled() }} with: - check_name: 'Unit Test Results' + check_name: 'Unit Test Results - ${{ runner.os }}' files: "junit.xml" - name: Publish Unit Test Coverage Report uses: actions/upload-artifact@5d5d22a31266ced268874388b861e4b58bb5c2f3 # v4.3.1 - if: ${{ inputs.enable-unit-tests && !cancelled() }} + if: ${{ runner.os == 'linux' && inputs.enable-unit-tests && !cancelled() }} with: name: Unit Test Coverage Report path: 'coverage/unit' - name: Pull Kind Docker Image - if: ${{ inputs.enable-e2e-tests && !cancelled() && !failure() }} + if: ${{ runner.os == 'linux' && inputs.enable-e2e-tests && !cancelled() && !failure() }} run: docker image pull kindest/node:v1.27.3@sha256:3966ac761ae0136263ffdb6cfd4db23ef8a83cba8a463690e98317add2c9ba72 - name: Setup E2E Tests - if: ${{ inputs.enable-e2e-tests && !cancelled() && !failure() }} + if: ${{ runner.os == 'linux' && inputs.enable-e2e-tests && !cancelled() && !failure() }} run: | npm link ./test/e2e/setup-e2e.sh - name: Run E2E Tests - if: ${{ inputs.enable-e2e-tests && !cancelled() && !failure() }} + if: ${{ runner.os == 'linux' && inputs.enable-e2e-tests && !cancelled() && !failure() }} run: npm run test-e2e - name: Upload E2E Logs to GitHub - if: ${{ inputs.enable-e2e-tests && !cancelled() }} + if: ${{ runner.os == 'linux' && inputs.enable-e2e-tests && !cancelled() }} uses: actions/upload-artifact@5d5d22a31266ced268874388b861e4b58bb5c2f3 # v4.3.1 with: name: solo.log @@ -138,21 +150,21 @@ jobs: - name: Publish E2E Test Report uses: EnricoMi/publish-unit-test-result-action@f355d34d53ad4e7f506f699478db2dd71da9de5f # v2.15.1 - if: ${{ inputs.enable-e2e-tests && steps.npm-deps.conclusion == 'success' && !cancelled() }} + if: ${{ runner.os == 'linux' && inputs.enable-e2e-tests && steps.npm-deps.conclusion == 'success' && !cancelled() }} with: check_name: 'E2E Test Results' files: "junit-e2e.xml" - name: Publish E2E Coverage Report uses: actions/upload-artifact@5d5d22a31266ced268874388b861e4b58bb5c2f3 # v4.3.1 - if: ${{ inputs.enable-e2e-tests && !cancelled() }} + if: ${{ runner.os == 'linux' && inputs.enable-e2e-tests && !cancelled() }} with: name: E2E Coverage Report path: 'coverage/e2e' - name: Publish Test Reports uses: actions/upload-artifact@5d5d22a31266ced268874388b861e4b58bb5c2f3 # v4.3.1 - if: ${{ inputs.enable-unit-tests && steps.npm-deps.conclusion == 'success' && !cancelled() }} + if: ${{ runner.os == 'linux' && inputs.enable-unit-tests && steps.npm-deps.conclusion == 'success' && !cancelled() }} with: name: Test Reports path: "junit*.xml" diff --git a/README.md b/README.md index b75196431..f54f50b05 100644 --- a/README.md +++ b/README.md @@ -90,7 +90,7 @@ You can now use your cluster with: kubectl cluster-info --context kind-solo -Thanks for using kind! 😊 +Have a question, bug, or feature request? Let us know! https://kind.sigs.k8s.io/#community 🙂 ``` You may now view pods in your cluster using `k9s -A` as below: @@ -178,9 +178,9 @@ Kubernetes Namespace : solo ✔ Clean up temp files ✔ Generate gossip keys ✔ Backup old files -✔ TLS key for node: node2 -✔ TLS key for node: node0 ✔ TLS key for node: node1 +✔ TLS key for node: node0 +✔ TLS key for node: node2 ✔ Generate gRPC TLS keys ✔ Finalize ``` @@ -269,8 +269,8 @@ Kubernetes Namespace : solo ✔ Prepare config.txt for the network ✔ Prepare staging directory ✔ Node: node0 -✔ Node: node2 ✔ Node: node1 +✔ Node: node2 ✔ Fetch platform software into network nodes ✔ Copy Gossip keys ✔ Copy Gossip keys @@ -282,11 +282,11 @@ Kubernetes Namespace : solo ✔ Copy configuration files ✔ Copy configuration files ✔ Set file permissions -✔ Node: node1 +✔ Node: node2 ✔ Set file permissions ✔ Node: node0 ✔ Set file permissions -✔ Node: node2 +✔ Node: node1 ✔ Setup network nodes ✔ Finalize ``` @@ -308,13 +308,13 @@ Kubernetes Cluster : kind-solo Kubernetes Namespace : solo ********************************************************************************** ✔ Initialize -✔ Check network pod: node1 ✔ Check network pod: node0 ✔ Check network pod: node2 +✔ Check network pod: node1 ✔ Identify network pods ✔ Start node: node1 -✔ Start node: node0 ✔ Start node: node2 +✔ Start node: node0 ✔ Starting nodes ✔ Check node: node0 ✔ Check node: node1 @@ -375,7 +375,7 @@ Kubernetes Namespace : solo *** Deployed Relays *** ------------------------------------------------------------------------------- - - fullstack-deployment [fullstack-deployment-0.24.2] + - fullstack-deployment [fullstack-deployment-0.24.3] - relay-node0-node1 [hedera-json-rpc-relay-0.26.0-SNAPSHOT] - relay-node0-node1-node2 [hedera-json-rpc-relay-0.26.0-SNAPSHOT] @@ -453,7 +453,7 @@ Kubernetes Namespace : solo *** Deployed Relays *** ------------------------------------------------------------------------------- - - fullstack-deployment [fullstack-deployment-0.24.2] + - fullstack-deployment [fullstack-deployment-0.24.3] - relay-node0-node1 [hedera-json-rpc-relay-0.26.0-SNAPSHOT] @@ -516,9 +516,9 @@ Kubernetes Namespace : solo ✔ Gossip pem key for node: node2 ✔ Generate gossip keys ✔ Backup old files -✔ TLS key for node: node0 -✔ TLS key for node: node1 ✔ TLS key for node: node2 +✔ TLS key for node: node1 +✔ TLS key for node: node0 ✔ Generate gRPC TLS keys ✔ Finalize ``` @@ -579,6 +579,6 @@ Contributions are welcome. Please see the [contributing guide](https://github.co This project is governed by the [Contributor Covenant Code of Conduct](https://github.com/hashgraph/.github/blob/main/CODE_OF_CONDUCT.md). By participating, you are expected to uphold this code of conduct. -## License +## License [Apache License 2.0](LICENSE) diff --git a/package-lock.json b/package-lock.json index 7251d80f8..52fd302f1 100644 --- a/package-lock.json +++ b/package-lock.json @@ -10,7 +10,8 @@ "license": "Apache2.0", "os": [ "darwin", - "linux" + "linux", + "win32" ], "dependencies": { "@hashgraph/proto": "^2.14.0-beta.4", @@ -44,6 +45,7 @@ "devDependencies": { "@jest/globals": "^29.7.0", "@jest/test-sequencer": "^29.7.0", + "cross-env": "^7.0.3", "eslint": "^8.57.0", "eslint-config-standard": "^17.1.0", "eslint-plugin-headers": "^1.1.2", @@ -3715,6 +3717,24 @@ "url": "https://github.com/chalk/chalk?sponsor=1" } }, + "node_modules/cross-env": { + "version": "7.0.3", + "resolved": "https://registry.npmjs.org/cross-env/-/cross-env-7.0.3.tgz", + "integrity": "sha512-+/HKd6EgcQCJGh2PSjZuUitQBQynKor4wrFbRg4DtAgS1aWO+gU52xpH7M9ScGgXSYmAVS9bIJ8EzuaGw0oNAw==", + "dev": true, + "dependencies": { + "cross-spawn": "^7.0.1" + }, + "bin": { + "cross-env": "src/bin/cross-env.js", + "cross-env-shell": "src/bin/cross-env-shell.js" + }, + "engines": { + "node": ">=10.14", + "npm": ">=6", + "yarn": ">=1" + } + }, "node_modules/cross-spawn": { "version": "7.0.3", "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-7.0.3.tgz", diff --git a/package.json b/package.json index 5e8fe98f9..c1468dbe7 100644 --- a/package.json +++ b/package.json @@ -11,7 +11,7 @@ "access": "public" }, "scripts": { - "test": "NODE_OPTIONS=--experimental-vm-modules JEST_SUITE_NAME='Unit Tests' jest --runInBand --detectOpenHandles --forceExit --coverage --coverageDirectory='coverage/unit' --testPathIgnorePatterns=\".*/e2e/.*\"", + "test": "cross-env NODE_OPTIONS=--experimental-vm-modules JEST_SUITE_NAME=\"Unit Tests\" jest --runInBand --detectOpenHandles --forceExit --coverage --coverageDirectory='coverage/unit' --testPathIgnorePatterns=\".*/e2e/.*\"", "test-e2e": "NODE_OPTIONS=--experimental-vm-modules JEST_SUITE_NAME='Jest E2E Tests' JEST_JUNIT_OUTPUT_NAME='junit-e2e.xml' jest --runInBand --detectOpenHandles --forceExit --coverage --coverageDirectory='coverage/e2e' --testPathIgnorePatterns=\\\".*/unit/.*\\\"", "solo": "NODE_OPTIONS=--experimental-vm-modules node --no-deprecation solo.mjs", "check": "remark . --quiet --frail && eslint .", @@ -68,6 +68,7 @@ "remark-lint-unordered-list-marker-style": "^3.1.2", "remark-preset-lint-consistent": "^5.1.2", "remark-preset-lint-recommended": "^6.1.3", + "cross-env": "^7.0.3", "seedrandom": "^3.0.5" }, "repository": { @@ -76,7 +77,8 @@ }, "os": [ "darwin", - "linux" + "linux", + "win32" ], "engines": { "node": ">=18.18.2", diff --git a/src/core/dependency_managers/helm_dependency_manager.mjs b/src/core/dependency_managers/helm_dependency_manager.mjs index ea3890573..55b5f2a6b 100644 --- a/src/core/dependency_managers/helm_dependency_manager.mjs +++ b/src/core/dependency_managers/helm_dependency_manager.mjs @@ -24,6 +24,7 @@ import { constants, Templates } from '../index.mjs' import * as version from '../../../version.mjs' import { ShellRunner } from '../shell_runner.mjs' import * as semver from 'semver' +import { OS_WIN32, OS_WINDOWS } from '../constants.mjs' // constants required by HelmDependencyManager const HELM_RELEASE_BASE_URL = 'https://get.helm.sh' @@ -55,7 +56,12 @@ export class HelmDependencyManager extends ShellRunner { this.downloader = downloader this.zippy = zippy this.installationDir = installationDir - this.osPlatform = osPlatform + // Node.js uses 'win32' for windows in package.json os field, but helm uses 'windows' + if (osPlatform === OS_WIN32) { + this.osPlatform = OS_WINDOWS + } else { + this.osPlatform = osPlatform + } this.osArch = ['x64', 'x86-64'].includes(osArch) ? 'amd64' : osArch this.helmVersion = helmVersion this.helmPath = Templates.installationPath(constants.HELM, this.osPlatform, this.installationDir) diff --git a/src/core/dependency_managers/keytool_dependency_manager.mjs b/src/core/dependency_managers/keytool_dependency_manager.mjs index 49648eb84..8d5e21000 100644 --- a/src/core/dependency_managers/keytool_dependency_manager.mjs +++ b/src/core/dependency_managers/keytool_dependency_manager.mjs @@ -25,6 +25,7 @@ import { constants, Keytool, Templates } from '../index.mjs' import * as version from '../../../version.mjs' import { ShellRunner } from '../shell_runner.mjs' import got from 'got' +import { OS_WIN32, OS_WINDOWS } from '../constants.mjs' /** * Installs or uninstalls JRE client at SOLO_HOME_DIR/bin/jre directory @@ -49,8 +50,12 @@ export class KeytoolDependencyManager extends ShellRunner { this.zippy = zippy this.installationDir = installationDir this.jreDir = path.join(this.installationDir, 'jre') - this.osPlatform = ['mac', 'darwin'].includes(osPlatform) ? constants.OS_MAC : osPlatform - + // Node.js uses 'win32' for windows in package.json os field, but jdk too uses 'windows' + if (osPlatform === OS_WIN32) { + this.osPlatform = OS_WINDOWS + } else { + this.osPlatform = ['mac', 'darwin'].includes(osPlatform) ? constants.OS_MAC : osPlatform + } switch (osArch) { case 'x64': case 'x86-64': diff --git a/test/unit/commands/base.test.mjs b/test/unit/commands/base.test.mjs index 7ab474d37..a91e5b3de 100644 --- a/test/unit/commands/base.test.mjs +++ b/test/unit/commands/base.test.mjs @@ -55,7 +55,7 @@ describe('BaseCommand', () => { await expect(baseCmd.run('INVALID_PROGRAM')).rejects.toThrowError() }) it('should succeed during valid program check', async () => { - await expect(baseCmd.run('date')).resolves.not.toBeNull() + await expect(baseCmd.run('echo')).resolves.not.toBeNull() }) }) })