Validate corrupted Node.js #12
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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 | |
| - name: Setup Node.js | |
| id: setup-node | |
| uses: actions/setup-node@v6 | |
| with: | |
| node-version: '21' | |
| package-manager-cache: false # IMPORTANT | |
| # Normalize arch | |
| - name: Normalize runner architecture | |
| shell: bash | |
| run: | | |
| echo "ARCH=$(echo '${{ runner.arch }}' | tr '[:upper:]' '[:lower:]')" >> $GITHUB_ENV | |
| # Node equivalent of `go env GOMODCACHE` | |
| - name: Set Node cache path | |
| if: runner.os != 'Windows' | |
| shell: bash | |
| run: | | |
| set -e | |
| echo "NODE_CACHE=$(npm config get cache)" >> $GITHUB_ENV | |
| - name: Set Node cache path (Windows) | |
| if: runner.os == 'Windows' | |
| shell: pwsh | |
| run: | | |
| "NODE_CACHE=$(npm config get cache)" | Out-File $env:GITHUB_ENV -Append | |
| - name: Debug cache env | |
| run: | | |
| echo "ARCH=$ARCH" | |
| echo "NODE_CACHE=$NODE_CACHE" | |
| - name: Restore Node cache | |
| uses: actions/cache/restore@v5 | |
| with: | |
| path: ${{ env.NODE_CACHE }} | |
| key: node-cache-${{ runner.os }}-${{ env.ARCH }}-npm-${{ hashFiles('**/package-lock.json', '**/npm-shrinkwrap.json') }} | |
| - name: Install dependencies | |
| run: npm ci | |
| - name: Build | |
| run: npm run build --if-present |