Skip to content

Commit

Permalink
Add 'postman_send_transaction_example.yml' workflow file
Browse files Browse the repository at this point in the history
  • Loading branch information
James Browning committed Apr 6, 2021
1 parent 0d20672 commit 635bdd8
Show file tree
Hide file tree
Showing 3 changed files with 57 additions and 0 deletions.
40 changes: 40 additions & 0 deletions .github/workflows/postman_send_transaction_example.yml
@@ -0,0 +1,40 @@
name: Postman Send Transaction Example

on:
schedule:
- cron: '0 1 * * *'
push:
branches:
- feat/postman-examples
workflow_dispatch:

jobs:
deployed-env-checks:
runs-on: ubuntu-20.04
steps:
- name: Checkout Rosetta
uses: actions/checkout@v2

- name: Setup Node
uses: actions/setup-node@v2

- name: Install newman
run: npm i newman

- name: Set private key
env:
PRIVATE_KEY: ${{ secrets.POSTMAN_SEND_TRANSACTION_EXAMPLE_PRIVATE_KEY }}
working-directory: ./examples/postman
run: jq "(.values[] | select(.key==\"privateKey\") | .value) |= \"$PRIVATE_KEY\"" send_transaction_postman_environment.json > ./temp_env.json && mv ./temp_env.json ./send_transaction_postman_environment.json

- name: DEBUG
working-directory: ./examples/postman
run: cat send_transaction_postman_environment.json

- name: Run Signing Server
working-directory: ./examples/postman
run: npm i && node sign-transaction-server &

- name: Run Send Transaction Example
working-directory: ./examples/postman
run: node send-transaction-example send_transaction_postman_environment.json
17 changes: 17 additions & 0 deletions examples/postman/send-transaction-example
@@ -0,0 +1,17 @@
const newman = require('newman');

const env = process.argv[2]

newman.run({
collection: require('./send_transaction_ci.postman_collection.json'),
environment: require(`./${env}`),
reporters: ['cli', 'json']
}, function (err, summary) {
if (err) {
console.error('collection run encountered an error.');
} else if (summary.run.failures.length) {
console.error('assertion failure occured.');
process.exit(1);
}
console.log('collection run complete!');
});

0 comments on commit 635bdd8

Please sign in to comment.