From f7ccd588951040eef57a762898c010821d8696c9 Mon Sep 17 00:00:00 2001 From: Timothy Johnson Date: Tue, 24 Dec 2024 08:37:21 -0500 Subject: [PATCH 1/6] Update Node and Ubuntu version in workflows Signed-off-by: Timothy Johnson --- .github/workflows/audit.yml | 2 +- .github/workflows/changelog.yml | 2 +- .github/workflows/codeql.yml | 4 ++-- .github/workflows/linter.yml | 2 +- .github/workflows/sonar.yml | 2 +- .github/workflows/zowe-cli.yml | 4 ++-- 6 files changed, 8 insertions(+), 8 deletions(-) diff --git a/.github/workflows/audit.yml b/.github/workflows/audit.yml index 63d93d2f9a..80a38b3fcf 100644 --- a/.github/workflows/audit.yml +++ b/.github/workflows/audit.yml @@ -4,7 +4,7 @@ on: pull_request: branches: - master - - zowe-v1-lts + - zowe-v?-lts - next schedule: - cron: '0 10 * * *' diff --git a/.github/workflows/changelog.yml b/.github/workflows/changelog.yml index dbcf70835d..39f4b9bae4 100644 --- a/.github/workflows/changelog.yml +++ b/.github/workflows/changelog.yml @@ -4,7 +4,7 @@ on: pull_request: branches: - master - - zowe-v1-lts + - zowe-v?-lts - next jobs: diff --git a/.github/workflows/codeql.yml b/.github/workflows/codeql.yml index 5fca5be3c0..6a24499de6 100644 --- a/.github/workflows/codeql.yml +++ b/.github/workflows/codeql.yml @@ -4,12 +4,12 @@ on: push: branches: - master - - zowe-v1-lts + - zowe-v?-lts - next pull_request: branches: - master - - zowe-v1-lts + - zowe-v?-lts - next jobs: diff --git a/.github/workflows/linter.yml b/.github/workflows/linter.yml index 0fd38c2ad9..91d87df13d 100644 --- a/.github/workflows/linter.yml +++ b/.github/workflows/linter.yml @@ -4,7 +4,7 @@ on: push: branches-ignore: - 'master' - - 'zowe-v1-lts' + - 'zowe-v?-lts' - 'next' pull_request: branches: diff --git a/.github/workflows/sonar.yml b/.github/workflows/sonar.yml index 8d08046c1c..0bbf35841c 100644 --- a/.github/workflows/sonar.yml +++ b/.github/workflows/sonar.yml @@ -21,7 +21,7 @@ jobs: - name: Configure Sonar Scan uses: zowe-actions/octorelease/script@v1 env: - COVERAGE_ARTIFACT: "ubuntu-latest-18.x-results:__tests__/__results__" + COVERAGE_ARTIFACT: "ubuntu-latest-20.x-results:__tests__/__results__" with: script: sonarConfig diff --git a/.github/workflows/zowe-cli.yml b/.github/workflows/zowe-cli.yml index 19dc156571..b5a6b4992b 100644 --- a/.github/workflows/zowe-cli.yml +++ b/.github/workflows/zowe-cli.yml @@ -34,8 +34,8 @@ jobs: strategy: fail-fast: false matrix: - node-version: [18.x, 20.x] - os: + node-version: [18.x, 20.x, 22.x] + os: - windows-latest - ubuntu-latest - ${{ github.event.inputs.macos-type || 'macos-14'}} From aeaffb6318f452401e4130ea9c4bfddacce05817 Mon Sep 17 00:00:00 2001 From: Timothy Johnson Date: Tue, 24 Dec 2024 08:41:01 -0500 Subject: [PATCH 2/6] Update dev dep and ignore Rust advisory Signed-off-by: Timothy Johnson --- .github/workflows/audit.yml | 2 +- npm-shrinkwrap.json | 12 ++++++------ 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/.github/workflows/audit.yml b/.github/workflows/audit.yml index 80a38b3fcf..11629a7880 100644 --- a/.github/workflows/audit.yml +++ b/.github/workflows/audit.yml @@ -37,4 +37,4 @@ jobs: - name: Check Secrets SDK Vulnerabilities working-directory: packages/secrets/src/keyring - run: cargo audit --deny warnings --ignore RUSTSEC-2024-0370 + run: cargo audit --deny warnings --ignore RUSTSEC-2024-0370 --ignore RUSTSEC-2024-0429 diff --git a/npm-shrinkwrap.json b/npm-shrinkwrap.json index 6aecc348b2..5f70d59aa6 100644 --- a/npm-shrinkwrap.json +++ b/npm-shrinkwrap.json @@ -14729,9 +14729,9 @@ "optional": true }, "node_modules/nanoid": { - "version": "3.3.7", - "resolved": "https://registry.npmjs.org/nanoid/-/nanoid-3.3.7.tgz", - "integrity": "sha512-eSRppjcPIatRIMC1U6UngP8XFcz8MQWGQdt1MTBQ7NaAmvXDfvNxbvWV3x2y6CdEUciCSsDHDQZbhYaB8QEo2g==", + "version": "3.3.8", + "resolved": "https://registry.npmjs.org/nanoid/-/nanoid-3.3.8.tgz", + "integrity": "sha512-WNLf5Sd8oZxOm+TzppcYk8gVOgP+l58xNy58D0nbUnOxOWRWvlcCV4kUF7ltmI6PsrLl/BgKEyS4mqsGChFN0w==", "dev": true, "funding": [ { @@ -31830,9 +31830,9 @@ "optional": true }, "nanoid": { - "version": "3.3.7", - "resolved": "https://registry.npmjs.org/nanoid/-/nanoid-3.3.7.tgz", - "integrity": "sha512-eSRppjcPIatRIMC1U6UngP8XFcz8MQWGQdt1MTBQ7NaAmvXDfvNxbvWV3x2y6CdEUciCSsDHDQZbhYaB8QEo2g==", + "version": "3.3.8", + "resolved": "https://registry.npmjs.org/nanoid/-/nanoid-3.3.8.tgz", + "integrity": "sha512-WNLf5Sd8oZxOm+TzppcYk8gVOgP+l58xNy58D0nbUnOxOWRWvlcCV4kUF7ltmI6PsrLl/BgKEyS4mqsGChFN0w==", "dev": true }, "natural-compare": { From df20ce31f42420d7bdef6fde13067ab63aa63722 Mon Sep 17 00:00:00 2001 From: Timothy Johnson Date: Tue, 24 Dec 2024 15:26:19 -0500 Subject: [PATCH 3/6] Allow daemon client to clean up before exit Signed-off-by: Timothy Johnson --- zowex/src/main.rs | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/zowex/src/main.rs b/zowex/src/main.rs index 8fd357b097..ba8af9e2f0 100644 --- a/zowex/src/main.rs +++ b/zowex/src/main.rs @@ -10,7 +10,7 @@ */ use std::env; -use std::io; +use std::process::ExitCode; // other source modules that constitute this executable mod comm; @@ -38,7 +38,7 @@ extern crate tokio; // 3.6393932 and 0.76156812 zowe average over 10 run sample = 2.87782508 sec faster on windows #[tokio::main] -async fn main() -> io::Result<()> { +async fn main() -> ExitCode { // turn args into vector let mut cmd_line_args: Vec = env::args().collect(); @@ -55,8 +55,6 @@ async fn main() -> io::Result<()> { Err(err_val) => err_val, }; - /* Rust does not enable main() to return an exit code. - * Thus, we explicitly exit the process with our desired exit code. - */ - std::process::exit(exit_code); + // return exit code to indicate success or failure + ExitCode::from(exit_code as u8) } From 336b218538c21adf8b3059c960199a65ae342c60 Mon Sep 17 00:00:00 2001 From: Timothy Johnson Date: Thu, 26 Dec 2024 10:14:51 -0500 Subject: [PATCH 4/6] Fix runInBand arg ignored on Windows + Node 22 Signed-off-by: Timothy Johnson --- .github/workflows/zowe-cli.yml | 39 +++++++++++++++++----------------- 1 file changed, 19 insertions(+), 20 deletions(-) diff --git a/.github/workflows/zowe-cli.yml b/.github/workflows/zowe-cli.yml index b5a6b4992b..122786b64e 100644 --- a/.github/workflows/zowe-cli.yml +++ b/.github/workflows/zowe-cli.yml @@ -9,13 +9,19 @@ on: workflow_dispatch: inputs: binary-type: + type: choice description: Specify whether to use a `debug` or a `release` version of the binary default: debug - required: false + options: + - debug + - release test-type: + type: choice description: Specify whether to run tests using the `binary` or regular `nodejs` executable default: binary - required: false + options: + - binary + - nodejs macos-type: type: choice description: Run against x86-based MacOS (12), otherwise run against ARM64-based MacOS (14) @@ -66,20 +72,12 @@ jobs: echo "::remove-matcher owner=eslint-compact::" echo "::remove-matcher owner=eslint-stylish::" - - name: Get NPM Version - id: npm-version - run: echo "number=$(npm --version)" >> $GITHUB_OUTPUT - - name: Install Dependencies run: npm ci - - name: Use Original NPM Version - id: original-npm-version - run: npm install -g npm@${{ steps.npm-version.outputs.number || '9' }} - - name: Install Rust toolchain id: install-rust - if: github.event.inputs.test-type == 'binary' || github.event_name == 'push' + if: github.event.inputs.test-type != 'nodejs' uses: dtolnay/rust-toolchain@stable - name: Build Source @@ -88,14 +86,14 @@ jobs: - name: Build Binary id: build-binary - if: matrix.os != 'windows-latest' && (github.event.inputs.test-type == 'binary' || github.event_name == 'push') + if: matrix.os != 'windows-latest' && github.event.inputs.test-type != 'nodejs' run: | cargo build --verbose ${{ github.event.inputs.binary-type == 'release' && '--release' || '' }} --manifest-path=zowex/Cargo.toml tar -cvzf zowe.tgz -C zowex/target/${{ github.event.inputs.binary-type == 'release' && 'release' || 'debug' }} zowe - name: Build Binary (Windows) id: build-windows-binary - if: matrix.os == 'windows-latest' && (github.event.inputs.test-type == 'binary' || github.event_name == 'push') + if: matrix.os == 'windows-latest' && github.event.inputs.test-type != 'nodejs' run: | cargo build --verbose ${{ github.event.inputs.binary-type == 'release' && '--release' || '' }} --manifest-path=zowex/Cargo.toml tar -cvzf zowe.tgz -C zowex/target/${{ github.event.inputs.binary-type == 'release' && 'release' || 'debug' }} zowe.exe @@ -103,7 +101,7 @@ jobs: RUSTFLAGS: "-Ctarget-feature=+crt-static" - name: Archive Binary - if: github.event.inputs.test-type == 'binary' || github.event_name == 'push' + if: github.event.inputs.test-type != 'nodejs' id: upload-binary uses: actions/upload-artifact@v4 with: @@ -112,7 +110,7 @@ jobs: overwrite: true - name: Setup Binary in PATH - if: github.event.inputs.test-type == 'binary' || github.event_name == 'push' + if: github.event.inputs.test-type != 'nodejs' id: setup-binary shell: bash run: | @@ -121,7 +119,7 @@ jobs: - name: Test Rust EXE and zowe script id: test-exe-and-script - if: ${{ steps.setup-binary.outcome == 'success' && (github.event.inputs.test-type == 'binary' || github.event_name == 'push') }} + if: ${{ steps.setup-binary.outcome == 'success' && github.event.inputs.test-type != 'nodejs' }} run: cargo test ${{ github.event.inputs.binary-type == 'release' && '--release' || '' }} --manifest-path=zowex/Cargo.toml -- --nocapture - name: Unit Tests @@ -135,16 +133,17 @@ jobs: - name: Start Daemon id: start-daemon - if: ${{ always() && steps.build.outcome == 'success' && (github.event.inputs.test-type == 'binary' || github.event_name == 'push') }} + if: ${{ always() && steps.build.outcome == 'success' && github.event.inputs.test-type != 'nodejs' }} run: ./__tests__/__resources__/daemon_instances/zowe - name: Integration Tests (Native) - if: ${{ always() && steps.build.outcome == 'success' && !(github.event.inputs.test-type == 'binary' || github.event_name == 'push') }} + if: ${{ always() && steps.build.outcome == 'success' && github.event.inputs.test-type == 'nodejs' }} run: npm run test:integration - name: Integration Tests (Daemon) - if: ${{ always() && steps.build.outcome == 'success' && (github.event.inputs.test-type == 'binary' || github.event_name == 'push') }} - run: npm run test:integration -- --runInBand + if: ${{ always() && steps.build.outcome == 'success' && github.event.inputs.test-type != 'nodejs' }} + # We need double double hyphen to work around Windows + Node 22 bug: https://github.com/npm/cli/issues/7375 + run: npm run test:integration -- -- --runInBand - name: Archive Results if: ${{ always() && steps.build.outcome == 'success' }} From f1aae75cdbe4dc874c20fa0ce58af999fbfb651c Mon Sep 17 00:00:00 2001 From: Timothy Johnson Date: Thu, 26 Dec 2024 11:02:53 -0500 Subject: [PATCH 5/6] Clean up workflow and fix tests Signed-off-by: Timothy Johnson --- .github/workflows/zowe-cli.yml | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/.github/workflows/zowe-cli.yml b/.github/workflows/zowe-cli.yml index 122786b64e..dd67a014d7 100644 --- a/.github/workflows/zowe-cli.yml +++ b/.github/workflows/zowe-cli.yml @@ -34,8 +34,6 @@ jobs: test: if: (github.event_name == 'push' || github.event.pull_request.head.repo.full_name != github.repository) && !contains(github.event.head_commit.message, '[ci skip]') runs-on: ${{ matrix.os }} - outputs: - npm-resolutions: ${{ steps.npm-update.outputs.result }} strategy: fail-fast: false @@ -89,14 +87,14 @@ jobs: if: matrix.os != 'windows-latest' && github.event.inputs.test-type != 'nodejs' run: | cargo build --verbose ${{ github.event.inputs.binary-type == 'release' && '--release' || '' }} --manifest-path=zowex/Cargo.toml - tar -cvzf zowe.tgz -C zowex/target/${{ github.event.inputs.binary-type == 'release' && 'release' || 'debug' }} zowe + tar -cvzf zowe.tgz -C zowex/target/${{ github.event.inputs.binary-type }} zowe - name: Build Binary (Windows) id: build-windows-binary if: matrix.os == 'windows-latest' && github.event.inputs.test-type != 'nodejs' run: | cargo build --verbose ${{ github.event.inputs.binary-type == 'release' && '--release' || '' }} --manifest-path=zowex/Cargo.toml - tar -cvzf zowe.tgz -C zowex/target/${{ github.event.inputs.binary-type == 'release' && 'release' || 'debug' }} zowe.exe + tar -cvzf zowe.tgz -C zowex/target/${{ github.event.inputs.binary-type }} zowe.exe env: RUSTFLAGS: "-Ctarget-feature=+crt-static" @@ -142,8 +140,8 @@ jobs: - name: Integration Tests (Daemon) if: ${{ always() && steps.build.outcome == 'success' && github.event.inputs.test-type != 'nodejs' }} - # We need double double hyphen to work around Windows + Node 22 bug: https://github.com/npm/cli/issues/7375 - run: npm run test:integration -- -- --runInBand + # Use double double hyphen to work around Windows + Node 22 bug: https://github.com/npm/cli/issues/7375 + run: npm run test:integration -- ${{ (matrix.os == 'windows-latest' && matrix.node-version == '22.x') && '--' || '' }} --runInBand - name: Archive Results if: ${{ always() && steps.build.outcome == 'success' }} From 99ad120c2daf94ef438c47347be2dadaeaff1573 Mon Sep 17 00:00:00 2001 From: Timothy Johnson Date: Thu, 26 Dec 2024 11:41:24 -0500 Subject: [PATCH 6/6] More workflow fixes and remove redundant tests Signed-off-by: Timothy Johnson --- .github/workflows/zowe-cli.yml | 20 ++++---------------- zowex/.cargo/config.toml | 2 ++ 2 files changed, 6 insertions(+), 16 deletions(-) create mode 100644 zowex/.cargo/config.toml diff --git a/.github/workflows/zowe-cli.yml b/.github/workflows/zowe-cli.yml index dd67a014d7..d37d5d37a0 100644 --- a/.github/workflows/zowe-cli.yml +++ b/.github/workflows/zowe-cli.yml @@ -84,24 +84,17 @@ jobs: - name: Build Binary id: build-binary - if: matrix.os != 'windows-latest' && github.event.inputs.test-type != 'nodejs' - run: | - cargo build --verbose ${{ github.event.inputs.binary-type == 'release' && '--release' || '' }} --manifest-path=zowex/Cargo.toml - tar -cvzf zowe.tgz -C zowex/target/${{ github.event.inputs.binary-type }} zowe - - - name: Build Binary (Windows) - id: build-windows-binary - if: matrix.os == 'windows-latest' && github.event.inputs.test-type != 'nodejs' + if: github.event.inputs.test-type != 'nodejs' run: | cargo build --verbose ${{ github.event.inputs.binary-type == 'release' && '--release' || '' }} --manifest-path=zowex/Cargo.toml - tar -cvzf zowe.tgz -C zowex/target/${{ github.event.inputs.binary-type }} zowe.exe - env: - RUSTFLAGS: "-Ctarget-feature=+crt-static" + tar -cvzf zowe.tgz -C zowex/target/${{ github.event.inputs.binary-type || 'debug' }} ${{ matrix.os == 'windows-latest' && 'zowe.exe' || 'zowe' }} - name: Archive Binary if: github.event.inputs.test-type != 'nodejs' id: upload-binary uses: actions/upload-artifact@v4 + # Ignore conflict if multiple jobs upload artifact at same time: https://github.com/actions/upload-artifact/issues/506 + continue-on-error: true with: name: zowe-${{ matrix.os }}.tgz path: zowe.tgz @@ -115,11 +108,6 @@ jobs: tar -xvzf zowe.tgz -C ./__tests__/__resources__/daemon_instances echo "${{ github.workspace }}/__tests__/__resources__/application_instances" >> $GITHUB_PATH - - name: Test Rust EXE and zowe script - id: test-exe-and-script - if: ${{ steps.setup-binary.outcome == 'success' && github.event.inputs.test-type != 'nodejs' }} - run: cargo test ${{ github.event.inputs.binary-type == 'release' && '--release' || '' }} --manifest-path=zowex/Cargo.toml -- --nocapture - - name: Unit Tests if: ${{ always() && steps.build.outcome == 'success' }} run: npm run test:unit diff --git a/zowex/.cargo/config.toml b/zowex/.cargo/config.toml new file mode 100644 index 0000000000..d6d7ccc38a --- /dev/null +++ b/zowex/.cargo/config.toml @@ -0,0 +1,2 @@ +[target.'cfg(all(windows, target_env = "msvc"))'] +rustflags = ["-Ctarget-feature=+crt-static"] \ No newline at end of file