Skip to content

fix: gh action

fix: gh action #6

on:
workflow_call:
inputs:
environment:
type: string
required: true
short_env:
type: string
required: true
description: add '-pnpg' if workflow is related to pnpg
variables:
postmanEnvFile: integration_environment
# ${{ if eq(variables['Build.SourceBranch'], 'refs/heads/uat') }}:
# # selfHostedAgentPool: $(UAT_AGENT_POOL)
# ${{ else }}:
# # selfHostedAgentPool: $(DEV_AGENT_POOL)
# postmanEnvFile: integration_environment.json
# stages:
# - stage: stage_postman_test
# environment: ${{ inputs.environment }}-ci
# displayName: 'Test_e2e_on_${{ variables.environment }}'
# condition: and(succeeded(),or(eq(variables.environment, 'DEV'), eq(variables.environment, 'UAT')))
jobs:
test:
name: 'Run Postman collection on ${{ variables.environment }}'
runs-on: ubuntu-20.04
# pool:
# name: $(selfHostedAgentPool)
steps:
- uses: NodeTool@0
with:
versionSpec: '16.x'
- uses: Npm@1
name: Install newman
with:
command: custom
customCommand: install -g newman
- uses: DownloadSecureFile@1
name: 'download postman environment'
with:
secureFile: $(postmanEnvFile)
- name: Run newman
shell: bash
run: newman run selfcare-onboarding/test/newman/Selfcare-Integration.postman_collection.json -e $(postman_env.secureFilePath) --reporters cli,junit --reporter-junit-export result/test-result.xml
- uses: PublishTestResults@2
with:
testResultsFormat: 'JUnit'
testResultsFiles: '**/test-*.xml'
searchFolder: '$(System.DefaultWorkingDirectory)/result/'
testRunTitle: 'Publish Newman Test Results'
# - task: 'Bash@3'
# displayName: 'Send message on Slack'
# condition: in(variables['Agent.JobStatus'], 'SucceededWithIssues', 'Failed')
# inputs:
# targetType: 'inline'
# script: >
# curl -X POST \
# -H "Content-type: application/json" \
# --data '{"text": "*Attention: There is an error in pipeline $(System.DefinitionName) in step _postman test_!*\nCheck the logs for more details $(System.CollectionUri)$(System.TeamProject)/_build/results?buildId=$(Build.BuildId) to view the build results."}' \
# $(SLACK_WEBHOOK_URL)