Skip to content

Commit

Permalink
ci: ci lint check 파이프라인 적용 (#97)
Browse files Browse the repository at this point in the history
  • Loading branch information
saseungmin authored Oct 2, 2024
1 parent 3115abe commit b014596
Showing 1 changed file with 89 additions and 0 deletions.
89 changes: 89 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
name: CI

on:
pull_request:
branches: [develop]
push:
branches: [develop]

env:
CACHED_DEPENDENCY_PATHS: |
.yarn/cache
.yarn/unplugged
.yarn/build-state.yml
.yarn/install-state.gz
.pnp.*
CACHED_BUILD_PATHS: ${{ github.workspace }}/.next
DEFAULT_NODE_VERSION: "v20.12.2"
DEFAULT_YARN_VERSION: "4.5.0"

jobs:
job_install_dependencies:
name: Install Dependencies
runs-on: ubuntu-latest
steps:
- name: Check out current commit (${{ github.sha }})
uses: actions/checkout@v4
- name: Set up Node
uses: actions/setup-node@v4
with:
node-version: ${{ env.DEFAULT_NODE_VERSION }}

- name: Set up Yarn
run: |
corepack enable
yarn set version ${{ env.DEFAULT_YARN_VERSION }}
yarn --version
- name: Get yarn cache directory path
id: yarn-cache-dir-path
run: echo "dir=$(yarn config get cacheFolder)" >> $GITHUB_OUTPUT

- name: Compute dependency cache key
id: compute_lockfile_hash
run: echo "hash=${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}" >> $GITHUB_OUTPUT

- name: Check dependency cache
uses: actions/cache@v4
id: cache_dependencies
with:
path: |
${{ steps.yarn-cache-dir-path.outputs.dir }}
${{ env.CACHED_DEPENDENCY_PATHS }}
key: ${{ steps.compute_lockfile_hash.outputs.hash }}
restore-keys: |
${{ runner.os }}-yarn-
- name: Install dependencies
if: steps.cache_dependencies.outputs.cache-hit != 'true'
run: yarn install --immutable

outputs:
dependency_cache_key: ${{ steps.compute_lockfile_hash.outputs.hash }}
yarn_cache_dir_path: |
${{ steps.yarn-cache-dir-path.outputs.dir }}
${{ env.CACHED_DEPENDENCY_PATHS }}
continuous-integration:
name: check lint
needs: [job_install_dependencies]
runs-on: ubuntu-latest
steps:
- name: Check out current commit (${{ github.sha }})
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Set up Node
uses: actions/setup-node@v4
with:
node-version: ${{ env.DEFAULT_NODE_VERSION }}

- name: Check dependency cache
uses: actions/cache@v4
with:
path: ${{ needs.job_install_dependencies.outputs.yarn_cache_dir_path }}
key: ${{ needs.job_install_dependencies.outputs.dependency_cache_key }}

- name: Check Lint
if: ${{ github.event_name == 'pull_request' }}
run: yarn run eslint $(git diff --name-only --diff-filter=d origin/main | grep -E '(.js$|.jsx|.ts$|.tsx$)')

0 comments on commit b014596

Please sign in to comment.