Skip to content

Update workflows and deps for technical currency #10009

Update workflows and deps for technical currency

Update workflows and deps for technical currency #10009

Workflow file for this run

# This workflow will do a clean install of node dependencies, build the source code and run tests across different versions of node
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-nodejs-with-github-actions
name: Zowe CLI
on:
push:
pull_request:
workflow_dispatch:
inputs:
binary-type:
type: choice
description: Specify whether to use a `debug` or a `release` version of the binary
default: debug
options:
- debug
- release
test-type:
type: choice
description: Specify whether to run tests using the `binary` or regular `nodejs` executable
default: binary
options:
- binary
- nodejs
macos-type:
type: choice
description: Run against x86-based MacOS (12), otherwise run against ARM64-based MacOS (14)
default: macos-14
options:
- macos-12
- macos-14
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 }}
strategy:
fail-fast: false
matrix:
node-version: [18.x, 20.x, 22.x]
os:
- windows-latest
- ubuntu-latest
- ${{ github.event.inputs.macos-type || 'macos-14'}}
env:
OS: ${{ matrix.os }}
NODE: ${{ matrix.node-version }}
NODE_OPTIONS: --max_old_space_size=4096
timeout-minutes: 90
concurrency:
group: ${{ matrix.os }}-node-${{ matrix.node-version }}-ci-${{ github.ref }}
cancel-in-progress: true
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
check-latest: true
- name: Disable Lint Annotations
run: |
echo "::remove-matcher owner=eslint-compact::"
echo "::remove-matcher owner=eslint-stylish::"
- name: Install Dependencies
run: npm ci
- name: Install Rust toolchain
id: install-rust
if: github.event.inputs.test-type != 'nodejs'
uses: dtolnay/rust-toolchain@stable
- name: Build Source
id: build
run: npm run build
- 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'
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"
- name: Archive Binary
if: github.event.inputs.test-type != 'nodejs'
id: upload-binary
uses: actions/upload-artifact@v4
with:
name: zowe-${{ matrix.os }}.tgz
path: zowe.tgz
overwrite: true
- name: Setup Binary in PATH
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 != '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
- name: Unlock Keyring
id: unlock-keyring
if: ${{ always() && steps.build.outcome == 'success' && matrix.os == 'ubuntu-latest' }}
uses: t1m0thyj/unlock-keyring@v1
- name: Start Daemon
id: start-daemon
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 == 'nodejs' }}
run: npm run test:integration
- name: Integration Tests (Daemon)
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' }}
uses: actions/upload-artifact@v4
with:
name: ${{ matrix.os }}-${{ matrix.node-version }}-results
path: __tests__/__results__/
- name: Upload Results to Codecov
if: ${{ always() && steps.build.outcome == 'success' }}
uses: codecov/codecov-action@v4
with:
env_vars: OS,NODE
token: ${{ secrets.CODECOV_TOKEN }}
release:
if: github.event_name == 'push' && github.ref_protected
needs: test
runs-on: ubuntu-latest
permissions:
issues: write
contents: write
pull-requests: write
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
persist-credentials: false
ref: ${{ github.ref }}
# Use Node 20. Currently the latest.
- name: Use Node.js 20
uses: actions/setup-node@v4
with:
node-version: '20'
- name: Install Dependencies
run: npm ci
- name: Build Source
run: npm run build
- uses: zowe-actions/octorelease@v1
env:
GIT_COMMITTER_NAME: ${{ secrets.ZOWE_ROBOT_USER }}
GIT_COMMITTER_EMAIL: ${{ secrets.ZOWE_ROBOT_EMAIL }}
GIT_CREDENTIALS: x-access-token:${{ secrets.ZOWE_ROBOT_TOKEN }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NPM_USERNAME: ${{ secrets.ARTIFACTORY_USERNAME }}
NPM_PASSWORD: ${{ secrets.ARTIFACTORY_PASSWORD }}
NPM_EMAIL: ${{ secrets.ZOWE_ROBOT_EMAIL }}