Merge pull request #160 from vmware/feature/159-restore-vrdt-output-logs #390
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
name: Build | |
on: | |
push: | |
branches: | |
- "*" | |
tags-ignore: | |
- "v*" | |
pull_request: | |
branches: | |
- master | |
workflow_dispatch: {} | |
jobs: | |
build: | |
name: Node.js v${{ matrix.node-version }} on ${{ matrix.os }} | |
strategy: | |
fail-fast: false | |
matrix: | |
node-version: [19.6.0] | |
os: [ubuntu-latest] | |
runs-on: ${{ matrix.os }} | |
env: | |
CI: true | |
steps: | |
- uses: actions/checkout@v2 | |
- name: echo github.ref | |
run: echo ${{ github.ref }} | |
- name: Use Node.js ${{ matrix.node-version }} | |
uses: actions/setup-node@v2 | |
with: | |
node-version: ${{ matrix.node-version }} | |
- name: Install NPM 9.4.0 | |
run: npm install -g [email protected] # lock to 9.4.0 until actions/setup-node#411 and npm/cli#4341 are fixed | |
- name: Set version number of package.json and build artifact | |
id: version_step | |
if: runner.os == 'ubuntu-latest' | |
env: | |
RUN_NUMBER: ${{ github.run_number }} | |
run: | | |
PACKAGE_VERSION=$(node -p "require('./package.json').version") | |
echo "version=$PACKAGE_VERSION" | |
PR_NUMBER=$(jq --raw-output ".pull_request.number" "$GITHUB_EVENT_PATH") | |
echo "prNumber=$PR_NUMBER" | |
if [ "$PR_NUMBER" != "null" ]; then | |
VERSION_STRING=${PACKAGE_VERSION}-pr${PR_NUMBER}-$(git rev-parse --short HEAD) | |
else | |
VERSION_STRING=${PACKAGE_VERSION}-nightly-$(git rev-parse --short HEAD) | |
fi | |
npm version --no-git-tag-version $VERSION_STRING | |
echo "version_build=${VERSION_STRING}+${RUN_NUMBER}" >> "$GITHUB_OUTPUT" | |
- name: Get npm cache directory | |
id: npm-cache-dir | |
run: | | |
echo "dir=$(npm config get cache)" >> "$GITHUB_OUTPUT" | |
- uses: actions/cache@v2 | |
id: npm-cache | |
with: | |
path: ${{ steps.npm-cache-dir.outputs.dir }} | |
key: ${{ runner.os }}-node-${{ matrix.node-version }}-${{ hashFiles('**/package-lock.json') }} | |
restore-keys: | | |
${{ runner.os }}-node-${{ matrix.node-version }}- | |
- name: Install dependencies | |
run: "npm ci" | |
- name: Lint, compile, test and package | |
run: "node node_modules/gulp/bin/gulp.js package" | |
if: runner.os == 'ubuntu-latest' | |
- name: Publish code coverage report | |
uses: codecov/codecov-action@v1 | |
if: runner.os == 'ubuntu-latest' | |
with: | |
token: ${{ secrets.CODECOV_TOKEN }} | |
file: "**/coverage/*.json" | |
flags: unittest | |
name: codecov | |
- name: Upload artifact | |
uses: actions/upload-artifact@v4 | |
if: runner.os == 'ubuntu-latest' | |
with: | |
name: vrealize-developer-tools-${{steps.version_step.outputs.version_build}}.vsix | |
path: "*.vsix" |