Skip to content

Commit

Permalink
migrate to github actions (#53)
Browse files Browse the repository at this point in the history
* migrate to github actions
* fix a test
  • Loading branch information
d-telnyx committed Dec 18, 2020
1 parent 54a963b commit b302f7e
Show file tree
Hide file tree
Showing 5 changed files with 65 additions and 7 deletions.
8 changes: 8 additions & 0 deletions .github/scripts/before_install.sh
Original file line number Diff line number Diff line change
@@ -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}"
50 changes: 50 additions & 0 deletions .github/workflows/node.js.yml
Original file line number Diff line number Diff line change
@@ -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
File renamed without changes.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -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)
Expand Down Expand Up @@ -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
Expand Down
10 changes: 5 additions & 5 deletions test/resources/Fqdns.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
});
});
Expand Down Expand Up @@ -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()
Expand All @@ -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'})
Expand Down

0 comments on commit b302f7e

Please sign in to comment.