Skip to content

chore: install dep on root #1419

chore: install dep on root

chore: install dep on root #1419

# This action is centrally managed in https://github.com/asyncapi/.github/
# Don't make changes to this file in this repo as they will be overwritten with changes made to the same file in above mentioned repo
# It does magic only if there is package.json file in the root of the project
name: PR testing - if Node project
on:
pull_request:
types: [opened, reopened, synchronize, ready_for_review]
jobs:
test-nodejs-pr:
name: Test NodeJS PR - ${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
matrix:
# Using macos-13 instead of latest (macos-14) due to an issue with Puppeteer and such runner.
# See: https://github.com/puppeteer/puppeteer/issues/12327 and https://github.com/asyncapi/parser-js/issues/1001
os: [ubuntu-latest, macos-13, windows-latest]
steps:
- if: >
!github.event.pull_request.draft && !(
(github.actor == 'asyncapi-bot' && (
startsWith(github.event.pull_request.title, 'ci: update of files from global .github repo') ||
startsWith(github.event.pull_request.title, 'chore(release):')
)) ||
(github.actor == 'asyncapi-bot-eve' && (
startsWith(github.event.pull_request.title, 'ci: update of files from global .github repo') ||
startsWith(github.event.pull_request.title, 'chore(release):')
)) ||
(github.actor == 'allcontributors[bot]' &&
startsWith(github.event.pull_request.title, 'docs: add')
)
)
id: should_run
name: Should Run
run: echo "shouldrun=true" >> $GITHUB_OUTPUT
shell: bash
- if: steps.should_run.outputs.shouldrun == 'true'
name: Set git to use LF #to once and for all finish neverending fight between Unix and Windows
run: |
git config --global core.autocrlf false
git config --global core.eol lf
shell: bash
- if: steps.should_run.outputs.shouldrun == 'true'
name: Checkout repository
uses: actions/checkout@v4
- if: steps.should_run.outputs.shouldrun == 'true'
name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: 20
- if: steps.should_run.outputs.shouldrun == 'true'
uses: pnpm/action-setup@v3
with:
run_install: false
- if: steps.should_run.outputs.shouldrun == 'true'
name: Get pnpm store directory
shell: bash
run: |
echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV
- if: steps.should_run.outputs.shouldrun == 'true'
uses: actions/cache@v4
name: Setup pnpm cache
with:
path: ${{ env.STORE_PATH }}
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
restore-keys: |
${{ runner.os }}-pnpm-store-
- if: steps.should_run.outputs.shouldrun == 'true'
name: Install dependencies
shell: bash
run: pnpm install
- if: steps.should_run.outputs.shouldrun == 'true'
name: Test
run: pnpm test