create account

STONEm Client Update: Developing an Industry Standard Workflow. by creatrixity

View this thread on: hive.blogpeakd.comecency.com
· @creatrixity · (edited)
$14.49
STONEm Client Update: Developing an Industry Standard Workflow.
### Repository
[https://github.com/stonecoinproject/stonem-frontend](https://github.com/stonecoinproject/stonem-frontend)

![Banner](https://steemitimages.com/640x0/https://cdn.steemitimages.com/DQmUDKmSTV6bUWjW2c7THp5pnRfy5PAs43Kko8AnAzhNmou/stone-banner.jpg)

On [the debut post on STONEm client development](https://steemit.com/utopian-io/@creatrixity/stonem-client-development-building-a-front-end-client-for-a-rock-solid-feature-rich-cryptocurrency-ecosystem),  we added automated testing, static code analysis & strict linting to our development process to ensure good code quality assurance and minimize bugs on production. We also added Continuous Integration (CI) & Continuous Deployment strategies alongside a staging server for QA tests to our development road map.


### What's New?

Continuous Integration (CI) was integrated into our development process with [CircleCI](https://circleci.com/) & [Code Climate](https://codeclimate.com/github/stonecoinproject/stonem-frontend). We also increased code test coverage levels to an all time high 98%.


#### Why Continuous Integration?

 CircleCI runs all unit, end-to-end and functional tests upon successful pull request review and returns the build status. Our repository promptly rejects any pull request that leads to a failing build. This is pretty important as we are able to find breaking changes *before* they make their way into production.

Increasing [code coverage](https://en.wikipedia.org/wiki/Code_coverage#Coverage_criteria) levels is really an art and less of a science as code as code coverage checks four base criteria:

+ Function coverage
+ Statement coverage
+ Branch coverage
+ Condition coverage.

Core challenge has been increasing branch coverage to above 50% and we have been able to attain branch coverage levels of 61% by writing tests for if-else cases that execute if a value is `true`or `false`. In the below test, we have a test that executes only when the `isSelected`prop is `true`.

```js
// src/__tests__/

test('A `Dot` element is rendered when the filter button is selected', () => {
    const {
        queryByTestId,
        unmount
    } = render(<FilterButton isSelected/>);

    const dot = queryByTestId('dot');
    expect(dot).toBeInstanceOf(HTMLElement);

    unmount();
})
```

To attain higher branch coverage levels, we must write a test that executes for the reverse condition.

```js
test('No `Dot` element is rendered when the filter button is not selected', () => {
    const {
        queryByTestId,
        unmount
    } = render(<FilterButton isSelected={false}/>);

    const dot = queryByTestId('dot');    
    expect(dot).toBeNull();

    unmount();
})
```

Both tests execute the portion of code below.

![highight.png](https://cdn.steemitimages.com/DQmPU7JrT6d2C9jUVE1cRkQBtPV2F2EP4J6rvaTBJpfYdKX/highight.png)

Next, we are able to run further analysis to monitor code duplication, code coverage levels and code smells (poor coding practices) within our pulls with Code Climate.  We ensure every pull request has a minimum code coverage level of about 70% and any pull request that drops overall code coverage levels below 70% provides a failing build.

![codeclimate-analysis-12-6-18.png](https://cdn.steemitimages.com/DQmeqRCZntJ42WvgmqTBodf4NiTjXJeAVXtrzqooZNF7439/codeclimate-analysis-12-6-18.png)

#### Integrating Continuous Deployment.

Continuous deployment is really essential for a workflow with no friction. If we have to jump on the QA staging server for every time a pull is merged to the master, that'll really suck. We need to make sure a master merge automates the following:

+ Recompilation of assets to source files.
+ 3rd party code updates.
+ Server restarts and/or reboots.

To do this, we use [Git hooks](https://github.com/) to listen for master branch merges and sets off our automation shell script. This script restarts the server running with the `pm2` NPM package.

```shell
cd /var/www/stonem-frontend

echo "Pulling from Master" 

git pull origin master

echo "Pulled successfully from master"

echo "Restarting server..."

pm2 restart server

echo "Server restarted Successfully"
```
We'd love to unveil our test server to the public but unfortunately that is not within the public domain now.

### Roadmap

+ Add capacity to create STONE masternodes directly from the interface.
+ STONE wallet management all in one location.
+ Better, more detailed Github & component documentation.

### Commits

+ [fix lint errors & switch to types from interfaces.](https://github.com/stonecoinproject/stonem-frontend/pull/27/commits/cf5e074eee71888f30bbbb258c5e67b07df42f5b)

+ [fix production bug where `css` prop is deprecated in favor of `style`](https://github.com/stonecoinproject/stonem-frontend/pull/27/commits/d33378a635e25ea9372cb9b4a492182453981847)

+ [Merge pull request #26 from creatrixity/fix/tslint-errors](https://github.com/stonecoinproject/stonem-frontend/pull/27/commits/2012238c45d179b01207aba2cdf61219217d700b)

### Github Account

[https://github.com/creatrixity](https://github.com/creatrixity)
πŸ‘  , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , and 26 others
properties (23)
authorcreatrixity
permlinkstonem-client-update-developing-an-industry-standard-workflow
categoryutopian-io
json_metadata{"tags":["utopian-io","development","stonecoin","programming","technology"],"image":["https://steemitimages.com/640x0/https://cdn.steemitimages.com/DQmUDKmSTV6bUWjW2c7THp5pnRfy5PAs43Kko8AnAzhNmou/stone-banner.jpg","https://cdn.steemitimages.com/DQmPU7JrT6d2C9jUVE1cRkQBtPV2F2EP4J6rvaTBJpfYdKX/highight.png","https://cdn.steemitimages.com/DQmeqRCZntJ42WvgmqTBodf4NiTjXJeAVXtrzqooZNF7439/codeclimate-analysis-12-6-18.png"],"links":["https://github.com/stonecoinproject/stonem-frontend","https://steemit.com/utopian-io/@creatrixity/stonem-client-development-building-a-front-end-client-for-a-rock-solid-feature-rich-cryptocurrency-ecosystem","https://circleci.com/","https://codeclimate.com/github/stonecoinproject/stonem-frontend","https://en.wikipedia.org/wiki/Code_coverage#Coverage_criteria","https://github.com/","https://github.com/stonecoinproject/stonem-frontend/pull/27/commits/cf5e074eee71888f30bbbb258c5e67b07df42f5b","https://github.com/stonecoinproject/stonem-frontend/pull/27/commits/d33378a635e25ea9372cb9b4a492182453981847","https://github.com/stonecoinproject/stonem-frontend/pull/27/commits/2012238c45d179b01207aba2cdf61219217d700b","https://github.com/creatrixity"],"app":"steemit/0.1","format":"markdown"}
created2018-12-06 08:37:27
last_update2018-12-06 08:39:27
depth0
children6
last_payout2018-12-13 08:37:27
cashout_time1969-12-31 23:59:59
total_payout_value11.110 HBD
curator_payout_value3.383 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length5,061
author_reputation16,463,772,859,893
root_title"STONEm Client Update: Developing an Industry Standard Workflow."
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id76,439,637
net_rshares24,113,631,833,993
author_curate_reward""
vote details (90)
@helo ·
$9.95
- Post is of good quality, great explanation of CI, code coverage and CD.
- No comments found on this small amount of code changes.

Your contribution has been evaluated according to [Utopian policies and guidelines](https://join.utopian.io/guidelines), as well as a predefined set of questions pertaining to the category.

To view those questions and the relevant answers related to your post, [click here](https://review.utopian.io/result/3/2-3-3-1-2-1-3-).

---- 
Need help? Write a ticket on https://support.utopian.io/. 
Chat with us on [Discord](https://discord.gg/uTyJkNm). 
[[utopian-moderator]](https://join.utopian.io/)
πŸ‘  , , , , , , , , , , , , , , , , , , ,
properties (23)
authorhelo
permlinkre-creatrixity-stonem-client-update-developing-an-industry-standard-workflow-20181208t035036202z
categoryutopian-io
json_metadata{"tags":["utopian-io"],"links":["https://join.utopian.io/guidelines","https://review.utopian.io/result/3/2-3-3-1-2-1-3-","https://support.utopian.io/","https://discord.gg/uTyJkNm","https://join.utopian.io/"],"app":"steemit/0.1"}
created2018-12-08 03:50:36
last_update2018-12-08 03:50:36
depth1
children1
last_payout2018-12-15 03:50:36
cashout_time1969-12-31 23:59:59
total_payout_value7.534 HBD
curator_payout_value2.417 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length629
author_reputation121,547,934,535,311
root_title"STONEm Client Update: Developing an Industry Standard Workflow."
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id76,526,930
net_rshares16,399,005,110,266
author_curate_reward""
vote details (20)
@utopian-io ·
Thank you for your review, @helo! Keep up the good work!
properties (22)
authorutopian-io
permlinkre-re-creatrixity-stonem-client-update-developing-an-industry-standard-workflow-20181208t035036202z-20181210t180512z
categoryutopian-io
json_metadata"{"app": "beem/0.20.9"}"
created2018-12-10 18:05:15
last_update2018-12-10 18:05:15
depth2
children0
last_payout2018-12-17 18:05:15
cashout_time1969-12-31 23:59:59
total_payout_value0.000 HBD
curator_payout_value0.000 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length56
author_reputation152,955,367,999,756
root_title"STONEm Client Update: Developing an Industry Standard Workflow."
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id76,648,589
net_rshares0
@steemitboard ·
Congratulations @creatrixity! You have completed the following achievement on the Steem blockchain and have been rewarded with new badge(s) :

<table><tr><td>https://steemitimages.com/60x70/http://steemitboard.com/@creatrixity/votes.png?201812071237</td><td>You made more than 9000 upvotes. Your next target is to reach 10000 upvotes.</td></tr>
</table>

<sub>_[Click here to view your Board of Honor](https://steemitboard.com/@creatrixity)_</sub>
<sub>_If you no longer want to receive notifications, reply to this comment with the word_ `STOP`</sub>



**Do not miss the last post from @steemitboard:**
<table><tr><td><a href="https://steemit.com/steemitboard/@steemitboard/5jrq2c-steemitboard-saint-nicholas-day"><img src="https://steemitimages.com/64x128/http://i.cubeupload.com/mGo2Zd.png"></a></td><td><a href="https://steemit.com/steemitboard/@steemitboard/5jrq2c-steemitboard-saint-nicholas-day">Saint Nicholas challenge for good boys and girls</a></td></tr></table>

> Support [SteemitBoard's project](https://steemit.com/@steemitboard)! **[Vote for its witness](https://v2.steemconnect.com/sign/account-witness-vote?witness=steemitboard&approve=1)** and **get one more award**!
properties (22)
authorsteemitboard
permlinksteemitboard-notify-creatrixity-20181207t131759000z
categoryutopian-io
json_metadata{"image":["https://steemitboard.com/img/notify.png"]}
created2018-12-07 13:18:00
last_update2018-12-07 13:18:00
depth1
children0
last_payout2018-12-14 13:18:00
cashout_time1969-12-31 23:59:59
total_payout_value0.000 HBD
curator_payout_value0.000 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length1,187
author_reputation38,975,615,169,260
root_title"STONEm Client Update: Developing an Industry Standard Workflow."
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id76,497,959
net_rshares0
@steemitboard ·
Congratulations @creatrixity! You received a personal award!

<table><tr><td>https://steemitimages.com/70x70/http://steemitboard.com/@creatrixity/birthday1.png</td><td>1 Year on Steemit</td></tr></table>

<sub>_[Click here to view your Board of Honor](https://steemitboard.com/@creatrixity)_</sub>


**Do not miss the last post from @steemitboard:**
<table><tr><td><a href="https://steemit.com/steemitboard/@steemitboard/5jrq2c-steemitboard-saint-nicholas-day"><img src="https://steemitimages.com/64x128/http://i.cubeupload.com/mGo2Zd.png"></a></td><td><a href="https://steemit.com/steemitboard/@steemitboard/5jrq2c-steemitboard-saint-nicholas-day">Saint Nicholas challenge for good boys and girls</a></td></tr></table>

> Support [SteemitBoard's project](https://steemit.com/@steemitboard)! **[Vote for its witness](https://v2.steemconnect.com/sign/account-witness-vote?witness=steemitboard&approve=1)** and **get one more award**!
properties (22)
authorsteemitboard
permlinksteemitboard-notify-creatrixity-20181207t171227000z
categoryutopian-io
json_metadata{"image":["https://steemitboard.com/img/notify.png"]}
created2018-12-07 17:12:27
last_update2018-12-07 17:12:27
depth1
children0
last_payout2018-12-14 17:12:27
cashout_time1969-12-31 23:59:59
total_payout_value0.000 HBD
curator_payout_value0.000 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length932
author_reputation38,975,615,169,260
root_title"STONEm Client Update: Developing an Industry Standard Workflow."
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id76,507,006
net_rshares0
@steemitboard ·
Congratulations @creatrixity! You have completed the following achievement on the Steem blockchain and have been rewarded with new badge(s) :

<table><tr><td>https://steemitimages.com/60x70/http://steemitboard.com/@creatrixity/votes.png?201812181421</td><td>You made more than 10000 upvotes. Your next target is to reach 11000 upvotes.</td></tr>
</table>

<sub>_[Click here to view your Board of Honor](https://steemitboard.com/@creatrixity)_</sub>
<sub>_If you no longer want to receive notifications, reply to this comment with the word_ `STOP`</sub>



> Support [SteemitBoard's project](https://steemit.com/@steemitboard)! **[Vote for its witness](https://v2.steemconnect.com/sign/account-witness-vote?witness=steemitboard&approve=1)** and **get one more award**!
properties (22)
authorsteemitboard
permlinksteemitboard-notify-creatrixity-20181218t144117000z
categoryutopian-io
json_metadata{"image":["https://steemitboard.com/img/notify.png"]}
created2018-12-18 14:41:15
last_update2018-12-18 14:41:15
depth1
children0
last_payout2018-12-25 14:41:15
cashout_time1969-12-31 23:59:59
total_payout_value0.000 HBD
curator_payout_value0.000 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length767
author_reputation38,975,615,169,260
root_title"STONEm Client Update: Developing an Industry Standard Workflow."
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id77,019,747
net_rshares0
@utopian-io ·
Hey, @creatrixity!

**Thanks for contributing on Utopian**.
We’re already looking forward to your next contribution!

**Get higher incentives and support Utopian.io!**
 Simply set @utopian.pay as a 5% (or higher) payout beneficiary on your contribution post (via [SteemPlus](https://chrome.google.com/webstore/detail/steemplus/mjbkjgcplmaneajhcbegoffkedeankaj?hl=en) or [Steeditor](https://steeditor.app)).

**Want to chat? Join us on Discord https://discord.gg/h52nFrV.**

<a href='https://steemconnect.com/sign/account-witness-vote?witness=utopian-io&approve=1'>Vote for Utopian Witness!</a>
properties (22)
authorutopian-io
permlinkre-stonem-client-update-developing-an-industry-standard-workflow-20181208t184349z
categoryutopian-io
json_metadata"{"app": "beem/0.20.9"}"
created2018-12-08 18:43:51
last_update2018-12-08 18:43:51
depth1
children0
last_payout2018-12-15 18:43:51
cashout_time1969-12-31 23:59:59
total_payout_value0.000 HBD
curator_payout_value0.000 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length593
author_reputation152,955,367,999,756
root_title"STONEm Client Update: Developing an Industry Standard Workflow."
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id76,555,381
net_rshares0