Skip to content

Commit

Permalink
ci: Update GitHub workflows
Browse files Browse the repository at this point in the history
  • Loading branch information
ardalanamini committed Jun 19, 2021
1 parent 9863b9a commit 8acd3cf
Show file tree
Hide file tree
Showing 5 changed files with 69 additions and 29 deletions.
4 changes: 0 additions & 4 deletions .eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,6 @@
"error",
2
],
"linebreak-style": [
"error",
"unix"
],
"quotes": [
"error",
"double"
Expand Down
57 changes: 44 additions & 13 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,18 +8,32 @@ on:
jobs:
build:
name: Create Release

runs-on: ubuntu-latest

env:
RELEASE: ${{ github.ref }}

steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v1

- name: Use Node.js 14
uses: actions/setup-node@v1
with:
node-version: 14
- run: npm ci
- run: npm run lint
- run: npm run build
- run: npm run test:coverage

- name: Install packages
run: npm ci

- name: Lint
run: npm run lint

- name: Build
run: npm run build

- name: Test
run: npm run test:ci

- name: Upload coverage to Codecov
uses: codecov/codecov-action@v1
with:
Expand Down Expand Up @@ -49,13 +63,21 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v1

- name: Use Node.js 14
uses: actions/setup-node@v1
with:
node-version: 14
registry-url: https://registry.npmjs.org/
- run: npm ci
- run: npm run build
- run: npm publish --access public

- name: Install packages
run: npm ci

- name: Build
run: npm run build

- name: Publish
run: npm publish --access public
env:
NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN}}

Expand All @@ -65,14 +87,23 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v1

- name: Use Node.js 14
uses: actions/setup-node@v1
with:
node-version: 14
registry-url: https://npm.pkg.github.com/
scope: '@foxifyjs'

- run: sed -i 's/@foxify\/events/@foxifyjs\/events/g' package.json package-lock.json
- run: npm ci
- run: npm run build
- run: npm publish

- name: Install packages
run: npm ci

- name: Build
run: npm run build

- name: Publish
run: npm publish
env:
NODE_AUTH_TOKEN: ${{secrets.GITHUB_TOKEN}}
31 changes: 23 additions & 8 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,28 +12,43 @@ on:
jobs:
build:

runs-on: ${{ matrix.os }}

strategy:
matrix:
os: [ macos-latest, windows-latest, ubuntu-latest ]
node-version: [ 14.x ]
# node-version: [ 8.x, 10.x, 12.x, 14.x ]
node-version: [ 14.x, 15.x, 16.x ]

runs-on: ${{ matrix.os }}

env:
OS: ${{ matrix.os }}
NODE_VERSION: ${{ matrix.node-version }}

steps:
- uses: actions/checkout@v2

- name: Setup Cache
uses: actions/cache@v2
with:
path: '**/node_modules'
key: ${{ matrix.os }}-${{ matrix.node-version }}-modules-${{ hashFiles('**/package-lock.json') }}

- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v1
with:
node-version: ${{ matrix.node-version }}
- run: npm ci
- run: npm run lint
- run: npm run build
- run: npm run test:coverage

- name: Install packages
run: npm i

- name: Lint
run: npm run lint

- name: Build
run: npm run build

- name: Test
run: npm run test:ci

- name: Upload coverage to Codecov
uses: codecov/codecov-action@v1
with:
Expand Down
4 changes: 1 addition & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,6 @@
],
"main": "dist/index.js",
"types": "dist/index.d.ts",
"files": [
"dist"
],
"scripts": {
"prepublishOnly": "npm run lint && npm run build && npm test",
"build": "tsc",
Expand All @@ -42,6 +39,7 @@
"lint:fix": "npm run lint -- --fix",
"test": "jest",
"test:coverage": "npm test -- --coverage",
"test:ci": "npm run test:coverage -- --ci",
"benchmarks": "find benchmarks -maxdepth 1 -name '*.js' -exec benchmarks/start.sh {} \\;"
},
"devDependencies": {
Expand Down
2 changes: 1 addition & 1 deletion tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
// "jsx": "preserve", /* Specify JSX code generation: 'preserve', 'react-native', or 'react'. */
"declaration": true, /* Generates corresponding '.d.ts' file. */
// "declarationMap": true, /* Generates a sourcemap for each corresponding '.d.ts' file. */
// "sourceMap": true, /* Generates corresponding '.map' file. */
"sourceMap": true, /* Generates corresponding '.map' file. */
// "outFile": "./", /* Concatenate and emit output to single file. */
"outDir": "dist", /* Redirect output structure to the directory. */
"rootDir": "src", /* Specify the root directory of input files. Use to control the output directory structure with --outDir. */
Expand Down

0 comments on commit 8acd3cf

Please sign in to comment.