diff --git a/.github/workflows/nodejs.yml b/.github/workflows/nodejs.yml new file mode 100644 index 0000000..5000a50 --- /dev/null +++ b/.github/workflows/nodejs.yml @@ -0,0 +1,51 @@ +name: Node.js CI + +on: + push: + branches: + - '*' + pull_request: + branches: + - '*' + +jobs: + run-test: + runs-on: ubuntu-latest + strategy: + matrix: + node-version: [16, 22] + name: Node ${{ matrix.node-version }} test + + steps: + - name: Checkout + uses: actions/checkout@v3 + + - name: Setup Node.js + uses: actions/setup-node@v3 + with: + node-version: ${{ matrix.node-version }} + + - uses: pnpm/action-setup@v2.0.1 + name: Install pnpm + id: pnpm-install + with: + version: 9 + run_install: false + + - name: Get pnpm store directory + id: pnpm-cache + run: echo "pnpm_cache_dir=$(pnpm store path)" >> $GITHUB_ENV + + - uses: actions/cache@v3 + name: Setup pnpm cache + with: + path: ${{ env.pnpm_cache_dir }} + key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }} + restore-keys: | + ${{ runner.os }}-pnpm-store- + + - name: Install dependencies + run: pnpm install + + - name: Build project + run: pnpm run build