Chore: fix github action #9
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] | |
jobs: | |
prepare: | |
runs-on: ubuntu-latest | |
name: Prepare Job | |
outputs: | |
steps: ${{ steps }} | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Setup node | |
uses: actions/setup-node@v4 | |
with: | |
node-version: 18 | |
- name: Install pnpm | |
uses: pnpm/action-setup@v2 | |
with: | |
version: 8 | |
run_install: false | |
- name: Get pnpm store directory | |
id: pnpm-store | |
shell: bash | |
run: | | |
echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV | |
echo "::set-output name=storePath::${STORE_PATH}" | |
- name: Setup pnpm cache | |
id: cache | |
uses: actions/cache@v3 | |
with: | |
path: | | |
${{ steps.pnpm-store.outputs.storePath }} | |
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }} | |
restore-keys: | | |
${{ runner.os }}-pnpm-store- | |
- name: Install dependencies | |
run: | | |
pnpm i | |
lint: | |
runs-on: ubuntu-latest | |
needs: [prepare] | |
name: Linting | |
steps: | |
- name: Reuse Prepare Steps | |
run: echo "${{ needs.prepare.outputs.steps }}" | |
- name: Check style | |
run: | | |
pnpm prettier | |
- name: LINTing | |
run: | | |
pnpm lint | |
test: | |
runs-on: ubuntu-latest | |
needs: [prepare] | |
name: Testing | |
steps: | |
- name: Reuse Prepare Steps | |
run: echo "${{ needs.prepare.outputs.steps }}" | |
- name: Test | |
run: | | |
pnpm test |