Skip to content

Commit

Permalink
Update CI
Browse files Browse the repository at this point in the history
* limit on main pushes
* update actions
* drop coveralls parallel
  • Loading branch information
XhmikosR committed Mar 26, 2024
1 parent a8ab720 commit 5704bf2
Show file tree
Hide file tree
Showing 3 changed files with 63 additions and 37 deletions.
36 changes: 36 additions & 0 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
name: Lint

on:
push:
branches:
- main
- "!dependabot/**"
pull_request:
workflow_dispatch:

env:
FORCE_COLOR: 2
NODE: 20 # The Node.js version to run lint on

jobs:
run:
name: Lint
runs-on: ubuntu-latest

steps:
- name: Clone repository
uses: actions/checkout@v4
with:
persist-credentials: false

- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: ${{ env.NODE }}
cache: npm

- name: Install npm dependencies
run: npm ci

- name: Run lint
run: npm run lint
60 changes: 24 additions & 36 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -1,61 +1,49 @@
name: Tests
on: [push, pull_request]

on:
push:
branches:
- main
- "!dependabot/**"
pull_request:
workflow_dispatch:

env:
CI: true
FORCE_COLOR: 2
NODE_COV: 20 # The Node.js version to run coveralls on

jobs:
run:
test:
name: Node ${{ matrix.node }} on ${{ matrix.os }}
runs-on: ${{ matrix.os }}

strategy:
fail-fast: false
matrix:
node: [18,20]
node: [18, 20]
os: [ubuntu-latest, windows-latest]

steps:
- name: Clone repository
uses: actions/checkout@v2
uses: actions/checkout@v4
with:
persist-credentials: false

- name: Set up Node.js
uses: actions/setup-node@v1
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node }}

- run: node --version
- run: npm --version

- name: Set up npm cache
uses: actions/cache@v2
with:
path: ~/.npm
key: ${{ runner.os }}-node-v${{ matrix.node }}-${{ hashFiles('package.json') }}-${{ hashFiles('package-lock.json') }}
restore-keys: |
${{ runner.OS }}-node-v${{ matrix.node }}-${{ hashFiles('package.json') }}-${{ hashFiles('package-lock.json') }}
${{ runner.OS }}-node-v${{ matrix.node }}-
architecture: ${{ matrix.architecture }}
cache: npm

- name: Install npm dependencies
run: npm ci

- name: Run tests
run: npm test
run: npm run jest

- name: Coveralls Parallel
uses: coverallsapp/github-action@master
env:
NODE_COVERALLS_DEBUG: 1
- name: Run Coveralls
uses: coverallsapp/github-action@v2
if: startsWith(matrix.os, 'ubuntu') && matrix.node == env.NODE_COV
with:
github-token: ${{ secrets.github_token }}
flag-name: run-${{ matrix.os }}-${{ matrix.node }}
parallel: true

finish:
needs: run
runs-on: ubuntu-latest
steps:
- name: Coveralls Finished
uses: coverallsapp/github-action@master
with:
github-token: ${{ secrets.github_token }}
parallel-finished: true
github-token: "${{ secrets.GITHUB_TOKEN }}"
4 changes: 3 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,9 @@
"type": "module",
"scripts": {
"jest": "cross-env NODE_OPTIONS=--experimental-vm-modules jest --coverage --runInBand --detectOpenHandles",
"xo": "xo --fix",
"lint": "xo",
"xo": "xo",
"fix": "xo --fix",
"test": "npm run xo && npm run jest"
},
"files": [
Expand Down

0 comments on commit 5704bf2

Please sign in to comment.