Skip to content

Commit

Permalink
Merge pull request #2398 from zowe/chore/v2-update-workflows-and-deps
Browse files Browse the repository at this point in the history
[v2] Update workflows and deps for technical currency
  • Loading branch information
zFernand0 authored Jan 2, 2025
2 parents bf2032b + 99ad120 commit 037c199
Show file tree
Hide file tree
Showing 9 changed files with 41 additions and 56 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/audit.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ on:
pull_request:
branches:
- master
- zowe-v1-lts
- zowe-v?-lts
- next
schedule:
- cron: '0 10 * * *'
Expand Down Expand Up @@ -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
2 changes: 1 addition & 1 deletion .github/workflows/changelog.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ on:
pull_request:
branches:
- master
- zowe-v1-lts
- zowe-v?-lts
- next

jobs:
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/codeql.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/linter.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ on:
push:
branches-ignore:
- 'master'
- 'zowe-v1-lts'
- 'zowe-v?-lts'
- 'next'
pull_request:
branches:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/sonar.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
59 changes: 22 additions & 37 deletions .github/workflows/zowe-cli.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -28,14 +34,12 @@ 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
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'}}
Expand Down Expand Up @@ -66,20 +70,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
Expand All @@ -88,42 +84,30 @@ jobs:

- name: Build Binary
id: build-binary
if: matrix.os != 'windows-latest' && (github.event.inputs.test-type == 'binary' || github.event_name == 'push')
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 == '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')
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
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 == 'binary' || github.event_name == 'push'
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
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: |
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 == 'binary' || github.event_name == 'push') }}
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
Expand All @@ -135,16 +119,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' }}
# 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' }}
Expand Down
12 changes: 6 additions & 6 deletions npm-shrinkwrap.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions zowex/.cargo/config.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
[target.'cfg(all(windows, target_env = "msvc"))']
rustflags = ["-Ctarget-feature=+crt-static"]
10 changes: 4 additions & 6 deletions zowex/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
*/

use std::env;
use std::io;
use std::process::ExitCode;

// other source modules that constitute this executable
mod comm;
Expand Down Expand Up @@ -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<String> = env::args().collect();

Expand All @@ -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)
}

0 comments on commit 037c199

Please sign in to comment.