diff --git a/.github/workflows/node.js.yml b/.github/workflows/node.js.yml index 55e7f1e..a699a0c 100644 --- a/.github/workflows/node.js.yml +++ b/.github/workflows/node.js.yml @@ -2,9 +2,9 @@ name: Node.js CI on: pull_request: - branches: [ main ] + branches: [main] push: - branches: [ main ] + branches: [main] permissions: contents: read @@ -14,46 +14,47 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - node-version: [14.x, 16.x, 18.x ] + node-version: [16.x, 18.x, 22.x] steps: - - uses: actions/checkout@v5 - - name: Use Node.js ${{ matrix.node-version }} - uses: actions/setup-node@v5 - with: - node-version: ${{ matrix.node-version }} - - uses: actions/cache@v4 - with: - path: ~/.npm - key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }} - restore-keys: | - ${{ runner.os }}-node- - - run: npm ci - name: Install dependencies - - name: Test - env: - NCM_API_TEST_LOGIN_COUNTRY_CODE: ${{ secrets.NCM_API_TEST_LOGIN_COUNTRY_CODE }} - NCM_API_TEST_LOGIN_PHONE: ${{ secrets.NCM_API_TEST_LOGIN_PHONE }} - NCM_API_TEST_LOGIN_PASSWORD: ${{ secrets.NCM_API_TEST_LOGIN_PASSWORD }} - run: npm test + - uses: actions/checkout@v5 + - name: Use Node.js ${{ matrix.node-version }} + uses: actions/setup-node@v5 + with: + node-version: ${{ matrix.node-version }} + # Use built-in package manager cache for pnpm + cache: 'pnpm' + cache-dependency-path: '**/pnpm-lock.yaml' + - name: Setup pnpm + uses: pnpm/action-setup@v2 + with: + version: 8 + - name: Install dependencies (pnpm) + run: pnpm install --frozen-lockfile + - name: Test + env: + NCM_API_TEST_LOGIN_COUNTRY_CODE: ${{ secrets.NCM_API_TEST_LOGIN_COUNTRY_CODE }} + NCM_API_TEST_LOGIN_PHONE: ${{ secrets.NCM_API_TEST_LOGIN_PHONE }} + NCM_API_TEST_LOGIN_PASSWORD: ${{ secrets.NCM_API_TEST_LOGIN_PASSWORD }} + run: pnpm test lint: name: Lint runs-on: ubuntu-latest strategy: matrix: - node-version: [14.x] + node-version: [18.x] steps: - - uses: actions/checkout@v5 - - name: Use Node.js ${{ matrix.node-version }} - uses: actions/setup-node@v5 - with: - node-version: ${{ matrix.node-version }} - - uses: actions/cache@v4 - with: - path: ~/.npm - key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }} - restore-keys: | - ${{ runner.os }}-node- - - run: npm ci - name: Install dependencies - - name: Lint - run: npm run lint + - uses: actions/checkout@v5 + - name: Use Node.js ${{ matrix.node-version }} + uses: actions/setup-node@v5 + with: + node-version: ${{ matrix.node-version }} + cache: 'pnpm' + cache-dependency-path: '**/pnpm-lock.yaml' + - name: Setup pnpm + uses: pnpm/action-setup@v2 + with: + version: 8 + - name: Install dependencies (pnpm) + run: pnpm install --frozen-lockfile + - name: Lint + run: pnpm run lint