Skip to content

Commit

Permalink
Merge pull request #4 from uglow/upgrade/ghactions+node+12
Browse files Browse the repository at this point in the history
chore(ci): add support for github actions
  • Loading branch information
uglow authored Jul 5, 2021
2 parents 2aba1e9 + 1b49523 commit d5f7a1e
Show file tree
Hide file tree
Showing 11 changed files with 11,069 additions and 202 deletions.
69 changes: 52 additions & 17 deletions .github/workflows/npm-publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,31 +4,66 @@
name: Node.js Package

on:
release:
types: [created]
pull_request:
push:
branches: [ master ]

jobs:
build:
test:
runs-on: ubuntu-latest
strategy:
matrix:
# Run the steps below with the following versions of Node.js
node-version: [ 14.x, 16.x ]
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v2
with:
node-version: ${{ matrix.node-version }}
- name: Install
run: npm ci
- name: Test
run: npm run test:coverage
- name: Lint
run: npm run lint
- name: Coveralls
uses: coverallsapp/github-action@master
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
path-to-lcov: ./reports/coverage/lcov.info
parallel: true

test-finished:
needs: [ test ]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v2
- name: Coveralls Finished
uses: coverallsapp/github-action@master
with:
node-version: 14
- run: npm ci
- run: npm test
github-token: ${{ secrets.github_token }}
parallel-finished: true

publish-npm:
needs: build
release:
# Only release on push to master
if: github.event_name == 'push' && github.ref == 'refs/heads/master'
runs-on: ubuntu-latest
# Waits for test jobs for each Node.js version to complete
needs: [ test ]
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v2
- name: Checkout
uses: actions/checkout@v2

- name: Setup Node.js
uses: actions/setup-node@v2
with:
node-version: 14
registry-url: https://registry.npmjs.org/
- run: npm ci
- run: npm publish
node-version: 14.x
- name: Install
run: npm ci
- name: Release
run: npx semantic-release
env:
NODE_AUTH_TOKEN: ${{secrets.npm_token}}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}

2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
.nyc_output/
node_modules/

dist/
reports/
/.semverDetails
1 change: 1 addition & 0 deletions .npmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
save-exact=true
31 changes: 0 additions & 31 deletions .travis.yml

This file was deleted.

74 changes: 1 addition & 73 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -1,12 +1,8 @@
<!--[CN_HEADING]-->
# Contributing

Welcome! This document explains how you can contribute to making **devlog** even better.


<!--[]-->

<!--[CN_GETTING_STARTED]-->
# Getting Started

## Installation
Expand All @@ -19,9 +15,7 @@ npm install
```


<!--[]-->

<!--[RM_DIR_STRUCTURE]-->
## Directory Structure

Code is organised into modules which contain one-or-more components. This a great way to ensure maintainable code by encapsulation of behavior logic. A component is basically a self contained app usually in a single file or a folder with each concern as a file: style, template, specs, e2e, and component class. Here's how it looks:
Expand All @@ -44,9 +38,6 @@ devlog/
```


<!--[]-->

<!--[CN_GITFLOW_PROCESS]-->
# GitFlow Development Process

This project uses the [GitHub Flow](https://guides.github.com/introduction/flow/index.html) workflow.
Expand Down Expand Up @@ -101,9 +92,6 @@ Once merged, Pull Requests preserve a record of the historical changes to your c
By incorporating certain keywords into the text of your Pull Request, you can associate issues with code. When your Pull Request is merged, the related issues are also closed. For example, entering the phrase Closes #32 would close issue number 32 in the repository. For more information, check out our help article.


<!--[]-->

<!--[CN_BUILD_TASKS]-->
## Build Tasks

Command | Description
Expand All @@ -113,10 +101,6 @@ Command | Description
<pre>npm start</pre> | Alias for `npm run dev` task



<!--[]-->

<!--[CN_TEST_TASKS]-->
## Test Tasks

Command | Description
Expand All @@ -127,25 +111,17 @@ Command | Description
<pre>npm run test:unit:once</pre> | Run unit tests once<ul><li>Uses Mocha</li><li>Code coverage</li></ul>



<!--[]-->

<!--[CN_VERIFY_TASKS]-->
## Verification (Linting) Tasks

Command | Description
:------ | :----------
<pre>npm run verify</pre> | Verify code style and syntax<ul><li>Verifies source *and test code* aginst customisable rules (unlike Webpack loaders)</li></ul>
<pre>npm run lint</pre> | Verify code style and syntax<ul><li>Verifies source *and test code* aginst customisable rules (unlike Webpack loaders)</li></ul>
<pre>npm run verify:js</pre> | Verify Javascript code style and syntax
<pre>npm run verify:js:fix</pre> | Verify Javascript code style and syntax and fix any errors that can be fixed automatically
<pre>npm run verify:js:watch</pre> | Verify Javascript code style and syntax and watch files for changes
<pre>npm run verify:watch</pre> | Runs verify task whenever JS or CSS code is changed



<!--[]-->

<!--[CN_COMMIT_TASKS]-->
## Commit Tasks

Command | Description
Expand All @@ -157,53 +133,5 @@ Command | Description
<pre>git push</pre> | Push local repository changes to remote repository


<!--[]-->

<!--[CN_DOCUMENTATION_TASKS]-->



<!--[]-->

<!--[CN_RELEASE_TASKS]-->
## Release Tasks

Command | Description
:------ | :----------
<pre>npm run pre-release</pre> | Verify code, run unit tests, check test coverage, build software. This task is designed to be run before
the `semantic-release` task.
<ul><li>Run `semantic-release-cli setup` once you have a remote repository. See https://github.com/semantic-release/cli for details.</li><li>Semantic-release integrates with Travis CI (or similar tools) to generate release notes
for each release (which appears in the "Releases" section in GitHub) and
publishes the package to NPM (when all the tests are successful) with a semantic version number.
</li></ul>
<pre>npm run upload-coverage</pre> | Uploads code-coverage metrics to Coveralls.io<ul><li>Setup - https://coveralls.zendesk.com/hc/en-us/articles/201347419-Coveralls-currently-supports</li><li>Define an environment variable called COVERALLS_REPO_TOKEN in your build environment with the repo token from https://coveralls.io/github/<repo-name>/settings</li></ul>



<!--[]-->


<!--[CN_CHANGING_BUILD_TOOL_CONFIG]-->
## Changing build-tool configuration

There are 3 ways you can change the build-tool configuration for this project:

1. BEST: Modify the Confit configuration file ([confit.yml](confit.yml)) by hand, then re-run `yo confit` and tell it to use the existing configuration.
1. OK: Re-run `yo confit` and provide new answers to the questions. **Confit will attempt to overwrite your existing configuration (it will prompt for confirmation), so make sure you have committed your code to a source control (e.g. git) first**.
There are certain configuration settings which can **only** be specified by hand, in which case the first approach is still best.
1. RISKY: Modify the generated build-tool config by hand. Be aware that if you re-run `yo confit` it will attempt to overwrite your changes. So commit your changes to source control first.

Additionally, the **currently-generated** configuration can be extended in the following ways:

- The task configuration is defined in [package.json](package.json). It is possible to change the task definitions to add your own sub-tasks.
You can also use the `pre...` and `post...` script-name prefixes to run commands before (pre) and after (post) the generated commands.

- The `entryPoint.entryPoints` string in [confit.yml](confit.yml) is designed to be edited manually. It represents the starting-point(s) of the application (like a `main()` function). A NodeJS application has one entry point. E.g. `src/index.js`




<!--[]-->



20 changes: 0 additions & 20 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,30 +1,18 @@
<!--[RM_HEADING]-->
# devlog

<!--[]-->
<!--[RM_DESCRIPTION]-->
> A command line logging tool for recording thoughts/ideas/anything as a software developer (or anyone else who wants to write notes from the command line)
<!--[]-->

<!--[RM_BADGES]-->
[![NPM Version](https://img.shields.io/npm/v/devlog.svg?style=flat-square)](http://npm.im/devlog)
[![semantic-release](https://img.shields.io/badge/%20%20%F0%9F%93%A6%F0%9F%9A%80-semantic--release-e10079.svg)](https://github.com/semantic-release/semantic-release)
[![Coverage Status](https://coveralls.io/repos/github/uglow/devlog/badge.svg?branch=master)](https://coveralls.io/github/uglow/devlog?branch=master)
[![Dependencies status](https://david-dm.org/uglow/devlog/status.svg?theme=shields.io)](https://david-dm.org/uglow/devlog#info=dependencies)
[![Dev-dependencies status](https://david-dm.org/uglow/devlog/dev-status.svg?theme=shields.io)](https://david-dm.org/uglow/devlog#info=devDependencies)


<!--[]-->

<!--[RM_INSTALL]-->
## Install

npm install -g devlog


<!--[]-->

## Usage

```
Expand All @@ -50,19 +38,11 @@ Log saved to /users/dknuth/devlog/devlog.md
```

<!--[RM_CONTRIBUTING]-->
## Contributing

See [CONTRIBUTING.md](CONTRIBUTING.md).


<!--[]-->


<!--[RM_LICENSE]-->
## License

This software is licensed under the MIT Licence. See [LICENSE](LICENSE).

<!--[]-->

9 changes: 9 additions & 0 deletions TODO.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
TODO


- Do Blog site upgrade next

- Come back to this repo and upgrade code to ES6 module format
- Use Jest if possible
- get code coverage working

48 changes: 0 additions & 48 deletions confit.yml

This file was deleted.

Loading

0 comments on commit d5f7a1e

Please sign in to comment.