Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore(ci): reduce config spread #216

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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"
}
}
16 changes: 10 additions & 6 deletions test/integration/rss-feed-emitter.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,24 +29,28 @@ const feeds = [
},
{
name: 'The Huffington Post',
url: 'http://www.huffingtonpost.com/feeds/index.xml',
url: 'https://chaski.huffpost.com/us/auto/vertical/arts',
},
{
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',
url: 'https://www.milliyet.com.tr/rss/rssnew/gundem.xml',
},
{
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
Loading