-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
3115abe
commit b014596
Showing
1 changed file
with
89 additions
and
0 deletions.
There are no files selected for viewing
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
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$)') |