Local Build and Postman Tests #4
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
name: Local Build and Postman Tests | |
on: | |
workflow_dispatch: | |
inputs: | |
Query: | |
description: 'Parameter for API request' | |
required: true | |
default: 'The+Rookie' | |
type: string | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Clone repository | |
uses: actions/checkout@v2 | |
# - name: Install Node.js | |
# run: | | |
# sudo apt update | |
# curl -fsSL https://deb.nodesource.com/setup_20.x | sudo bash - | |
# sudo apt-get install -y nodejs | |
- name: Install Node.js | |
uses: actions/setup-node@v3 | |
with: | |
node-version: '20' | |
- name: Cache npm dependencies | |
uses: actions/cache@v3 | |
with: | |
path: ~/.npm | |
key: ${{ runner.os }}-node-${{ hashFiles('package-lock.json') }} | |
restore-keys: | | |
${{ runner.os }}-node- | |
- name: Install dependencies | |
run: | | |
npm install | |
- name: Install newman | |
run: | | |
npm install -g newman | |
- name: Packet check | |
run: | | |
echo "node version: $(node --version)" | |
echo "npm version: $(npm --version)" | |
echo "newman version: $(newman --version)" | |
- name: Run postman tests | |
run: | | |
newman run postman-tests.json --iteration-count 1 --env-var "query=${{ github.event.inputs.Query }}" \ | |
--reporters cli,junit --reporter-junit-export newman-results.xml | |
- name: Upload Newman Test Results | |
uses: actions/upload-artifact@v3 | |
with: | |
name: newman-results | |
path: newman-results.xml |