Skip to content

Commit

Permalink
chore(ci): reduce config spread
Browse files Browse the repository at this point in the history
  • Loading branch information
TobiTenno committed Feb 13, 2022
1 parent d714b8f commit a035daa
Show file tree
Hide file tree
Showing 11 changed files with 232 additions and 78 deletions.
1 change: 0 additions & 1 deletion .eslintignore

This file was deleted.

32 changes: 0 additions & 32 deletions .eslintrc

This file was deleted.

65 changes: 65 additions & 0 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
name: Actions
on:
pull_request:
branches:
- master

jobs:
lint:
name: Lint
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [16.x]

steps:
- name: Checkout
uses: actions/checkout@v2
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v1
with:
node-version: ${{ matrix.node-version }}
- name: Install Dependencies
run: npm install
- name: Run linters
run: npm run lint
test:
name: Test
runs-on: ubuntu-latest
needs: lint
strategy:
max-parallel: 1
matrix:
node-version: [8.x, 12.x, 14.x, 16.x]
steps:
- uses: actions/checkout@v2
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v1
with:
node-version: ${{ matrix.node-version }}
- run: npm install
- run: npm test
env:
CI: true
parallel: true
coverage:
name: Coverage
runs-on: ubuntu-latest
needs: lint
strategy:
matrix:
node-version: [16.x]
steps:
- uses: actions/checkout@v2
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v1
with:
node-version: ${{ matrix.node-version }}
- run: npm install
- run: npm test
env:
CI: true
- name: Coveralls
uses: coverallsapp/github-action@master
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
85 changes: 85 additions & 0 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
name: Release
on:
push:
branches:
- master

jobs:
lint:
name: Lint
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [16.x]

steps:
- name: Checkout
uses: actions/checkout@v2
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v1
with:
node-version: ${{ matrix.node-version }}
- name: Install Dependencies
run: npm install
- name: Run linters
run: npm run lint
test:
name: Test
runs-on: ubuntu-latest
needs: lint
strategy:
max-parallel: 1
matrix:
node-version: [8.x, 12.x, 14.x, 16.x]
steps:
- uses: actions/checkout@v2
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v1
with:
node-version: ${{ matrix.node-version }}
- run: npm install
- run: npm test
env:
CI: true
parallel: true
coverage:
name: Coverage
runs-on: ubuntu-latest
needs: lint
strategy:
matrix:
node-version: [16.x]
steps:
- uses: actions/checkout@v2
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v1
with:
node-version: ${{ matrix.node-version }}
- run: npm install
- run: npm test
env:
CI: true
- name: Coveralls
uses: coverallsapp/github-action@master
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
release:
name: Release
if: ${{ github.ref == 'refs/heads/master' }}
runs-on: ubuntu-latest
needs: [lint, test, coverage]
strategy:
matrix:
node-version: [16.x]
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Semantic Release
uses: cycjimmy/[email protected]
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
with:
semantic_version: 17
branches: |
['master']
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -29,3 +29,5 @@ node_modules

# Distribution files
dist

.idea/
2 changes: 2 additions & 0 deletions .npmignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,5 @@
.nvmrc
content
test
.idea/
.github/
2 changes: 1 addition & 1 deletion .nvmrc
Original file line number Diff line number Diff line change
@@ -1 +1 @@
6.1.0
lts/gallium
35 changes: 0 additions & 35 deletions .travis.yml

This file was deleted.

67 changes: 65 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,9 @@
"test": "test/**/*.spec.js"
},
"scripts": {
"test": "nyc mocha \"test/**/*.spec.js\" --exit",
"coverage": "npm test && nyc report --reporter=text-lcov | npx coveralls",
"test": "nyc mocha",
"coverage": "npm test && npm run cov:gen | npx coveralls",
"cov:gen": "nyc report --reporter=text-lcov",
"lint": "eslint src/ test/",
"lint:fix": "eslint src/ test/ --fix",
"prepublishOnly": "npm run build:types",
Expand Down Expand Up @@ -52,8 +53,13 @@
"request": "^2.88.2"
},
"nyc": {
"skip-full": true,
"all": true,
"instrument": true,
"reporter": [
"lcov",
"text"
],
"include": [
"src/**/*"
]
Expand All @@ -63,5 +69,62 @@
},
"release": {
"branch": "master"
},
"eslintIgnore": [
"**/*{.,-}min.js"
],
"eslintConfig": {
"extends": "airbnb-base",
"parserOptions": {
"sourceType": "script"
},
"rules": {
"valid-jsdoc": [
"error",
{
"requireReturn": false,
"requireReturnDescription": false,
"preferType": {
"String": "string",
"Number": "number",
"Boolean": "boolean",
"Function": "function",
"object": "Object",
"date": "Date",
"error": "Error"
},
"prefer": {
"return": "returns"
}
}
],
"strict": [
"error",
"safe"
],
"linebreak-style": "off",
"no-restricted-syntax": [
"off"
],
"no-await-in-loop": "off",
"import/no-unresolved": 0,
"no-param-reassign": 0,
"complexity": [
"error",
10
],
"arrow-parens": [
"error",
"always"
]
}
},
"mocha": {
"spec": "test/**/*.spec.js",
"exit": true,
"slow": 1000,
"normal": 400,
"retries": 4,
"reporter": "min"
}
}
12 changes: 8 additions & 4 deletions test/integration/rss-feed-emitter.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,10 @@ const feeds = [
name: 'The New York Times',
url: 'http://rss.nytimes.com/services/xml/rss/nyt/HomePage.xml',
},
{
name: 'Reddit',
url: 'https://www.reddit.com/.rss',
},
// {
// name: 'Reddit',
// url: 'https://www.reddit.com/.rss',
// },
{
name: 'Milliyet Gazetesi',
url: 'http://www.milliyet.com.tr/rss/rssNew/gundemRss.xml',
Expand All @@ -47,6 +47,10 @@ const feeds = [
name: 'CNN',
url: 'http://rss.cnn.com/rss/edition.rss',
},
{
name: 'Warframe PC Updates',
url: 'https://forums.warframe.com/forum/3-pc-update-notes.xml',
},
];


Expand Down
7 changes: 4 additions & 3 deletions test/unit/rss-feed-emitter.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,9 @@ const { expect } = chai;
let feeder;
const defaultUserAgent = 'Node/RssFeedEmitter (https://github.com/filipedeschamps/rss-feed-emitter)';

describe('RssFeedEmitter (unit)', () => {
describe('RssFeedEmitter (unit)', function unit() {
this.retries(8);

beforeEach(() => {
feeder = new RssFeedEmitter();
});
Expand Down Expand Up @@ -813,12 +815,11 @@ describe('RssFeedEmitter (unit)', () => {

const feed = new Feed({ url: 'https://www.nintendolife.com/feeds/latest', refresh: 100 });
let numHandled = 0;
const handler = {
feed.handler = {
handle: () => {
numHandled += 1;
},
};
feed.handler = handler;
await feed.fetchData();
expect(numHandled).to.eq(2);
});
Expand Down

0 comments on commit a035daa

Please sign in to comment.