diff --git a/.github/workflows/node.js.yml b/.github/workflows/node.js.yml new file mode 100644 index 0000000..491ab36 --- /dev/null +++ b/.github/workflows/node.js.yml @@ -0,0 +1,43 @@ +name: Node.js CI + +on: + push: + branches: [main] + pull_request: + branches: [main] + +jobs: + build: + runs-on: ubuntu-latest + + strategy: + matrix: + node-version: [18.x, 20.x, 22.x] + + steps: + - uses: actions/checkout@v4 + + - name: Use Node.js ${{ matrix.node-version }} + uses: actions/setup-node@v4 + with: + node-version: ${{ matrix.node-version }} + cache: 'yarn' + + - name: Install dependencies + run: yarn install --immutable + + - name: Get installed Playwright version + run: echo "PLAYWRIGHT_VERSION=$(yarn info playwright --json | jq -r '.children.Version')" >> $GITHUB_ENV + + - name: Cache Playwright binaries + uses: actions/cache@v3 + with: + path: | + ~/.cache/ms-playwright + key: ${{ runner.os }}-playwright-${{ env.PLAYWRIGHT_VERSION }} + + - name: Install Playwright Browsers + run: yarn playwright install --with-deps + if: steps.playwright-cache.outputs.cache-hit != 'true' + + - run: yarn test