Skip to content

Commit

Permalink
chore: refactor CI actions (#195)
Browse files Browse the repository at this point in the history
* chore: remove obsolete travis config

* chore: refactor ci workflow

---------

Co-authored-by: Olaf Ennen <[email protected]>
  • Loading branch information
yobacca and olaf-ennen authored Aug 30, 2024
1 parent e0aeae0 commit dd89c9e
Show file tree
Hide file tree
Showing 6 changed files with 74 additions and 105 deletions.
67 changes: 67 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
name: CI

on:
push:
branches: ['main']
pull_request:
branches: ['main']

env:
PRIMARY_NODE_VERSION: 20

jobs:
lint:
name: Lint
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 1
- name: Install Node.js
uses: actions/setup-node@v4
with:
node-version: ${{ env.PRIMARY_NODE_VERSION }}
cache: yarn
- name: Install dependencies
run: yarn install --frozen-lockfile
- name: Run check
run: yarn lint
- name: Run typecheck
run: yarn typecheck

test:
name: Test
strategy:
matrix:
os: [ubuntu-latest, windows-latest, macOS-latest]
node: [18.x, 20.x, 22.x]

runs-on: ${{ matrix.os }}
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 1
- name: Install Node.js ${{ matrix.node }}
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node }}
cache: yarn
- name: Install dependencies
run: yarn install --frozen-lockfile

# collect coverage on the primary node version
# we don't collect coverage on other node versions so they run faster
- name: Run unit tests with coverage
if: matrix.node == env.PRIMARY_NODE_VERSION && matrix.os == 'ubuntu-latest'
run: yarn test --coverage
- name: Run unit tests
if: matrix.node != env.PRIMARY_NODE_VERSION || matrix.os != 'ubuntu-latest'
run: yarn test
- name: Publish code coverage report
if: matrix.node == env.PRIMARY_NODE_VERSION && matrix.os == 'ubuntu-latest'
uses: codecov/codecov-action@v4
with:
token: ${{ secrets.CODECOV_TOKEN }}
files: coverage/**/lcov.info
42 changes: 0 additions & 42 deletions .github/workflows/linter.yml

This file was deleted.

44 changes: 0 additions & 44 deletions .github/workflows/test.yml

This file was deleted.

13 changes: 0 additions & 13 deletions .travis.yml

This file was deleted.

12 changes: 6 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
# Welcome to 🌲 natural-orderby &middot; [![npm package][npm-badge]][npm] [![build][build-badge]][build]
# Welcome to 🌲 natural-orderby

[npm-badge]: https://img.shields.io/npm/v/natural-orderby.svg?style=flat-square
[npm]: https://www.npmjs.org/package/natural-orderby
[build-badge]: https://img.shields.io/github/workflow/status/yobacca/natural-orderby/test/main?style=flat-square
[build]: https://github.com/yobacca/natural-orderby/actions/workflows/test.yml
Lightweight (< 1.6kB gzipped) and performant natural sorting of arrays and collections by differentiating between unicode characters, numbers, dates, etc.

> Lightweight (< 1.6kB gzipped) and performant natural sorting of arrays and collections by differentiating between unicode characters, numbers, dates, etc.
[![npm version](https://img.shields.io/npm/v/natural-orderby.svg)](https://www.npmjs.com/package/natural-orderby)
[![downloads](https://img.shields.io/npm/dm/natural-orderby.svg)](https://www.npmjs.com/package/natural-orderby)
[![CI](https://github.com/natural-orderby/workflows/CI/badge.svg)](https://github.com/natural-orderby/actions)
[![coverage](https://img.shields.io/codecov/c/github/yobacca/natural-orderby.svg)](https://codecov.io/gh/yobacca/natural-orderby)

People sort strings containing numbers differently than most sorting algorithms, which sort values by comparing strings in Unicode code point order. This produces an ordering that is inconsistent with human logic.

Expand Down
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
"format": "prettier --ignore-path .eslintignore --write src",
"lint": "eslint src",
"test": "cross-env TZ=UTC jest src",
"typecheck": "tsc --noEmit --emitDeclarationOnly false",
"size": "filesize",
"prepublishOnly": "yarn build",
"prepare": "husky"
Expand Down

0 comments on commit dd89c9e

Please sign in to comment.