2022-05-28

Using Yarn v3.1.1 and GitHub Actions CI with node.js.yml?

I use Yarn v3.1.1 package manager and recently setup a Node.js CI pipeline with GitHub Actions.

How do I get the CI test to use the dependencies generated by yarn install instead of looking for package-lock.json generated by npm install?

Below is my node.js.yml file. I've tried changing the npm references to yarn and deleting the package-lock.json file, but the runner still looks for the package-lock.json file.

My end goal is to use one package manager, preferably Yarn.

EDIT: For clarification, my current workflow requires me to run npm install before pushing to origin so that the CI runs correctly and running yarn install before I can serve my repo locally.

name: Node.js CI

on:
  push:
    branches: [ master ]
  pull_request:
    branches: [ master ]

jobs:
  build:

    runs-on: ubuntu-latest

    strategy:
      matrix:
        node-version: [16.x]
        # See supported Node.js release schedule at https://nodejs.org/en/about/releases/

    steps:
    - uses: actions/checkout@v3
    - name: Use Node.js $
      uses: actions/setup-node@v3
      with:
        node-version: $
        cache: 'npm'
    - run: npm ci
    - run: yarn run build
    - run: yarn run test:headless


No comments:

Post a Comment