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 28, 2023
1 parent 9d2b9d8 commit c3c7fad
Showing 1 changed file with 42 additions and 15 deletions.
57 changes: 42 additions & 15 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,19 +43,35 @@ jobs:
run: |
cd ..
# TypeScript Generator
- name: Go to the top level
run: |
cd ..
- 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 ../openapi-forge/
- 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: |
echo "generator-options<<EOF" >> $GITHUB_OUTPUT
echo "$(./src/index.js generator-options openapi-forge-javascript)" >> $GITHUB_OUTPUT
echo "$(./src/index.js generator-options openapi-forge-typescript)" >> $GITHUB_OUTPUT
echo "EOF" >> $GITHUB_OUTPUT
- name: Print generator-options command STDOUT
Expand All @@ -71,13 +88,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-javascript --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 c3c7fad

Please sign in to comment.