Skip to content

Commit

Permalink
feat(semantic-release): add semantic release, lint the app and fix np…
Browse files Browse the repository at this point in the history
…m bin not available in npm@9
  • Loading branch information
rolljee committed Aug 7, 2023
1 parent af34321 commit c81cb4a
Show file tree
Hide file tree
Showing 25 changed files with 24,968 additions and 7,738 deletions.
3 changes: 3 additions & 0 deletions .commitlintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"extends": ["@commitlint/config-conventional"]
}
3 changes: 3 additions & 0 deletions .cz.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"path": "./node_modules/cz-conventional-changelog"
}
10 changes: 0 additions & 10 deletions .eslintrc

This file was deleted.

31 changes: 31 additions & 0 deletions .eslintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
{
"plugins": [
"@typescript-eslint"
],
"extends": [
"eslint:recommended",
"plugin:@typescript-eslint/eslint-recommended",
"plugin:@typescript-eslint/recommended",
"oclif",
"oclif-typescript"
],
"rules": {
"@typescript-eslint/ban-ts-comment": 0,
"@typescript-eslint/explicit-module-boundary-types": 0,
"@typescript-eslint/no-explicit-any": 0,
"@typescript-eslint/no-shadow": "error",
"no-empty": [
"error",
{
"allowEmptyCatch": true
}
],
"unicorn/filename-case": "off",
"no-shadow": "off",
"object-curly-spacing": "off",
"comma-dangle": "off",
"camelcase": "off",
"semi": "off",
"indent": "off"
}
}
10 changes: 10 additions & 0 deletions .github/actions/lint/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
name: ESLint
description: Run ESLint
runs:
using: 'composite'
steps:
- name: Install deps
shell: bash
run: |
npm ci
npm run lint
10 changes: 10 additions & 0 deletions .github/actions/unit-test/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
name: Functional Tests
description: Run Functional Tests
runs:
using: 'composite'
steps:
- name: Run functional test
shell: bash
run: |
npm ci
npm run unit-testing
25 changes: 25 additions & 0 deletions .github/workflows/pull_request.workflow.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
name: Pull request checks

on: [pull_request]

jobs:
lint:
name: Lint
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v3
- name: Cache node modules
uses: actions/cache@v2
env:
cache-name: cache-node-modules
with:
path: ~/.npm
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-build-${{ env.cache-name }}-
${{ runner.os }}-build-
${{ runner.os }}-
- uses: actions/setup-node@v3
with:
node-version: "16"
- uses: ./.github/actions/lint
38 changes: 38 additions & 0 deletions .github/workflows/push_branches.workflow.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
name: Push checks

on:
push:
branches:
- master
- beta

jobs:
release:
name: Release process
runs-on: ubuntu-20.04
permissions:
contents: write
issues: write
pull-requests: write
packages: write
steps:
- name: Checkout
uses: actions/checkout@v3

- name: Setup Node.js
uses: actions/setup-node@v3
with:
node-version: "lts/*"
registry-url: "https://registry.npmjs.org"
scope: '@kuzzleio'

- name: Install dependencies
run: npm ci

- name: Release
env:
GITHUB_TOKEN: ${{ secrets.SEMANTIC_RELEASE_GHP }}
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
SEMANTIC_RELEASE_NPM_PUBLISH: "true"
SEMANTIC_RELEASE_SLACK_WEBHOOK: ${{ secrets.SEMANTIC_RELEASE_SLACK_WEBHOOK }}
run: npx semantic-release
6 changes: 6 additions & 0 deletions .husky/commit-msg
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#!/usr/bin/env sh
[ -n "$CI" ] && exit 0

. "$(dirname -- "$0")/_/husky.sh"

npx --no -- commitlint --edit ${1}
6 changes: 6 additions & 0 deletions .husky/pre-commit
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#!/usr/bin/env sh
[ -n "$CI" ] && exit 0

. "$(dirname -- "$0")/_/husky.sh"

npm run lint
7 changes: 7 additions & 0 deletions .releaserc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"extends": ["semantic-release-config-kuzzle"],
"branches": [
"master",
{ "name": "beta", "prerelease": true }
]
}
Loading

0 comments on commit c81cb4a

Please sign in to comment.