chore(deps): next15 & react 19 마이그레이션 (#341) #648
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: CI | |
on: | |
pull_request: | |
branches: [main] | |
push: | |
branches: [main] | |
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.18.0" | |
DEFAULT_YARN_VERSION: "4.5.3" | |
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 }} | |
job_build: | |
name: Build | |
needs: [job_install_dependencies] | |
runs-on: ubuntu-latest | |
timeout-minutes: 15 | |
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: 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: Compute build cache key | |
id: compute_build_cache_key | |
run: echo "hash=${{ runner.os }}-build-${{ hashFiles('**/yarn.lock') }}" >> $GITHUB_OUTPUT | |
- name: Check build cache | |
uses: actions/cache@v4 | |
id: cache_built_packages | |
with: | |
path: ${{ env.CACHED_BUILD_PATHS }} | |
key: ${{ steps.compute_build_cache_key.outputs.hash }} | |
- name: Create env file | |
run: | | |
touch .env | |
echo NEXT_PUBLIC_GOOGLE_MAP_API_KEY = ${{ secrets.GOOGLE_MAP_API_KEY }} >> .env | |
echo NEXT_PUBLIC_ORIGIN = ${{ secrets.NEXT_PUBLIC_ORIGIN }} >> .env | |
echo NEXT_PUBLIC_GA_MEASUREMENT_ID = ${{ secrets.NEXT_PUBLIC_GA_MEASUREMENT_ID }} >> .env | |
cat .env | |
- name: Build | |
if: steps.cache_built_packages.outputs.cache-hit != 'true' | |
run: yarn build | |
outputs: | |
yarn_cache_dir_path: ${{ needs.job_install_dependencies.outputs.yarn_cache_dir_path }} | |
dependency_cache_key: ${{ needs.job_install_dependencies.outputs.dependency_cache_key }} | |
build_cache_key: ${{ steps.compute_build_cache_key.outputs.hash }} | |
continuous-integration: | |
name: check unit test & 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$)') | |
- name: Check Unit Test | |
run: yarn test:coverage | |
- name: Upload coverage reports to Codecov | |
uses: codecov/codecov-action@v3 | |
with: | |
token: ${{ secrets.CODECOV_TOKEN }} | |
fail_ci_if_error: true | |
job_nextjs_bundle_analysis: | |
name: nextjs bundle analysis | |
needs: [job_build] | |
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: Check dependency cache | |
uses: actions/cache@v4 | |
with: | |
path: ${{ needs.job_build.outputs.yarn_cache_dir_path }} | |
key: ${{ needs.job_build.outputs.dependency_cache_key }} | |
- name: Check build cache | |
uses: actions/cache@v4 | |
with: | |
path: ${{ env.CACHED_BUILD_PATHS }} | |
key: ${{ needs.job_build.outputs.build_cache_key }} | |
- name: Analyze bundle sizes | |
uses: transferwise/actions-next-bundle-analyzer@v2 | |
with: | |
github-token: ${{ secrets.GITHUB_TOKEN }} | |
job_publish_storybook_chromatic: | |
name: Chromatic Publish | |
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: Publish Project to Chromatic | |
uses: chromaui/action@latest | |
with: | |
projectToken: ${{ secrets.CHROMATIC_PROJECT_TOKEN }} | |
skip: "dependabot/**" | |
exitOnceUploaded: true | |
onlyChanged: true | |
autoAcceptChanges: true | |
buildScriptName: "build-storybook" |