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

test: add GHA testing, nuke Travis #232

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
84 changes: 84 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
name: CI

on:
push:
pull_request:

env:
CI: true

jobs:
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/setup-node@v4
- uses: actions/checkout@v4
- run: npm install
- run: npm install eslint@^8
- run: npm run lint

coverage:
if: false
runs-on: ubuntu-latest
steps:
- uses: actions/setup-node@v4
- uses: actions/checkout@v4
- run: npm install
- name: run coverage
run: |
npm install --no-save c8
npx c8 --reporter=lcov npm test
env:
NODE_ENV: cov

- name: codecov
uses: codecov/codecov-action@v4

- name: Coveralls
uses: coverallsapp/github-action@master
with:
github-token: ${{ secrets.github_token }}

ubuntu:
needs: [get-lts]
runs-on: ubuntu-latest
strategy:
matrix:
node: ${{ fromJson(needs.get-lts.outputs.active) }}
include:
- node: 10
fail-fast: false
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
name: Node ${{ matrix.node }} on ubuntu-latest
with:
node-version: ${{ matrix.node }}
- run: npm install
- run: npm run test

windows:
needs: [lint, get-lts]
runs-on: windows-latest
strategy:
matrix:
node: ${{ fromJson(needs.get-lts.outputs.active) }}
fail-fast: false
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
name: Node.js ${{ matrix.node }} on windows-latest
with:
node-version: ${{ matrix.node }}
- run: npm install
- run: npm run test

get-lts:
runs-on: ubuntu-latest
steps:
- id: get
uses: msimerson/node-lts-versions@v1
outputs:
active: ${{ steps.get.outputs.active }}
lts: ${{ steps.get.outputs.lts }}
min: ${{ steps.get.outputs.min }}
11 changes: 0 additions & 11 deletions .travis.yml

This file was deleted.

9 changes: 9 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,12 @@

## Unreleased

* ci: replace travis (dead) with Github Actions GHA)
* ci: automatically test on ubuntu & windows
* ci: automatically test on the LTS versions of node.js
* deps: remove mocha & eslint, they get auto-installed by npx when needed
* doc(README): update CI badge URL, remove broken badges

## 1.1.3

* fix LICENSE name
Expand Down
12 changes: 3 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,19 +1,13 @@
# sprintf-js

[![Build Status][travisci-image]][travisci-url] [![NPM Version][npm-image]][npm-url] [![Dependency Status][dependencies-image]][dependencies-url] [![devDependency Status][dev-dependencies-image]][dev-dependencies-url]
[![Build Status][ci-image]][ci-url] [![NPM Version][npm-image]][npm-url]

[travisci-image]: https://travis-ci.org/alexei/sprintf.js.svg?branch=master
[travisci-url]: https://travis-ci.org/alexei/sprintf.js
[ci-image]: https://github.com/alexei/sprintf.js/actions/workflows/ci.yml/badge.svg
[ci-url]: https://github.com/alexei/sprintf.js/actions/workflows/ci.yml

[npm-image]: https://badge.fury.io/js/sprintf-js.svg
[npm-url]: https://badge.fury.io/js/sprintf-js

[dependencies-image]: https://david-dm.org/alexei/sprintf.js.svg
[dependencies-url]: https://david-dm.org/alexei/sprintf.js

[dev-dependencies-image]: https://david-dm.org/alexei/sprintf.js/dev-status.svg
[dev-dependencies-url]: https://david-dm.org/alexei/sprintf.js#info=devDependencies

**sprintf-js** is a complete open source JavaScript `sprintf` implementation for the **browser** and **Node.js**.

**Note: as of v1.1.1 you might need some polyfills for older environments. See [Support](#support) section below.**
Expand Down
4 changes: 1 addition & 3 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 4 additions & 6 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@
"author": "Alexandru Mărășteanu <hello@alexei.ro>",
"main": "src/sprintf.js",
"scripts": {
"test": "mocha test/*.js",
"test": "npx mocha test/*.js",
"pretest": "npm run lint",
"lint": "eslint .",
"lint:fix": "eslint --fix ."
"lint": "npx eslint@^7 .",
"lint:fix": "npx eslint@^7 --fix ."
},
"repository": {
"type": "git",
Expand All @@ -18,16 +18,14 @@
"readmeFilename": "README.md",
"devDependencies": {
"benchmark": "^2.1.4",
"eslint": "^5.10.0",
"gulp": "^3.9.1",
"gulp-benchmark": "^1.1.1",
"gulp-eslint": "^5.0.0",
"gulp-header": "^2.0.5",
"gulp-mocha": "^6.0.0",
"gulp-rename": "^1.4.0",
"gulp-sourcemaps": "^2.6.4",
"gulp-uglify": "^3.0.1",
"mocha": "^5.2.0"
"gulp-uglify": "^3.0.1"
},
"overrides": {
"graceful-fs": "^4.2.11"
Expand Down
1 change: 1 addition & 0 deletions src/sprintf.js
Original file line number Diff line number Diff line change
Expand Up @@ -210,6 +210,7 @@
* export to either browser or node.js
*/
/* eslint-disable quote-props */
/* eslint no-redeclare: [ "warn" ] */
if (typeof exports !== 'undefined') {
exports['sprintf'] = sprintf
exports['vsprintf'] = vsprintf
Expand Down