-
Notifications
You must be signed in to change notification settings - Fork 0
129 lines (112 loc) · 5.32 KB
/
postman-test.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
# ---------------------------------------------------------------------------------------------
# MIT License
# Copyright (c) 2021, Solace Corporation, Ricardo Gomez-Ulmke ([email protected])
# ---------------------------------------------------------------------------------------------
name: regression-test
on:
# for testing
workflow_dispatch:
# production
pull_request:
branches:
- main
env:
DEBUG_FLAG: ${{ true }}
# DEBUG_FLAG: ${{ false }}
TEST_PLATFORM_DIR: "api-implementation"
TEST_TEST_RUNNER_OUTPUT_DIR: "api-implementation/test/integration/tmp"
TEST_OUTPUT_NAME: "api-implementation-test-regression"
jobs:
regression_test:
runs-on: ubuntu-22.04
strategy:
max-parallel: 1
matrix:
node: ["18"]
steps:
- name: Check Auth
if: github.event_name == 'workflow_dispatch' && github.actor != 'ricardojosegomezulmke' && github.actor != '195858'
run: |
echo "not authorized"
echo '::set-output name=IS_AUTHORIZED::false'
id: auth
- name: Cancel Workflow
if: ${{ always() && steps.auth.outputs.IS_AUTHORIZED == 'false' }}
uses: andymckay/[email protected]
- name: github-slug-action
uses: rlespinasse/github-slug-action@v4
- name: Checkout Current Branch
uses: actions/checkout@master
with:
ref: ${{ github.ref }}
- name: env before install
if: env.DEBUG_FLAG == 'true'
run: |
echo "bash --version: "; bash --version
echo "node --version: "; node --version
echo "npm --version: "; npm --version
echo ">>> environment: TEST_* "
env | grep TEST
- name: setup node
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node }}
- name: env after install
if: env.DEBUG_FLAG == 'true'
run: |
echo "bash --version: "; bash --version
echo "node --version: "; node --version
echo "npm --version: "; npm --version
echo "docker --version"; docker --version
- name: npm install
run: |
cd "${TEST_PLATFORM_DIR}"
npm install
- name: Create newman folder
run: |
mkdir -p /home/runner/work/newman
- name: Install newman
run: |
npm install -g newman
npm install -g newman-reporter-htmlextra
npm install -g newman-reporter-cli-response
working-directory: /home/runner/work/newman
- name: Create Directory for test results
run: mkdir -p ${{ github.workspace }}/${{ env.TEST_TEST_RUNNER_OUTPUT_DIR }}
- name: Start Mongo
run: |
export APIM_SOLACE_PLATFORM_API_PROJECT_HOME="$GITHUB_WORKSPACE"
cd "$APIM_SOLACE_PLATFORM_API_PROJECT_HOME/${TEST_PLATFORM_DIR}"
source test/integration/source.env.sh
test/integration/mongodb/start.mongo.sh
- name: Start Server
run: |
export APIM_SOLACE_PLATFORM_API_PROJECT_HOME="$GITHUB_WORKSPACE"
cd "$APIM_SOLACE_PLATFORM_API_PROJECT_HOME/${TEST_PLATFORM_DIR}"
source test/integration/source.env.sh
test/integration/start.server.background.sh
- name: Run POSTMAN collection (PR)
run: |
newman run https://raw.githubusercontent.com/solace-iot-team/platform-api/${{ env.GITHUB_HEAD_REF_SLUG }}/api-test/APIMConnectorRegressionTests.postman_collection.json -e https://api.getpostman.com/environments/527b7560-d632-482a-a56e-b09c79299db1?apikey=${{ secrets.POSTMAN_APIKEY }} -r htmlextra,cli-response --reporter-htmlextra-export ${{ github.workspace }}/${{ env.TEST_TEST_RUNNER_OUTPUT_DIR }}/regression-report.html --reporter-htmlextra-darkTheme --verbose --delay-request 100 > ${{ github.workspace }}/${{ env.TEST_TEST_RUNNER_OUTPUT_DIR }}/regression-report-stdout.html
working-directory: /home/runner/work/newman
if: ${{ env.GITHUB_HEAD_REF_SLUG != '' }}
- name: Run POSTMAN collection (Manual)
run: |
newman run https://raw.githubusercontent.com/solace-iot-team/platform-api/${{ env.GITHUB_REF_SLUG }}/api-test/APIMConnectorRegressionTests.postman_collection.json -e https://api.getpostman.com/environments/527b7560-d632-482a-a56e-b09c79299db1?apikey=${{ secrets.POSTMAN_APIKEY }} -r htmlextra,cli-response --reporter-htmlextra-export ${{ github.workspace }}/${{ env.TEST_TEST_RUNNER_OUTPUT_DIR }}/regression-report.html --reporter-htmlextra-darkTheme --verbose --delay-request 100 > ${{ github.workspace }}/${{ env.TEST_TEST_RUNNER_OUTPUT_DIR }}/regression-report-stdout.html
working-directory: /home/runner/work/newman
if: ${{ env.GITHUB_HEAD_REF_SLUG == '' }}
- name: Stop Server
run: |
export APIM_SOLACE_PLATFORM_API_PROJECT_HOME="$GITHUB_WORKSPACE"
cd "$APIM_SOLACE_PLATFORM_API_PROJECT_HOME/${TEST_PLATFORM_DIR}"
source test/integration/source.env.sh
test/integration/stop.server.sh
- name: Archive logs
if: ${{ (failure() && !cancelled()) || (always() && (github.event_name=='workflow_dispatch' || env.DEBUG_FLAG=='true') ) }}
uses: actions/upload-artifact@v3
with:
name: ${{ env.TEST_OUTPUT_NAME }}-postman
path: ${{ github.workspace }}/${{ env.TEST_TEST_RUNNER_OUTPUT_DIR }}
if-no-files-found: error
###
# The End.