Skip to content

chore(windows-build): add test case without JAVA_HOME #23

chore(windows-build): add test case without JAVA_HOME

chore(windows-build): add test case without JAVA_HOME #23

Workflow file for this run

name: Build
on:
push:
tags-ignore:
- '*.*'
branches-ignore:
- master
- renovate/**
pull_request:
types: [assigned, opened, synchronize, reopened]
jobs:
build:
name: Build
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [18.x]
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 }}
- name: Install
run: yarn --frozen-lockfile
- name: Lint
run: yarn run lint
- name: Unit Test
run: yarn run test
- name: Build
run: yarn run build
- name: Build Package
run: |
cd dist/apps/generator-cli
yarn pack -f ../package.tgz
- uses: actions/upload-artifact@v3
with:
name: package.tgz
path: dist/apps/package.tgz
e2e:
name: 'E2E local: (${{ matrix.os }})'
needs: build
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
node-version: [18.x]
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 }}
- uses: actions/download-artifact@v3
with:
name: package.tgz
- if: ${{matrix.os == 'windows-latest'}}
name: Test Windows
run: |
$env:JAVA_HOME = $env:JAVA_HOME_11_X64
cd .\examples
yarn global add json; $yarn_global_bin=yarn global bin; $env:PATH += ";$yarn_global_bin"
yarn cache clean; yarn add $env:GITHUB_WORKSPACE\package.tgz
npm run oa version
npm run oa completion
npm run oa help
npm run oa help generate
npm run oa version-manager help
npm run oa generate -- -g ruby -i https://raw.githubusercontent.com/OpenAPITools/openapi-generator/master/modules/openapi-generator/src/test/resources/3_0/petstore.yaml -o $env:GITHUB_WORKSPACE\tmp\ruby-client
npm run oa version-manager set 3.0.0; $version=npm run oa version; if (-not ($version.Contains('3.0.0'))) { exit 1 }
npm run oa version-manager set 4.0; $version=npm run oa version; if (-not ($version.Contains('4.0.3'))) { exit 1 }
npm run oa version-manager set 4.3.1; $version=npm run oa version; if (-not ($version.Contains('4.3.1'))) { exit 1 }
npm run oa version-manager set 4.3.1; $version=npm run oa version; if (-not ($version.Contains('4.3.1'))) { exit 1 }
json -I -f openapitools.json -e "this['generator-cli']['storageDir']='./my/storage/'"
npm run oa version-manager set 4.3.0; $version=npm run oa version; if (-not ($version.Contains('4.3.0'))) { exit 1 }
if (-not (Test-Path .\my\storage\4.3.0.jar)) { exit 1 }
json -I -f openapitools.json -e "this['generator-cli']['storageDir']='~/my/storage/'"
npm run oa version-manager set 4.3.1; $version=npm run oa version; if (-not ($version.Contains('4.3.1'))) { exit 1 }
if (-not (Test-Path ~\my\storage\4.3.1.jar)) { exit 1 }
npm run oa:generate; mkdir .\foo; cd .\foo; npm run oa:generate
cd ..
$env:JAVA_HOME =
npm run oa:generate; mkdir .\bar; cd .\bar; npm run oa:generate
- if: ${{matrix.os != 'windows-latest'}}
name: Test Ubuntu/MacOS
run: |
cd ./examples
yarn global add json && export PATH="$(yarn global bin):$PATH"
yarn cache clean && yarn add $GITHUB_WORKSPACE/package.tgz
npm run oa version
npm run oa completion
npm run oa help
npm run oa help generate
npm run oa version-manager help
npm run oa generate -- -g ruby -i https://raw.githubusercontent.com/OpenAPITools/openapi-generator/master/modules/openapi-generator/src/test/resources/3_0/petstore.yaml -o $GITHUB_WORKSPACE/tmp/ruby-client
(npm run oa version-manager set 3.0.0 && npm run oa version | grep -q '3.0.0') || exit 1
(npm run oa version-manager set 4.0 && npm run oa version | grep -q '4.0.3') || exit 1
(npm run oa version-manager set 4.3.1 && npm run oa version | grep -q '4.3.1') || exit 1
(npm run oa version-manager set 4.3.1 && npm run oa version | grep -q '4.3.1') || exit 1
json -I -f openapitools.json -e 'this["generator-cli"]["storageDir"]="./my/storage/"'
(npm run oa version-manager set 4.3.0 && npm run oa version | grep -q '4.3.0') || exit 1
test -f ./my/storage/4.3.0.jar || exit 1
json -I -f openapitools.json -e 'this["generator-cli"]["storageDir"]="~/my/storage/"'
(npm run oa version-manager set 4.3.1 && npm run oa version | grep -q '4.3.1') || exit 1
test -f ~/my/storage/4.3.1.jar || exit 1
npm run oa:generate && mkdir ./foo && cd ./foo && npm run oa:generate
cd ..
unset JAVA_HOME
npm run oa:generate && mkdir ./bar && cd ./bar && npm run oa:generate
# release:
# if: github.event.pull_request.merged == 'true'
# name: Release (Dry)
# # needs: e2e # DONT FORGET TO ENABLE ME !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
# runs-on: ubuntu-18.04
# steps:
#
# - name: Checkout
# uses: actions/checkout@v2
# with:
# fetch-depth: 0
#
# - name: Use Node.js ${{matrix.node-version }}
# uses: actions/setup-node@v1
# with:
# node-version: ${{matrix.node-version }}
#
# - name: Install
# run: yarn --frozen-lockfile
#
# - name: Release
# env:
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
# run: npx semantic-release -d