From cb745ebdd25352dde193ec0fc7b1b81c270853b7 Mon Sep 17 00:00:00 2001 From: Ahmad Nassri Date: Wed, 5 Aug 2020 02:06:42 -0400 Subject: [PATCH] ci(release): new release process --- .codeclimate.yml | 17 ---- .eslintrc | 3 - .github/dependabot.yml | 14 +++ .github/linters/.markdown-lint.yml | 153 +++++++++++++++++++++++++++++ .github/settings.yml | 16 --- .github/workflows/auto-merge.yml | 11 +++ .github/workflows/release.yml | 57 +++++++++++ .github/workflows/super-linter.yml | 14 +++ .github/workflows/test.yml | 43 ++++++++ .releaserc | 35 ++++++- .remarkrc | 5 - circle.yml | 99 ------------------- docker-compose.yml | 44 +++++++++ package.json | 9 +- renovate.json | 5 - 15 files changed, 372 insertions(+), 153 deletions(-) delete mode 100644 .codeclimate.yml delete mode 100644 .eslintrc create mode 100644 .github/dependabot.yml create mode 100644 .github/linters/.markdown-lint.yml delete mode 100644 .github/settings.yml create mode 100644 .github/workflows/auto-merge.yml create mode 100644 .github/workflows/release.yml create mode 100644 .github/workflows/super-linter.yml create mode 100644 .github/workflows/test.yml delete mode 100644 .remarkrc delete mode 100644 circle.yml create mode 100644 docker-compose.yml delete mode 100644 renovate.json diff --git a/.codeclimate.yml b/.codeclimate.yml deleted file mode 100644 index e0b2dd1..0000000 --- a/.codeclimate.yml +++ /dev/null @@ -1,17 +0,0 @@ -engines: - fixme: - enabled: true - - duplication: - enabled: true - config: - languages: - - javascript - - eslint: - enabled: true - -ratings: - paths: - - lib/** - - test/** diff --git a/.eslintrc b/.eslintrc deleted file mode 100644 index 3f226b9..0000000 --- a/.eslintrc +++ /dev/null @@ -1,3 +0,0 @@ -{ - "extends": "@ahmadnassri/eslint-config" -} diff --git a/.github/dependabot.yml b/.github/dependabot.yml new file mode 100644 index 0000000..05d4f94 --- /dev/null +++ b/.github/dependabot.yml @@ -0,0 +1,14 @@ +version: 2 +updates: + - package-ecosystem: github-actions + open-pull-requests-limit: 10 + directory: / + schedule: + interval: daily + + - package-ecosystem: npm + open-pull-requests-limit: 10 + directory: / + schedule: + interval: daily + diff --git a/.github/linters/.markdown-lint.yml b/.github/linters/.markdown-lint.yml new file mode 100644 index 0000000..ec1b5a8 --- /dev/null +++ b/.github/linters/.markdown-lint.yml @@ -0,0 +1,153 @@ +# Heading levels should only increment by one level at a time +MD001: false + +# Heading style +MD003: + style: atx + +# Unordered list style +MD004: + style: dash + +# Inconsistent indentation for list items at the same level +MD005: true + +# Unordered list indentation +MD007: + indent: 2 + start_indented: false + +# Trailing spaces +MD009: + br_spaces: 2 + list_item_empty_lines: false + strict: false + +# Hard tabs +MD010: + code_blocks: false + +# Reversed link syntax +MD011: true + +# Multiple consecutive blank lines +MD012: + maximum: 1 + +# Line length +MD013: + line_length: 180 + strict: true + stern: true + +# Dollar signs used before commands without showing output +MD014: false + +# No space after hash on atx style heading +MD018: true + +# Multiple spaces after hash on atx style heading +MD019: true + +# No space inside hashes on closed atx style heading +MD020: true + +# Multiple spaces inside hashes on closed atx style heading +MD021: true + +# Headings should be surrounded by blank lines +MD022: + lines_above: 1 + lines_below: 1 + + +# Headings must start at the beginning of the line +MD023: true + +# Multiple headings with the same content +MD024: + allow_different_nesting: true + +# Multiple top level headings in the same document +MD025: true + +# Trailing punctuation in heading +MD026: + punctuation: ".,;:!?。,;:!?" + +# Multiple spaces after blockquote symbol +MD027: true + +# Blank line inside blockquote +MD028: true + +# Ordered list item prefix +MD029: + style: one_or_ordered + +# Spaces after list markers +MD030: + ul_single: 1 + ol_single: 1 + ul_multi: 1 + ol_multi: 1 + +# Fenced code blocks should be surrounded by blank lines +MD031: + list_items: true + +# Lists should be surrounded by blank lines +MD032: true + +# inline HTML +MD033: + allowed_elements: [] + +# Bare URL used +MD034: true + +# Horizontal rule style +MD035: + style: "----" + +# Emphasis used instead of a heading +MD036: + punctuation: ".,;:!?。,;:!?" + +# Spaces inside emphasis markers +MD037: true + +# Spaces inside code span elements +MD038: true + +# Spaces inside link text +MD039: true + +# Fenced code blocks should have a language specified +MD040: true + +# First line in file should be a top level heading +MD041: true + +# No empty links +MD042: true + +# Required heading structure +MD043: false + +# Proper names should have the correct capitalization +MD044: false + +# Images should have alternate text (alt text) +MD045: false + +# Code block style +MD046: + style: fenced + +# Files should end with a single newline character +MD047: true + +# Code fence style +MD048: + style: backtick diff --git a/.github/settings.yml b/.github/settings.yml deleted file mode 100644 index f891e0a..0000000 --- a/.github/settings.yml +++ /dev/null @@ -1,16 +0,0 @@ -_extends: .github - -repository: - name: node-stringify-clone - description: Wrapper for fast object cloning using `JSON.parse` & `JSON.stringify` - topics: stringify-clone - homepage: https://github.com/ahmadnassri/stringify-clone - private: false - has_issues: true - has_wiki: false - has_downloads: false - has_projects: false - default_branch: master - allow_squash_merge: true - allow_merge_commit: false - allow_rebase_merge: true diff --git a/.github/workflows/auto-merge.yml b/.github/workflows/auto-merge.yml new file mode 100644 index 0000000..0dedf51 --- /dev/null +++ b/.github/workflows/auto-merge.yml @@ -0,0 +1,11 @@ +name: auto-merge + +on: + pull_request: + +jobs: + auto-merge: + runs-on: ubuntu-latest + if: github.actor == 'dependabot[bot]' + steps: + - uses: ahmadnassri/action-dependabot-auto-merge@v1 diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..043d185 --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,57 @@ +name: release + +on: + push: + branches: + - master + +jobs: + dependencies: + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v2 + - uses: actions/setup-node@v2.1.1 + + # run checks + - run: npm audit --audit-level=moderate + + test: + needs: dependencies + + strategy: + matrix: + os: [ubuntu-latest, windows-latest, macos-latest] + node-version: [10, 12, 13, 14] + + runs-on: ${{ matrix.os }} + + steps: + - uses: actions/checkout@v2 + + - uses: actions/cache@v2 + with: + path: ~/.npm + key: client-${{ hashFiles('**/package-lock.json') }} + + - uses: actions/setup-node@v2.1.1 + with: + node-version: ${{ matrix.node-version }} + + # run test + - run: npm ci + - run: npm run test + + release: + needs: test + + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v2 + + - name: semantic-release + uses: ahmadnassri/action-semantic-release@v1 + env: + NPM_TOKEN: ${{ secrets.NPM_TOKEN }} + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/super-linter.yml b/.github/workflows/super-linter.yml new file mode 100644 index 0000000..997fd80 --- /dev/null +++ b/.github/workflows/super-linter.yml @@ -0,0 +1,14 @@ +name: super-linter + +on: push + +jobs: + super-linter: + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v2 + - uses: docker://github/super-linter:v3 + env: + VALIDATE_ALL_CODEBASE: false + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml new file mode 100644 index 0000000..7a6e17a --- /dev/null +++ b/.github/workflows/test.yml @@ -0,0 +1,43 @@ +name: test + +on: + push: + branches-ignore: + - master + +jobs: + dependencies: + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v2 + - uses: actions/setup-node@v2.1.1 + + # run checks + - run: npm audit --audit-level=moderate + + test: + needs: dependencies + + strategy: + matrix: + os: [ubuntu-latest, windows-latest, macos-latest] + node-version: [10, 12, 13, 14] + + runs-on: ${{ matrix.os }} + + steps: + - uses: actions/checkout@v2 + + - uses: actions/cache@v2 + with: + path: ~/.npm + key: client-${{ hashFiles('**/package-lock.json') }} + + - uses: actions/setup-node@v2.1.1 + with: + node-version: ${{ matrix.node-version }} + + # run test + - run: npm ci + - run: npm run test diff --git a/.releaserc b/.releaserc index 8f2d1fe..4e42a94 100644 --- a/.releaserc +++ b/.releaserc @@ -1,3 +1,36 @@ { - "extends": "@ahmadnassri/semantic-release-config" + "plugins": [ + ["@semantic-release/commit-analyzer", { + "preset": "conventionalcommits", + "releaseRules": [ + { "breaking": true, "release": "major" }, + { "revert": true, "release": "patch" }, + { "type": "build", "release": "patch" }, + { "type": "docs", "release": "patch" }, + { "type": "feat", "release": "minor" }, + { "type": "fix", "release": "patch" }, + { "type": "perf", "release": "patch" }, + { "type": "refactor", "release": "patch" } + ] + }], + ["@semantic-release/release-notes-generator", { + "preset": "conventionalcommits", + "presetConfig": { + "types": [ + { "type": "build", "section": "Build", "hidden": false }, + { "type": "chore", "section": "Chores", "hidden": false }, + { "type": "ci", "section": "CI/CD", "hidden": false }, + { "type": "docs", "section": "Docs", "hidden": false }, + { "type": "feat", "section": "Features", "hidden": false }, + { "type": "fix", "section": "Bug Fixes", "hidden": false }, + { "type": "perf", "section": "Performance", "hidden": false }, + { "type": "refactor", "section": "Refactor", "hidden": false }, + { "type": "style", "section": "Code Style", "hidden": false }, + { "type": "test", "section": "Tests", "hidden": false } + ] + } + }], + "@semantic-release/github", + "@semantic-release/npm" + ] } diff --git a/.remarkrc b/.remarkrc deleted file mode 100644 index 80d5404..0000000 --- a/.remarkrc +++ /dev/null @@ -1,5 +0,0 @@ -{ - "plugins": [ - "@ahmadnassri/remark-config" - ] -} diff --git a/circle.yml b/circle.yml deleted file mode 100644 index 0ec4b94..0000000 --- a/circle.yml +++ /dev/null @@ -1,99 +0,0 @@ -version: 2.1 - -executors: - builder: - docker: - - image: ahmadnassri/build-essential - - node-6: - docker: - - image: node:6-slim - - node-8: - docker: - - image: node:8-slim - - node-10: - docker: - - image: node:10-slim - -commands: - persist: - steps: - - persist_to_workspace: - root: . - paths: . - - attach: - steps: - - attach_workspace: - at: . - - install: - steps: - - run: - name: Install dependencies - command: npm ci - -jobs: - build: - executor: builder - steps: - - checkout - - install - - persist - - lint: - executor: builder - steps: - - attach - - run: npm run lint - - test-node-6: - executor: node-6 - steps: - - attach - - run: npm run test - - test-node-8: - executor: node-8 - steps: - - attach - - run: npm run test - - test-node-10: - executor: node-10 - steps: - - attach - - run: npm run test - - release: - executor: builder - steps: - - attach - - run: npx semantic-release - -workflows: - version: 2 - main: - jobs: - - build - - - lint: - requires: [ build ] - - - test-node-6: - requires: [ build ] - - - test-node-8: - requires: [ build ] - - - test-node-10: - requires: [ build ] - - - release: - context: semantic-release - requires: [ build, lint, test-node-6, test-node-8, test-node-10 ] - filters: - branches: - only: master diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 0000000..1a604f2 --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,44 @@ +version: '3.8' + +x-node: &node + tty: true + volumes: + - type: bind + source: . + target: /app + working_dir: /app + command: npm run test + +services: + lint: + image: github/super-linter:v3 + volumes: + - ./:/tmp/lint + environment: + RUN_LOCAL: 'true' + MULTI_STATUS: 'false' + + test: + <<: *node + image: node:alpine + depends_on: + - node10 + - node12 + - node13 + - node14 + + node10: + <<: *node + image: node:10-alpine + + node12: + <<: *node + image: node:12-alpine + + node13: + <<: *node + image: node:13-alpine + + node14: + <<: *node + image: node:14-alpine diff --git a/package.json b/package.json index e0a6b19..d5499e5 100644 --- a/package.json +++ b/package.json @@ -24,13 +24,8 @@ "url": "https://github.com/ahmadnassri/stringify-clone/issues" }, "scripts": { - "lint:deps": "npx updated", - "lint:ec": "npx editorconfig-checker .", - "lint:js": "npx eslint .", - "lint:md": "npx remark --quiet --frail .", - "lint": "npx run-p lint:*", - "open:coverage": "opener coverage/lcov-report/index.html", - "test": "tap test --100 --coverage-report=lcov --no-browser" + "test": "tap test --no-coverage", + "test:100": "tap test --100 --coverage-report=lcov --no-browser" }, "devDependencies": { "tap": "^14.2.0" diff --git a/renovate.json b/renovate.json deleted file mode 100644 index 3c09e9d..0000000 --- a/renovate.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "extends": [ - "@ahmadnassri" - ] -}