-
Notifications
You must be signed in to change notification settings - Fork 44
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #648 from hngprojects/sudobro-creator-patch-3
Update postman-api-tests.yml
- Loading branch information
Showing
1 changed file
with
20 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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" | ||
|