From e5262a18d445c64c0679ba42863a70299df52d13 Mon Sep 17 00:00:00 2001 From: Mihajlo Date: Mon, 26 Jul 2021 19:38:59 +0200 Subject: [PATCH] chore: sending message to slack if cypress with sasjs-tests fails --- .github/workflows/npmpublish.yml | 4 ++-- sasjs-cypress-run.sh | 9 +++++++++ 2 files changed, 11 insertions(+), 2 deletions(-) create mode 100755 sasjs-cypress-run.sh diff --git a/.github/workflows/npmpublish.yml b/.github/workflows/npmpublish.yml index 69d8c67..8c48c28 100644 --- a/.github/workflows/npmpublish.yml +++ b/.github/workflows/npmpublish.yml @@ -75,14 +75,14 @@ jobs: replace-in-files --regex='"sasjsTestsUrl".*' --replacement='"sasjsTestsUrl":"${{ secrets.SASJS_TEST_URL_VIYA }}",' ./cypress.json replace-in-files --regex='"username".*' --replacement='"username":"${{ secrets.SAS_USERNAME }}",' ./cypress.json replace-in-files --regex='"password".*' --replacement='"password":"${{ secrets.SAS_PASSWORD }}",' ./cypress.json - npm run cy:run -- --spec "cypress/integration/sasjs.tests.ts" + sh ./sasjs-cypress-run.sh ${{ secrets.SLACK_WEBHOOK }} - name: Run cypress on sas9 run: | replace-in-files --regex='"sasjsTestsUrl".*' --replacement='"sasjsTestsUrl":"${{ secrets.SASJS_TEST_URL_SAS9 }}",' ./cypress.json replace-in-files --regex='"username".*' --replacement='"username":"${{ secrets.SAS_USERNAME }}",' ./cypress.json replace-in-files --regex='"password".*' --replacement='"password":"${{ secrets.SAS_PASSWORD }}",' ./cypress.json - npm run cy:run -- --spec "cypress/integration/sasjs.tests.ts" + sh ./sasjs-cypress-run.sh ${{ secrets.SLACK_WEBHOOK }} - name: Semantic Release uses: cycjimmy/semantic-release-action@v2 diff --git a/sasjs-cypress-run.sh b/sasjs-cypress-run.sh new file mode 100755 index 0000000..e25b60e --- /dev/null +++ b/sasjs-cypress-run.sh @@ -0,0 +1,9 @@ +#!/bin/bash + +if npm run cy:run -- --spec "cypress/integration/sasjs.tests.ts" ; then + echo "Cypress sasjs testing passed!" +else + curl -X POST --data-urlencode "payload={\"channel\":\"#sasjs\", \"username\":\"GitHub CI\", \"text\":\"Publish of a @sasjs/adapter has been canceled because of the failing sasjs-tests!\", \"icon_emoji\":\":warning:\"}" $1 + echo "Cypress sasjs testing failed!" + exit 1 +fi \ No newline at end of file