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

Add CI #1

Merged
merged 3 commits into from
Nov 9, 2023
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
22 changes: 22 additions & 0 deletions .github/actions/package-install/action.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
name: 📥 Install Package
description: Install Node.js, NPM, and the package's NPM dependencies, and cache it.

runs:
using: composite
steps:
- name: Install Node.js
uses: actions/setup-node@v4
with:
node-version: "latest"
cache: "npm"

- name: Output versions
shell: bash
run: |
echo Node and NPM versions
node --version
npm --version

- name: Install NPM dependencies
shell: bash
run: npm install
20 changes: 20 additions & 0 deletions .github/workflows/_build-lint.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
name: ⚒️ Build - 🧹 Lint

on: workflow_call

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

- name: 📥 Install
uses: ./.github/actions/package-install

- name: Build
run: npm run build

- name: Lint
run: npm run lint
17 changes: 17 additions & 0 deletions .github/workflows/_docs.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
name: 📙 Documentation

on: workflow_call

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

- name: 📥 Install
uses: ./.github/actions/package-install

- name: Biuld documentation
run: npm run doc
37 changes: 37 additions & 0 deletions .github/workflows/_tests.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
name: 📝 Tests

on: workflow_call

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

- name: 📥 Install
uses: ./.github/actions/package-install

- name: Run tests
run: npm run testci
env:
JEST_JUNIT_OUTPUT_DIR: coverage/reports
JEST_JUNIT_OUTPUT_NAME: jest-junit.xml
JEST_JUNIT_ANCESTOR_SEPARATOR: " > "
JEST_JUNIT_UNIQUE_OUTPUT_NAME: false
JEST_JUNIT_SUITE_NAME: "{filepath}"
JEST_JUNIT_CLASSNAME: "{classname}"
JEST_JUNIT_TITLE: "{title}"

- name: Report test results
if: success() || failure()
uses: dorny/test-reporter@v1
with:
name: Jest Tests Report
path: coverage/reports/jest-*.xml
reporter: jest-junit
list-suites: failed
list-tests: failed
fail-on-error: false
token: ${{ github.token }}
29 changes: 29 additions & 0 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
name: ⚙️ CI

on:
pull_request:
push:
branches:
- main

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

permissions:
contents: read
actions: read
checks: write

jobs:
call-build-lint:
name: ⚒️ Build - 🧹 Lint
uses: ./.github/workflows/_build-lint.yaml

call-tests:
name: 📝 Tests
uses: ./.github/workflows/_tests.yaml

call-docs:
name: 📙 Documentation
uses: ./.github/workflows/_docs.yaml
1 change: 1 addition & 0 deletions .npmignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# config
.github/
.clang-format
.editorconfig
.eslintrc.json
Expand Down
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
vcard-io
========

[![License: MIT](https://img.shields.io/github/license/remileduc/vcards-io)](./LICENSE)
[![⚙️ CI Status](https://github.com/remileduc/vcards-io/actions/workflows/ci.yaml/badge.svg?branch=main)](https://github.com/remileduc/vcards-io/actions/workflows/ci.yaml?query=branch%3Amain)

vCard reader and writer - represents a vCard as a JSON object that can be exported
43 changes: 43 additions & 0 deletions package-lock.json

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

76 changes: 39 additions & 37 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,39 +1,41 @@
{
"name": "vcards-io",
"version": "0.1.0",
"description": "vCard reader and writer - represents a vCard as a JSON object that can be exported",
"type": "module",
"main": "dist/index.js",
"types": "dist/index.d.ts",
"scripts": {
"prepublish": "npm run build",
"build": "tsc",
"clean": "tsc --build --clean",
"test": "jest",
"lint": "eslint lib/",
"doc": "typedoc --plugin @mxssfd/typedoc-theme --theme my-theme --cleanOutputDir --includeVersion --readme ./README.md --out ./docs/ ./lib/index.ts"
},
"keywords": [
"vCard",
"vCards",
"vcf",
"contacts"
],
"author": {
"name": "Rémi Ducceschi",
"url": "https://github.com/remileduc",
"email": "[email protected]"
},
"license": "MIT",
"devDependencies": {
"@mxssfd/typedoc-theme": "^1.1.3",
"@types/jest": "^29.5.7",
"@typescript-eslint/eslint-plugin": "^6.10.0",
"@typescript-eslint/parser": "^6.10.0",
"eslint": "^8.53.0",
"jest": "^29.7.0",
"ts-jest": "^29.1.1",
"typedoc": "^0.25.3",
"typescript": "^5.2.2"
}
"name": "vcards-io",
"version": "0.1.0",
"description": "vCard reader and writer - represents a vCard as a JSON object that can be exported",
"type": "module",
"main": "dist/index.js",
"types": "dist/index.d.ts",
"scripts": {
"prepublish": "npm run build",
"build": "tsc",
"clean": "tsc --build --clean",
"test": "jest",
"testci": "jest --ci --testResultsProcessor='jest-junit'",
"lint": "eslint lib/",
"doc": "typedoc --plugin @mxssfd/typedoc-theme --theme my-theme --cleanOutputDir --includeVersion --readme ./README.md --out ./docs/ ./lib/index.ts"
},
"keywords": [
"vCard",
"vCards",
"vcf",
"contacts"
],
"author": {
"name": "Rémi Ducceschi",
"url": "https://github.com/remileduc",
"email": "[email protected]"
},
"license": "MIT",
"devDependencies": {
"@mxssfd/typedoc-theme": "^1.1.3",
"@types/jest": "^29.5.7",
"@typescript-eslint/eslint-plugin": "^6.10.0",
"@typescript-eslint/parser": "^6.10.0",
"eslint": "^8.53.0",
"jest": "^29.7.0",
"jest-junit": "^16.0.0",
"ts-jest": "^29.1.1",
"typedoc": "^0.25.3",
"typescript": "^5.2.2"
}
}
Loading