Skip to content
Merged
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
5 changes: 5 additions & 0 deletions .changeset/gold-chairs-pull.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@ciscode/logging-kit": patch
---

First release of @ciscode/loggingKit
28 changes: 16 additions & 12 deletions .github/workflows/ci .yml → .github/workflows/pr-validation.yml
Original file line number Diff line number Diff line change
@@ -1,37 +1,41 @@
name: CI
name: CI - PR Validation

on:
pull_request:
branches: [master, develop]
push:
branches: [develop]
workflow_dispatch:

permissions:
contents: read

jobs:
ci:
validate:
name: CI - PR Validation
runs-on: ubuntu-latest

steps:
- name: Checkout
uses: actions/checkout@v4

- name: Use Node.js
- name: Setup Node
uses: actions/setup-node@v4
with:
node-version: 22
node-version: 20
cache: npm
registry-url: https://registry.npmjs.org/

- name: Install dependencies
- name: Install
run: npm ci

- name: Format (check)
run: npm run format

- name: Lint
run: npm run lint --if-present
run: npm run lint

- name: Typecheck
run: npm run typecheck

- name: Test
run: npm test --if-present
run: npm test

- name: Build
run: npm run build --if-present
run: npm run build
41 changes: 26 additions & 15 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -1,33 +1,44 @@
name: Publish to npm
name: Publish to NPM

on:
push:
branches:
- master
tags:
- "v*.*.*"
workflow_dispatch:

permissions:
contents: read
id-token: write

jobs:
publish:
runs-on: ubuntu-latest

permissions:
contents: read
packages: write

steps:
- uses: actions/checkout@v4
- name: Checkout code
uses: actions/checkout@v4

- uses: actions/setup-node@v4
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: 22
registry-url: https://registry.npmjs.org/
cache: npm
node-version: "20"
registry-url: "https://registry.npmjs.org"

- name: Install dependencies
run: npm ci
- name: Build library

- name: Run lint (if present)
run: npm run lint --if-present
continue-on-error: false

- name: Run tests (if present)
run: npm test --if-present
continue-on-error: false

- name: Build package
run: npm run build
- name: Publish to npm
run: npm publish --access public --provenance

- name: Publish to NPM
run: npm publish --access public
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
83 changes: 83 additions & 0 deletions .github/workflows/release-check.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
name: CI - Release Check

on:
pull_request:
branches: [master]
workflow_dispatch:
inputs:
sonar:
description: "Run SonarCloud analysis"
required: true
default: "false"
type: choice
options:
- "false"
- "true"

concurrency:
group: ci-release-${{ github.ref }}
cancel-in-progress: true

jobs:
ci:
name: release checks
runs-on: ubuntu-latest
timeout-minutes: 25

# Config stays in the workflow file (token stays in repo secrets)
env:
SONAR_HOST_URL: "https://sonarcloud.io"
SONAR_ORGANIZATION: "ciscode"
SONAR_PROJECT_KEY: "CISCODE-MA_LoggingKit"

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

- name: Setup Node
uses: actions/setup-node@v4
with:
node-version: "22"
cache: "npm"

- name: Install
run: npm ci

- name: Format
run: npm run format

- name: Typecheck
run: npm run typecheck

- name: Lint
run: npm run lint

- name: Test (with coverage)
run: npm run test:cov

- name: Build
run: npm run build

- name: SonarCloud Scan
if: ${{ github.event_name == 'workflow_dispatch' && github.event.inputs.sonar == 'true' }}
uses: SonarSource/sonarqube-scan-action@v6
env:
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
SONAR_HOST_URL: ${{ env.SONAR_HOST_URL }}
with:
args: >
-Dsonar.organization=${{ env.SONAR_ORGANIZATION }} \
-Dsonar.projectKey=${{ env.SONAR_PROJECT_KEY }} \
-Dsonar.sources=src \
-Dsonar.tests=test \
-Dsonar.javascript.lcov.reportPaths=coverage/lcov.info

- name: SonarCloud Quality Gate
if: ${{ github.event_name == 'workflow_dispatch' && github.event.inputs.sonar == 'true' }}
uses: SonarSource/sonarqube-quality-gate-action@v1
timeout-minutes: 10
env:
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
SONAR_HOST_URL: ${{ env.SONAR_HOST_URL }}
20 changes: 20 additions & 0 deletions vitest.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
import { defineConfig } from "vitest/config";

export default defineConfig({
test: {
environment: "node",
coverage: {
enabled: true,
reporter: ["text", "html", "lcov"],
exclude: ["**/node_modules/**", "**/dist/**", "**/test/**"],
threshold: {
lines: 80,
functions: 80,
branches: 80,
statements: 80,
},
},
globals: true,
watch: false,
},
});