From 53ac0a7a510487e61acbe134e5d19f77c55e0f57 Mon Sep 17 00:00:00 2001 From: Matthew Smith Date: Fri, 10 Feb 2023 17:10:10 +0000 Subject: [PATCH] chore: add smoke test for generator-options command (#163) --- .github/workflows/smoke.yml | 67 +++++++++++++++++++++++++++++++++++++ 1 file changed, 67 insertions(+) create mode 100644 .github/workflows/smoke.yml diff --git a/.github/workflows/smoke.yml b/.github/workflows/smoke.yml new file mode 100644 index 0000000..75e0aa6 --- /dev/null +++ b/.github/workflows/smoke.yml @@ -0,0 +1,67 @@ +name: Smoke Tests + +on: + push: + branches: + - "**" + pull_request: + branches: + - "**" + +jobs: + smoke-tests: + name: Smoke Tests + runs-on: ubuntu-latest + + steps: + - name: Check out Git repository + uses: actions/checkout@v3 + + - name: Use Node.js + uses: actions/setup-node@v3 + with: + node-version: 16.x + cache: 'npm' + + - name: Install Node.js dependencies + run: | + npm install + + - name: Check out the openapi-forge-javascript generator + uses: actions/checkout@v3 + with: + repository: ScottLogic/openapi-forge-javascript + path: openapi-forge-javascript + + - name: Install openapi-forge-javascript dependencies + run: | + cd openapi-forge-javascript + 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 + - name: Test Generator Options Command + run: | + ./src/index.js generator-options openapi-forge-javascript >> $GITHUB_OUTPUT + id: generator_options + + - 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