-
Notifications
You must be signed in to change notification settings - Fork 85
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: zFernand0 <[email protected]>
- Loading branch information
Showing
7 changed files
with
152 additions
and
24 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
# GitHub Workflows | ||
|
||
General information about GH Workflows | ||
|
||
### Using `act` | ||
|
||
1. Read about it: https://github.com/nektos/act (Requires Docker) | ||
2. Install it https://github.com/nektos/act#installation | ||
3. Run: `act --eventpath .github/_act_event.json --workflows .github/workflows/zowe-cli.yml --verbose --reuse` | ||
- Equivalent: `act -vre .github/_act_event.json -W .github/workflows/zowe-cli.yml` | ||
4. After it fails the first time, Copy the `zowe.tgz` file from the Build-Linux container to the Cross-Platform-Test container | ||
- `docker cp act-Zowe-CLI-Build-Linux:/root/gh/zowe/zowe-cli/zowe.tgz .` | ||
- `docker cp zowe.tgz act-Zowe-CLI-Cross-Platform-Test:/root/gh/zowe/zowe-cli/` | ||
5. Run: `act -re .github/_act_event.json -W .github/workflows/zowe-cli.yml` | ||
|
||
`100.` To start from scratch, just remove the containers | ||
- `docker rm act-Zowe-CLI-Build-Linux --force` | ||
- `docker rm act-Zowe-CLI-Cross-Platform-Test --force` | ||
|
||
**Knwon Issues for `nektos/[email protected]`** | ||
|
||
`0.` The first time (i.e. when it is supposed to fail) it will likely take ~3 minutes to run. Subsequent runs (with `--reuse`) should take less than 2 minutes. <br/> | ||
`1.` Artifact upload and download doesn't work on `nektos/act` (hence why we need to manually copy the zowe.tgz). <br/> | ||
`2.` `nektos/act` only works with linux distros. <br/> | ||
`3.` `Install Rust toolchain` step was replaced with simple `yum install cargo -y` because `actions-rs/toolchain@v1` doesn't really work with `nektos/act`. <br/> | ||
`4.` Steps context (`steps.<id>`) doesn't really work on `nektos/act` (hence why we force unit and integration tests to run). <br/> | ||
`5.` Pipeline cannot be stopped (`Ctrl+C`) during most steps unless you kill your docker daemon. <br/> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
{ | ||
"head_commit": { | ||
"message": "test" | ||
}, | ||
"inputs": { | ||
"binary-type": "debug" | ||
}, | ||
"run_with_act": true | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
# 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 CI | ||
name: Zowe CLI | ||
|
||
on: | ||
push: | ||
|
@@ -12,66 +12,157 @@ on: | |
paths-ignore: | ||
- 'zowex/**' | ||
- '.github/workflows/rust-cli*.yml' | ||
workflow_dispatch: | ||
inputs: | ||
binary-type: | ||
description: "Specify whether to use a `debug` or a `release` version of the binary" | ||
default: "debug" | ||
required: false | ||
|
||
jobs: | ||
test: | ||
build-linux: | ||
name: Build Linux | ||
runs-on: ubuntu-latest | ||
|
||
runs-on: ${{ matrix.os }} | ||
# Need to build in container with old version of GLIBC to support RHEL 7 | ||
# https://kobzol.github.io/rust/ci/2021/05/07/building-rust-binaries-in-ci-that-work-with-older-glibc.html | ||
container: quay.io/pypa/manylinux2014_x86_64 | ||
|
||
if: (github.event_name == 'push' || github.event.pull_request.head.repo.full_name != github.repository) && !contains(github.event.head_commit.message, '[ci skip]') | ||
steps: | ||
- uses: actions/checkout@v2 | ||
|
||
- name: Install Rust toolchain | ||
if: (!github.event.run_with_act) | ||
uses: actions-rs/toolchain@v1 | ||
with: | ||
profile: minimal | ||
toolchain: stable | ||
override: true | ||
|
||
- name: Install Rust toolchain | ||
if: github.event.run_with_act | ||
run: | | ||
yum install cargo -y | ||
cargo --version | ||
- name: Build | ||
run: cargo build --verbose ${{ github.event.inputs.binary-type == 'release' && '--release' || '' }} --manifest-path=zowex/Cargo.toml | ||
|
||
- name: Create Archive | ||
run: tar -cvzf zowe.tgz -C zowex/target/${{ github.event.inputs.binary-type == 'release' && 'release' || 'debug' }} zowe | ||
|
||
- name: Upload the Prebuilt Linux Binary | ||
if: (!github.event.run_with_act) | ||
uses: actions/upload-artifact@v2 | ||
with: | ||
name: zowe-linux-latest.tgz | ||
path: zowe.tgz | ||
|
||
test: | ||
name: Cross-Platform Test | ||
runs-on: ${{ matrix.os }} | ||
needs: build-linux | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
node-version: [12.x, 14.x, 16.x] | ||
os: [windows-latest, ubuntu-latest, macos-latest] | ||
# node-version: [12.x, 14.x, 16.x] | ||
# os: [windows-latest, ubuntu-latest, macos-latest] | ||
node-version: [16.x] | ||
os: [ubuntu-latest] | ||
|
||
env: | ||
OS: ${{ matrix.os }} | ||
NODE: ${{ matrix.node-version }} | ||
NODE_OPTIONS: --max_old_space_size=4096 | ||
|
||
if: (github.event_name == 'push' || github.event.pull_request.head.repo.full_name != github.repository) && !contains(github.event.head_commit.message, '[ci skip]') | ||
|
||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v2 | ||
|
||
- name: Use Node.js ${{ matrix.node-version }} | ||
uses: actions/setup-node@v1 | ||
uses: actions/setup-node@v2 | ||
with: | ||
node-version: ${{ matrix.node-version }} | ||
|
||
- name: Use NPM v7 | ||
id: npm7 | ||
run: npm install -g npm@^7 | ||
- name: Get NPM Version | ||
id: npm-version | ||
run: echo "::set-output name=number::$(npm --version)" | ||
|
||
- name: Use NPM v8 | ||
id: npm8 | ||
run: npm install -g npm@^8 | ||
|
||
- name: Install Node Package Dependencies | ||
id: install | ||
run: npm ci | ||
|
||
- name: Use Original NPM Version | ||
id: original-npm-version | ||
run: npm install -g npm@${{ steps.npm-version.outputs.number }} | ||
|
||
- name: Build Source | ||
id: build | ||
run: npm run build --if-present | ||
|
||
- name: Build Windows Binary | ||
if: matrix.os == 'windows-latest' | ||
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 | ||
- name: Build MacOS Binary | ||
if: matrix.os == 'macos-latest' | ||
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: Download Prebuilt Linux Binary | ||
if: matrix.os == 'ubuntu-latest' && !github.event.run_with_act | ||
uses: actions/download-artifact@v2 | ||
with: | ||
name: zowe-linux-latest.tgz | ||
|
||
- name: Archive Binary | ||
if: matrix.os != 'ubuntu-latest' | ||
id: upload-binary | ||
uses: actions/upload-artifact@v2 | ||
with: | ||
name: zowe-${{ matrix.os }}.tgz | ||
path: zowe.tgz | ||
|
||
- name: Setup Binary in PATH | ||
id: setup-binary | ||
run: tar -xvzf zowe.tgz -C ./node_modules/.bin --overwrite | ||
# run: | | ||
# mkdir -p $HOME/.zowe/_bin | ||
# tar -xvzf zowe.tgz -C $HOME/.zowe/_bin | ||
# ${{ github.event.run_with_act && 'export PATH=$HOME/.zowe/_bin:$PATH' || 'echo "$HOME/.zowe/_bin" >> $GITHUB_PATH' }} | ||
|
||
- name: Unit Tests | ||
id: unit | ||
if: ${{ always() && steps.build.outcome == 'success' }} | ||
run: npm run test:unit >> file.txt | ||
if: ${{ always() && steps.build.outcome == 'success' }} || github.event.run_with_act | ||
run: npm run test:unit >> unit-tests.txt | ||
|
||
- name: Integration Tests | ||
id: integration | ||
if: ${{ always() && steps.build.outcome == 'success' }} | ||
run: npm run test:integration >> file.txt | ||
if: ${{ always() && steps.build.outcome == 'success' }} || github.event.run_with_act | ||
run: npm run test:integration >> integration-tests.txt | ||
|
||
- name: Archive Results | ||
id: upload | ||
if: ${{ always() && steps.build.outcome == 'success' }} | ||
if: ${{ always() && steps.build.outcome == 'success' }} && !github.event.run_with_act | ||
uses: actions/upload-artifact@v2 | ||
with: | ||
name: ${{ matrix.os }}-${{ matrix.node-version }}-results | ||
path: __tests__/__results__/ | ||
path: | | ||
__tests__/__results__/ | ||
unit-tests.txt | ||
integration-tests.txt | ||
- name: Upload Results to Codecov | ||
if: ${{ always() && steps.build.outcome == 'success' }} | ||
if: ${{ always() && steps.build.outcome == 'success' }} && !github.event.run_with_act | ||
uses: codecov/[email protected] | ||
with: | ||
env_vars: OS,NODE |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters