Update README.md #500
Workflow file for this run
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
# --------------------------------------------------------------------------------------------- | |
# 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. |