Skip to content

Commit

Permalink
ci: separate workflows, add eslint and prettier
Browse files Browse the repository at this point in the history
  • Loading branch information
bernizhel committed Jul 13, 2023
1 parent 9be7fd8 commit dacdff7
Show file tree
Hide file tree
Showing 6 changed files with 159 additions and 59 deletions.
59 changes: 0 additions & 59 deletions .github/workflows/ci.yml

This file was deleted.

36 changes: 36 additions & 0 deletions .github/workflows/commitlint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
name: Commitlint

on: [push, pull_request, workflow_call]

jobs:
commitlint:
name: Commitlint
runs-on: ubuntu-latest
defaults:
run:
shell: bash
working-directory: .
steps:
- uses: ${{ github.workspace }}/.github/workflows/setup.yml
# - uses: actions/checkout@v3
# with:
# fetch-depth: 0
# - name: Install system dependencies
# run: |
# sudo apt-get update
# sudo apt-get upgrade
# sudo apt-get install -y git
# - name: Install Node.js
# uses: actions/setup-node@v3
# with:
# node-version-file: '.nvmrc'
- name: Install commitlint
run: |
npm install conventional-changelog-conventionalcommits
npm install commitlint@latest
- name: Validate current commit (last commit) with commitlint
if: github.event_name == 'push' # || github.event_name == 'workflow_call'
run: npx commitlint --from HEAD~1 --to HEAD --verbose
- name: Validate PR commits with commitlint
if: github.event_name == 'pull_request'
run: npx commitlint --from ${{ github.event.pull_request.head.sha }}~${{ github.event.pull_request.commits }} --to ${{ github.event.pull_request.head.sha }} --verbose
32 changes: 32 additions & 0 deletions .github/workflows/eslint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
name: ESLint

on: [push, pull_request, workflow_call]

jobs:
eslint:
name: ESLint
runs-on: ubuntu-latest
defaults:
run:
shell: bash
working-directory: .
steps:
- uses: ${{ github.workspace }}/.github/workflows/setup.yml
# - uses: actions/checkout@v3
# with:
# fetch-depth: 0
# - name: Install system dependencies
# run: |
# sudo apt-get update
# sudo apt-get upgrade
# sudo apt-get install -y git
# - name: Install correct Node.js version
# uses: actions/setup-node@v3
# with:
# node-version-file: '.nvmrc'
# cache: 'npm'
# cache-dependency-path: 'package-lock.json'
# - name: Install dependencies
# run: npm ci
- name: Run `lint:check` npm script
run: npm run lint:check
32 changes: 32 additions & 0 deletions .github/workflows/prettier.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
name: Prettier

on: [push, pull_request, workflow_call]

jobs:
eslint:
name: Prettier
runs-on: ubuntu-latest
defaults:
run:
shell: bash
working-directory: .
steps:
- uses: ${{ github.workspace }}/.github/workflows/setup.yml
# - uses: actions/checkout@v3
# with:
# fetch-depth: 0
# - name: Install system dependencies
# run: |
# sudo apt-get update
# sudo apt-get upgrade
# sudo apt-get install -y git
# - name: Install correct Node.js version
# uses: actions/setup-node@v3
# with:
# node-version-file: '.nvmrc'
# cache: 'npm'
# cache-dependency-path: 'package-lock.json'
# - name: Install dependencies
# run: npm ci
- name: Run `format:check` npm script
run: npm run format:check
27 changes: 27 additions & 0 deletions .github/workflows/setup.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
name: Set up workflow machine

on: [workflow_call]

jobs:
setup:
name: Setup
runs-on: ubuntu-latest
defaults:
run:
shell: bash
working-directory: .
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Install system dependencies
# sudo apt-get install -y git
run: |
sudo apt-get update
sudo apt-get upgrade
- name: Install correct Node.js version
uses: actions/setup-node@v3
with:
node-version-file: '.nvmrc'
cache: 'npm'
cache-dependency-path: 'package-lock.json'
32 changes: 32 additions & 0 deletions .github/workflows/unit-tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
name: Unit tests

on: [push, pull_request, workflow_call]

jobs:
unit-test:
name: Unit tests
runs-on: ubuntu-latest
defaults:
run:
shell: bash
working-directory: .
steps:
- uses: ${{ github.workspace }}/.github/workflows/setup.yml
# - uses: actions/checkout@v3
# with:
# fetch-depth: 0
# - name: Install system dependencies
# run: |
# sudo apt-get update
# sudo apt-get upgrade
# sudo apt-get install -y git
# - name: Install correct Node.js version
# uses: actions/setup-node@v3
# with:
# node-version-file: '.nvmrc'
# cache: 'npm'
# cache-dependency-path: 'package-lock.json'
# - name: Install dependencies
# run: npm ci
- name: Run `test-ci` npm script
run: npm run test-ci

0 comments on commit dacdff7

Please sign in to comment.