Skip to content

Validate Node.js

Validate Node.js #29

name: Validate corrupted Node.js SDK
on:
workflow_dispatch:
jobs:
build:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
steps:
- uses: actions/checkout@v6
# Setup Node.js and install pnpm
- name: Setup Node.js
id: setup-node
uses: actions/setup-node@v6
with:
node-version: '21'
# Install pnpm globally
- name: Install pnpm
run: npm install -g pnpm
# Normalize runner architecture
- name: Normalize runner architecture
shell: bash
run: |
echo "ARCH=$(echo '${{ runner.arch }}' | tr '[:upper:]' '[:lower:]')" >> $GITHUB_ENV
# Set pnpm cache path
- name: Set pnpm cache path
if: runner.os != 'Windows'
shell: bash
run: |
echo "NODE_CACHE=$(pnpm store path)" >> $GITHUB_ENV
- name: Set pnpm cache path (Windows)
if: runner.os == 'Windows'
shell: pwsh
run: |
$cache = pnpm store path
echo "NODE_CACHE=$cache" | Out-File $env:GITHUB_ENV -Append
# Debug cache env
- name: Debug cache env
run: |
echo "ARCH=$ARCH"
echo "NODE_CACHE=$NODE_CACHE"
# Restore pnpm cache
- name: Restore pnpm cache
uses: actions/cache/restore@v5
with:
path: ${{ env.NODE_CACHE }}
key: node-cache-${{ runner.os }}-${{ env.ARCH }}-pnpm-${{ hashFiles('**/pnpm-lock.yaml') }}
# Install dependencies
- name: Install dependencies
run: pnpm install
# Build
- name: Build
run: pnpm run build --if-present