Skip to content

Commit

Permalink
Merge pull request #648 from hngprojects/sudobro-creator-patch-3
Browse files Browse the repository at this point in the history
Update postman-api-tests.yml
  • Loading branch information
stephennwachukwu authored Aug 25, 2024
2 parents 994a6aa + c10378c commit 90a5253
Showing 1 changed file with 20 additions and 12 deletions.
32 changes: 20 additions & 12 deletions .github/workflows/postman-api-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,41 +2,49 @@ name: API Test and Status Update

on:
schedule:
- cron: "*/15 * * * *"
- cron: "*/15 * * * *"
workflow_dispatch:

jobs:
run-newman-tests:
runs-on: ubuntu-latest

steps:
- name: Checkout code
- name: Checkout Code
uses: actions/checkout@v3

- name: Install Node.js
- name: Set up Node.js
uses: actions/setup-node@v3
with:
node-version: '20'

- name: Install Newman
run: npm install -g newman

- name: Run Newman Collection
- name: Run Postman Collection with HTML Reporter
run: |
newman run "$NEW_COLLECTION_PATH" \
--environment "$NEW_ENVIRONMENT_PATH" \
--reporters json \
newman run "hg_boilerplate_java_web/qa_tests/regression/Spartacus_Java_Boilerplate_copy-postman_collection.json" \
--reporter htmlextra \
--reporter-htmlextra-export "newman-report.html" \
--reporter-json-export "result.json"
env:
NEW_COLLECTION_PATH: ${{ secrets.NEWMAN_COLLECTION_PATH }}
NEW_ENVIRONMENT_PATH: ${{ secrets.NEWMAN_ENVIRONMENT_PATH }}
- name: Set up Java
uses: actions/setup-java@v3
with:
distribution: 'adopt'
java-version: '17'

- name: Send parsed result to Hosted Application
run: |
export APP_URL=${{ secrets.APP_URL }}
java -jar sendPostmanApiTestResults.jar newman-report.html result.json
- name: Copy result.json to server
- name: Copy newman-report.html to server
uses: appleboy/[email protected]
with:
host: ${{ secrets.HOST }}
username: ${{ secrets.USERNAME }}
password: ${{ secrets.PASSWORD }}
source: "result.json"
source: "newman-report.html"
target: "/home/${{ secrets.USERNAME }}/hng_boilerplate_java_web"

0 comments on commit 90a5253

Please sign in to comment.