diff --git a/.github/scripts/before_install.sh b/.github/scripts/before_install.sh new file mode 100644 index 0000000..08fc26b --- /dev/null +++ b/.github/scripts/before_install.sh @@ -0,0 +1,8 @@ +if [ ! -d "telnyx-mock/${TELNYX_MOCK_VERSION}" ]; then + mkdir -p telnyx-mock/${TELNYX_MOCK_VERSION} + curl -L "https://github.com/team-telnyx/telnyx-mock/releases/download/v${TELNYX_MOCK_VERSION}/telnyx-mock_${TELNYX_MOCK_VERSION}_linux_amd64.tar.gz" -o "telnyx-mock/${TELNYX_MOCK_VERSION}_linux_amd64.tar.gz" + tar -zxf "telnyx-mock/${TELNYX_MOCK_VERSION}_linux_amd64.tar.gz" -C "telnyx-mock/${TELNYX_MOCK_VERSION}/" +fi +telnyx-mock/${TELNYX_MOCK_VERSION}/telnyx-mock > /dev/null & +TELNYX_MOCK_PID=$! +export PATH="${PATH}:${PWD}/telnyx-mock/${TELNYX_MOCK_VERSION}" \ No newline at end of file diff --git a/.github/workflows/node.js.yml b/.github/workflows/node.js.yml new file mode 100644 index 0000000..fa3bfaa --- /dev/null +++ b/.github/workflows/node.js.yml @@ -0,0 +1,50 @@ +# This workflow will do a clean install of node dependencies, build the source code and run tests across different versions of node +# For more information see: https://help.github.com/actions/language-and-framework-guides/using-nodejs-with-github-actions + +name: CI + +on: + push: + branches: [ master ] + pull_request: + branches: [ master ] + +jobs: + test: + + runs-on: ubuntu-latest + env: + TELNYX_MOCK_VERSION: 0.8.10 + strategy: + matrix: + node-version: [8.x, 10.x, 12.x, 14.x] + + steps: + - uses: actions/checkout@v2 + - name: Use Node.js ${{ matrix.node-version }} + uses: actions/setup-node@v1 + with: + node-version: ${{ matrix.node-version }} + - name: setup-telnyx-mock + run: source ./.github/scripts/before_install.sh + - run: npm ci + - run: npm run build --if-present + - name: Node ${{ matrix.node-version }} + run: npm test + - name: Report + run: npm run report + - name: Coveralls Parallel + uses: coverallsapp/github-action@master + with: + github-token: ${{ secrets.github_token }} + flag-name: run-${{ matrix.node-version }} + parallel: true + finish: + needs: test + runs-on: ubuntu-latest + steps: + - name: Coveralls Finished + uses: coverallsapp/github-action@master + with: + github-token: ${{ secrets.github_token }} + parallel-finished: true \ No newline at end of file diff --git a/.travis.yml b/.travis.yml.bak similarity index 100% rename from .travis.yml rename to .travis.yml.bak diff --git a/README.md b/README.md index 5d15b8b..8dace39 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,7 @@ # Telnyx Node.js Library [![Version](https://img.shields.io/npm/v/telnyx.svg)](https://www.npmjs.org/package/telnyx) -[![Build Status](https://travis-ci.org/team-telnyx/telnyx-node.svg?branch=master)](https://travis-ci.org/team-telnyx/telnyx-node) +[![Build Status](https://github.com/team-telnyx/telnyx-node/workflows/CI/badge.svg)](https://github.com/team-telnyx/telnyx-node/actions) [![Coverage Status](https://coveralls.io/repos/github/team-telnyx/telnyx-node/badge.svg?branch=master)](https://coveralls.io/github/team-telnyx/telnyx-node?branch=master) [![Downloads](https://img.shields.io/npm/dm/telnyx.svg)](https://www.npmjs.com/package/telnyx) [![Try on RunKit](https://badge.runkitcdn.com/telnyx.svg)](https://runkit.com/npm/telnyx) @@ -288,7 +288,7 @@ const allMessagingProfiles = await telnyx.messagingProfiles.list() The test suite depends on [telnyx-mock], so make sure to fetch and run it locally from a background terminal. The default `PORT` used is `12111`. If you want to target a different one, pass the environment variable `TELNYX_MOCK_PORT`. -([telnyx-mock's README][telnyx-mock] also contains +([telnyx-mock's README][telnyx-mock] also contains instructions for installing via Homebrew and other methods): go get -u github.com/team-telnyx/telnyx-mock diff --git a/test/resources/Fqdns.spec.js b/test/resources/Fqdns.spec.js index 2f79114..79b142c 100644 --- a/test/resources/Fqdns.spec.js +++ b/test/resources/Fqdns.spec.js @@ -32,17 +32,17 @@ describe('Fqdns Resource', function() { } it('Sends the correct request', function() { - return telnyx.fqdns.create({connection_id: 'Central BSD-1', fqdn: 'example.com'}) + return telnyx.fqdns.create({connection_id: 'Central BSD-1', fqdn: 'example.com', dns_record_type: 'a'}) .then(responseFn); }) it('Sends the correct request [with specified auth]', function() { - return telnyx.fqdns.create({connection_id: 'Central BSD-1', fqdn: 'example.com'}, TEST_AUTH_KEY) + return telnyx.fqdns.create({connection_id: 'Central BSD-1', fqdn: 'example.com', dns_record_type: 'a'}, TEST_AUTH_KEY) .then(responseFn); }); it('Sends the correct request [with specified auth in options]', function() { - return telnyx.fqdns.create({connection_id: 'Central BSD-1', fqdn: 'example.com'}, {api_key: TEST_AUTH_KEY}) + return telnyx.fqdns.create({connection_id: 'Central BSD-1', fqdn: 'example.com', dns_record_type: 'a'}, {api_key: TEST_AUTH_KEY}) .then(responseFn); }); }); @@ -78,7 +78,7 @@ describe('Fqdns Resource', function() { describe('del', function() { it('Sends the correct request', function() { - return telnyx.fqdns.create({connection_id: 'Central BSD-1', fqdn: 'example.com'}) + return telnyx.fqdns.create({connection_id: 'Central BSD-1', fqdn: 'example.com', dns_record_type: 'a'}) .then(function(response) { const fqdn = response.data; return fqdn.del() @@ -97,7 +97,7 @@ describe('Fqdns Resource', function() { describe('update', function() { it('Sends the correct request', function() { - return telnyx.fqdns.create({connection_id: 'Central BSD-1', fqdn: 'example.com'}) + return telnyx.fqdns.create({connection_id: 'Central BSD-1', fqdn: 'example.com', dns_record_type: 'a'}) .then(function(response) { const fqdn = response.data; return fqdn.update({connection_id: 'Western BSD-2'})