Skip to content

Commit

Permalink
chore(ci): use shared GHA workflows
Browse files Browse the repository at this point in the history
  • Loading branch information
msimerson committed May 29, 2022
1 parent 9a9045b commit 0bba113
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 89 deletions.
44 changes: 13 additions & 31 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,54 +1,36 @@

name: CI

on: [ push ]
on:
push:

env:
CI: true
node-version: 16

jobs:
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
name: Node.js ${{ env.node_version }}
with:
node-version: ${{ env.node_version }}
- run: npm install
- run: npm run lint
uses: NicTool/.github/.github/workflows/lint.yml@master

coverage:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Node.js ${{ env.node_version }}
uses: actions/setup-node@v3
with:
node-version: ${{ env.node_version }}
- run: npm install
- run: npx -y c8 --reporter=lcovonly npm run test
env:
NODE_ENV: cov

- uses: codecov/codecov-action@v2
- uses: coverallsapp/github-action@master
with:
github-token: ${{ secrets.github_token }}
uses: NicTool/.github/.github/workflows/coverage.yml@master
secrets: inherit

test:
needs: lint
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ ubuntu-latest, macos-latest, windows-latest ]
os: [ ubuntu-latest, windows-latest, macos-latest ]
node-version: [ 14, 16, 18 ]
fail-fast: false

steps:
- uses: actions/checkout@v3

- uses: actions/setup-node@v3
name: Node.js ${{ matrix.node-version }} on ${{ matrix.os }}
name: Node ${{ matrix.node-version }} on ${{ matrix.os }}
with:
node-version: ${{ matrix.node-version }}

- run: npm install
- run: npm run test

- run: npm test
21 changes: 2 additions & 19 deletions .github/workflows/codeql.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,22 +10,5 @@ on:
- cron: '18 7 * * 4'

jobs:
analyze:
name: Analyze
runs-on: ubuntu-latest
permissions:
actions: read
contents: read
security-events: write

steps:
- uses: actions/checkout@v3
- uses: github/codeql-action/init@v2
with:
languages: javascript

- name: Autobuild
uses: github/codeql-action/autobuild@v2

- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v2
codeql:
uses: NicTool/.github/.github/workflows/codeql.yml@master
44 changes: 5 additions & 39 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -1,50 +1,16 @@

name: publish

on:
push:
branches:
- master
paths:
- package.json

env:
CI: true
node_version: 14

jobs:

publish-npm:
runs-on: ubuntu-latest

steps:
- name: Checkout
uses: actions/checkout@v2
with:
fetch-depth: 0

- name: Setup node.js ${{ env.node_version }}
uses: actions/setup-node@v3
with:
node-version: ${{ env.node_version }}
registry-url: https://registry.npmjs.org/

- run: npm install

- run: npm run test

- run: npm publish --access public
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_AUTH_TOKEN }}

- name: GitHub Release
uses: justincy/github-action-npm-release@2.0.1
id: release

- name: Coverage Run
run: |
npm install --no-save c8 codecov
npx c8 --reporter=lcovonly npm run test
- name: Coveralls
uses: coverallsapp/github-action@master
with:
github-token: ${{ secrets.github_token }}
publish:
uses: NicTool/.github/.github/workflows/publish.yml@master
secrets: inherit

0 comments on commit 0bba113

Please sign in to comment.