Skip to content

Commit

Permalink
chore: wip smoke test-generators (ScottLogic#163)
Browse files Browse the repository at this point in the history
  • Loading branch information
ms14981 committed Mar 27, 2023
1 parent 9d2b9d8 commit a0e92b1
Showing 1 changed file with 37 additions and 14 deletions.
51 changes: 37 additions & 14 deletions .github/workflows/smoke.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ jobs:
run: |
npm install
# JavaScript Generator
- name: Check out the openapi-forge-javascript generator
uses: actions/checkout@v3
with:
Expand All @@ -42,14 +43,26 @@ jobs:
run: |
cd ..
# TypeScript Generator
- name: Check out the openapi-forge-typescript generator
uses: actions/checkout@v3
with:
repository: ScottLogic/openapi-forge-typescript
path: openapi-forge-typescript

- name: Install openapi-forge-typescript dependencies
run: |
cd openapi-forge-typescript
npm install
- name: Return to the main folder
run: |
cd ..
- name: Make script executable
run: |
chmod +x ./src/index.js
# - name: Test Generator Options Command
# run: |
# echo "generator-options=$(./src/index.js generator-options openapi-forge-javascript)" >> $GITHUB_OUTPUT
# id: generator_options
- id: generator_options
name: Test Generator Options Command
run: |
Expand All @@ -71,13 +84,23 @@ jobs:
echo "expected generator-options command to produce the moduleFormat option for the JavaScript generator"
exit 1
# - name: Check Output of Generator Options
# run: |
# echo "Checking the output for moduleFormat"
# if grep -q "moduleFormat" <${{join(steps.generator_options.outputs.*, '\n')}}; then
# echo "Output includes moduleFormat"
# else
# echo "ERROR: Output does not include moduleFormat"
# echo "Full Output: ${{join(steps.generator_options.outputs.*, '\n')}}"
# exit 1
# fi
- id: test_generators
name: Test Generator Options Command
run: |
echo "test-generators<<EOF" >> $GITHUB_OUTPUT
echo "$(./src/index.js test-generators --generators openapi-forge-typescript --format 'json' --logLevel 'quiet')" >> $GITHUB_OUTPUT
echo "EOF" >> $GITHUB_OUTPUT
- name: Print test-generators command STDOUT
run: echo "${{ steps.test_generators.outputs.test-generators }}"

- name: Check Output of Test Generators 1
if: ${{ fromJson(steps.test_generators.outputs.test-generators).scenarios > 0 && fromJson(steps.generator_options.outputs.test-generators).scenarios == fromJson(steps.generator_options.outputs.test-generators).passed }}
run: |
echo "test-generators command succeeded!"
- name: Check Output of Test Generators 2
if: ${{ fromJson(steps.test_generators.outputs.test-generators).scenarios > 0 && fromJson(steps.generator_options.outputs.test-generators).scenarios == fromJson(steps.generator_options.outputs.test-generators).passed }}
run: |
echo "expected test-generators command to show that all tests for the TypeScript generator are passing"
exit 1

0 comments on commit a0e92b1

Please sign in to comment.