Skip to content

Commit

Permalink
chore: fix os workflow matrix (#59)
Browse files Browse the repository at this point in the history
  • Loading branch information
wkillerud authored Jul 12, 2024
1 parent 9149e4e commit 15ec8ea
Show file tree
Hide file tree
Showing 11 changed files with 144 additions and 130 deletions.
2 changes: 0 additions & 2 deletions .eslintignore

This file was deleted.

10 changes: 0 additions & 10 deletions .eslintrc

This file was deleted.

1 change: 1 addition & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
* text=auto eol=lf
64 changes: 32 additions & 32 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -1,42 +1,42 @@
name: Release on main

permissions:
contents: write # to be able to publish a GitHub release
issues: write # to be able to comment on released issues
pull-requests: write # to be able to comment on released pull requests
id-token: write # to enable use of OIDC for npm provenance
contents: write # to be able to publish a GitHub release
issues: write # to be able to comment on released issues
pull-requests: write # to be able to comment on released pull requests
id-token: write # to enable use of OIDC for npm provenance

on:
push:
branches:
- main
push:
branches:
- main

# Cancel previous workflows which might still be running
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: ${{ github.ref != 'refs/heads/main' }}
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: ${{ github.ref != 'refs/heads/main' }}

jobs:
release:
name: Release
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Install Node.js
uses: actions/setup-node@v4
with:
node-version: 20

- name: Install dependencies
run: npm install

- name: Run all tests
run: npm test

- name: Release and publish
run: npx semantic-release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
release:
name: Release
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Install Node.js
uses: actions/setup-node@v4
with:
node-version: 20

- name: Install dependencies
run: npm install

- name: Run all tests
run: npm test

- name: Release and publish
run: npx semantic-release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
41 changes: 21 additions & 20 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -1,29 +1,30 @@
name: Run Lint and Tests

on:
pull_request:
branches: [main]
pull_request:
branches: [main]

jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
os: [ubuntu-latest, macOS-latest, windows-latest]
node-version: [18.x, 20.x]
steps:
- uses: actions/checkout@v4
build:
strategy:
matrix:
os: [ubuntu-latest, macOS-latest, windows-latest]
node-version: [18, 20]
runs-on: ${{ matrix.os }}

- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
steps:
- uses: actions/checkout@v4

- name: Install dependencies
run: npm install
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}

- name: Lint
run: npm run lint
- name: Install dependencies
run: npm install

- name: Run tests
run: npm test
- name: Lint
run: npm run lint

- name: Run tests
run: npm test
1 change: 1 addition & 0 deletions .npmrc
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
package-lock=false
save-exact=true
15 changes: 0 additions & 15 deletions .prettierrc

This file was deleted.

15 changes: 15 additions & 0 deletions .prettierrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
"singleQuote": false,
"trailingComma": "all",
"useTabs": true,
"printWidth": 120,
"overrides": [
{
"files": ["*.yml", "*.json"],
"options": {
"tabWidth": 2,
"useTabs": false
}
}
]
}
22 changes: 22 additions & 0 deletions eslint.config.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
import prettierConfig from "eslint-config-prettier";
import prettierPlugin from "eslint-plugin-prettier/recommended";
import globals from "globals";
import js from "@eslint/js";

export default [
js.configs.recommended,
prettierConfig,
prettierPlugin,
{
languageOptions: {
globals: {
...globals.node,
...globals.browser,
global: true,
},
},
},
{
ignores: ["coverage/*", "dist/*"],
},
];
2 changes: 1 addition & 1 deletion lib/guard.js
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ const MetricsGuard = class MetricsGuard extends stream.Transform {
[push](metric) {
const met = metric;
met.source = this.id;
// eslint-disable-next-line no-underscore-dangle

if (this._readableState.flowing) {
this.push(met);
return;
Expand Down
101 changes: 51 additions & 50 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,52 +1,53 @@
{
"name": "@metrics/guard",
"version": "1.0.2",
"description": "Module to guard against excessive metric permutation creation in a metric stream",
"main": "lib/guard.js",
"types": "guard.d.ts",
"files": [
"lib",
"guard.d.ts"
],
"scripts": {
"bench": "node benchmark/benchmark.js",
"test": "tap test/*.js --disable-coverage --allow-empty-coverage",
"test:coverage": "tap test/*.js",
"lint": "eslint .",
"lint:fix": "eslint . --fix"
},
"author": "Trygve Lie <[email protected]>",
"license": "MIT",
"keywords": [
"server-statistics",
"server-stats",
"statistics",
"metrics",
"monitoring",
"guard"
],
"dependencies": {
"readable-stream": "^3.4.0"
},
"devDependencies": {
"@metrics/client": "2.5.2",
"@metrics/metric": "2.3.3",
"@semantic-release/changelog": "6.0.3",
"@semantic-release/commit-analyzer": "11.1.0",
"@semantic-release/git": "10.0.1",
"@semantic-release/github": "9.2.6",
"@semantic-release/npm": "11.0.3",
"@semantic-release/release-notes-generator": "12.1.0",
"eslint": "8.57.0",
"eslint-config-prettier": "9.1.0",
"eslint-plugin-prettier": "5.1.3",
"fastbench": "1.0.1",
"prettier": "3.3.0",
"semantic-release": "23.0.2",
"tap": "18.7.1"
},
"repository": {
"type": "git",
"url": "https://github.com/metrics-js/client.git"
}
"name": "@metrics/guard",
"version": "1.0.2",
"description": "Module to guard against excessive metric permutation creation in a metric stream",
"main": "lib/guard.js",
"types": "guard.d.ts",
"files": [
"lib",
"guard.d.ts"
],
"scripts": {
"bench": "node benchmark/benchmark.js",
"test": "tap test/*.js --disable-coverage --allow-empty-coverage",
"test:coverage": "tap test/*.js",
"lint": "eslint .",
"lint:fix": "eslint . --fix"
},
"author": "Trygve Lie <[email protected]>",
"license": "MIT",
"keywords": [
"server-statistics",
"server-stats",
"statistics",
"metrics",
"monitoring",
"guard"
],
"dependencies": {
"readable-stream": "^3.4.0"
},
"devDependencies": {
"@metrics/client": "2.5.2",
"@metrics/metric": "2.3.3",
"@semantic-release/changelog": "6.0.3",
"@semantic-release/commit-analyzer": "11.1.0",
"@semantic-release/git": "10.0.1",
"@semantic-release/github": "9.2.6",
"@semantic-release/npm": "11.0.3",
"@semantic-release/release-notes-generator": "12.1.0",
"eslint": "9.6.0",
"eslint-config-prettier": "9.1.0",
"eslint-plugin-prettier": "5.1.3",
"fastbench": "1.0.1",
"globals": "15.8.0",
"prettier": "3.3.0",
"semantic-release": "23.0.2",
"tap": "18.7.1"
},
"repository": {
"type": "git",
"url": "https://github.com/metrics-js/client.git"
}
}

0 comments on commit 15ec8ea

Please sign in to comment.