Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ci: add lint and format check #208

Merged
Show file tree
Hide file tree
Changes from 6 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 35 additions & 0 deletions .github/actions/pnpm-install-with-cache/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
name: "Setup pnpm cache"
description: "Setups pnpm cache by installing Node.js and pnpm, and getting the pnpm store directory."

runs:
using: "composite"
steps:
- uses: pnpm/action-setup@v2
name: Install pnpm
id: pnpm-install
with:
version: 8
run_install: false

- name: Install Node.js
uses: actions/setup-node@v3
with:
node-version: 16

- name: Get pnpm store directory
id: pnpm-cache
shell: bash
run: |
echo "STORE_PATH=$(pnpm store path)" >> $GITHUB_OUTPUT

- uses: actions/cache@v3
name: Setup pnpm cache
with:
path: ${{ steps.pnpm-cache.outputs.STORE_PATH }}
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
restore-keys: |
${{ runner.os }}-pnpm-store-

- name: Install dependencies
shell: "bash"
run: pnpm install
106 changes: 76 additions & 30 deletions .github/workflows/node.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,41 +6,87 @@ on:
pull_request:

jobs:
test:
install:
name: Checkout and Install
runs-on: ubuntu-latest

steps:
- name: Checkout
uses: actions/checkout@v3
- name: PNPM Install With Cache
uses: ./.github/actions/pnpm-install-with-cache

- name: Install Node.js
uses: actions/setup-node@v3
with:
node-version: 16

- uses: pnpm/action-setup@v2
name: Install pnpm
id: pnpm-install
with:
version: 8
run_install: false

- name: Get pnpm store directory
id: pnpm-cache
shell: bash
run: |
echo "STORE_PATH=$(pnpm store path)" >> $GITHUB_OUTPUT

- uses: actions/cache@v3
name: Setup pnpm cache
with:
path: ${{ steps.pnpm-cache.outputs.STORE_PATH }}
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
restore-keys: |
${{ runner.os }}-pnpm-store-

- name: Install dependencies
run: pnpm install
lint_website:
name: Run linter in website
needs: install
runs-on: ubuntu-latest

steps:
- name: Checkout
uses: actions/checkout@v3
- name: PNPM Install With Cache
uses: ./.github/actions/pnpm-install-with-cache

- name: Run lint check
run: pnpm lint
working-directory: website

format_website:
name: Run formatter in website
needs: install
runs-on: ubuntu-latest

steps:
- name: Checkout
uses: actions/checkout@v3
- name: PNPM Install With Cache
uses: ./.github/actions/pnpm-install-with-cache

- name: Run format check
run: pnpm format.check
working-directory: website

lint_library:
name: Run linter in library
needs: install
runs-on: ubuntu-latest

steps:
- name: Checkout
uses: actions/checkout@v3
- name: PNPM Install With Cache
uses: ./.github/actions/pnpm-install-with-cache

- name: Run lint check
run: pnpm lint
working-directory: library

format_library:
name: Run formatter in library
needs: install
runs-on: ubuntu-latest

steps:
- name: Checkout
uses: actions/checkout@v3
- name: PNPM Install With Cache
uses: ./.github/actions/pnpm-install-with-cache

- name: Run format check
run: pnpm format.check
working-directory: library

test_library:
name: Run Vitest in library
needs: install
runs-on: ubuntu-latest

steps:
- name: Checkout
uses: actions/checkout@v3
- name: PNPM Install With Cache
uses: ./.github/actions/pnpm-install-with-cache

- name: Run Vitest
run: cd ./library && pnpm test
run: pnpm test
working-directory: library