Skip to content

Commit

Permalink
Merge pull request #13 from firehawk89/add-ci-cd
Browse files Browse the repository at this point in the history
PR: #13

* add dev workflow

* test commit

* add new word

* update with eslint-plugin-perfectionist

* update with prettier

* remove test job test script running step
  • Loading branch information
firehawk89 authored Jan 24, 2024
2 parents 8644d03 + 2122f8d commit b744c6d
Show file tree
Hide file tree
Showing 24 changed files with 1,018 additions and 65 deletions.
5 changes: 4 additions & 1 deletion .eslintrc.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
{
"extends": "next/core-web-vitals"
"extends": [
"next/core-web-vitals",
"plugin:perfectionist/recommended-natural"
]
}
6 changes: 3 additions & 3 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
version: 2
updates:
- package-ecosystem: "npm"
directory: "/"
- package-ecosystem: 'npm'
directory: '/'
schedule:
interval: "weekly"
interval: 'weekly'
44 changes: 44 additions & 0 deletions .github/workflows/dev.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
name: Dev CI/CD Pipeline
on: [push]
jobs:
analyze:
runs-on: ${{ (matrix.language == 'swift' && 'macos-latest') || 'ubuntu-latest' }}
timeout-minutes: ${{ (matrix.language == 'swift' && 120) || 360 }}
permissions:
actions: read
contents: read
security-events: write

strategy:
fail-fast: false
matrix:
language: ['javascript']

steps:
- name: Checkout Repository
uses: actions/checkout@v3

- name: Initialize CodeQL
uses: github/codeql-action/init@v2
with:
languages: ${{ matrix.language }}

- name: Autobuild
uses: github/codeql-action/autobuild@v2

- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v2
with:
category: '/language:${{matrix.language}}'
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Use Node.js
uses: actions/setup-node@v3
with:
node-version: '20.x'
cache: 'npm'
- run: npm ci
- run: npm run prettier:check
- run: npm run eslint:check
4 changes: 4 additions & 0 deletions .husky/pre-commit
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/usr/bin/env sh
. "$(dirname -- "$0")/_/husky.sh"

npx lint-staged
17 changes: 17 additions & 0 deletions .lintstagedrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
const path = require('node:path')

const relative = (files) =>
files.map((file) => path.relative(process.cwd(), file))

const buildEslintCommand = (filenames) =>
`next lint --fix --file ${relative(filenames).join(' --file ')}`

module.exports = {
'*.{js,jsx,ts,tsx}': [buildEslintCommand],
'*.{js,ts}': () => 'npm run typescript:check',
'*': 'prettier --write --ignore-unknown',
'*.{js,jsx,ts,tsx,md,css,scss,json}': (files) =>
`cspell --show-suggestions --quiet --gitignore ${relative(files).join(
' '
)}`,
}
Loading

0 comments on commit b744c6d

Please sign in to comment.