Firebase FunctionsをGithub Actionsでデプロイしようとしたらnpm installでエラーになった


# 問題

Firebase FunctionsをGithub Actionsでデプロイしようとしたらnpm installでエラーになる
Sharpというライブラリがlinuxmusl-x64上では使えないとのこと

```bash
✔  functions: Finished running predeploy script.
i  functions: ensuring required API cloudfunctions.googleapis.com is enabled...
i  functions: ensuring required API cloudbuild.googleapis.com is enabled...
✔  functions: required API cloudfunctions.googleapis.com is enabled
✔  functions: required API cloudbuild.googleapis.com is enabled
i  functions: preparing functions directory for uploading...
Error: Error occurred while parsing your function triggers.

Error: 'linux-x64' binaries cannot be used on the 'linuxmusl-x64' platform. Please remove the 'node_modules/sharp' directory and run 'npm install' on the 'linuxmusl-x64' platform.
    at Object.hasVendoredLibvips (/github/workspace/functions/node_modules/sharp/lib/libvips.js:68:13)
    at Object.<anonymous> (/github/workspace/functions/node_modules/sharp/lib/constructor.js:7:22)
    at Module._compile (internal/modules/cjs/loader.js:1138:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1158:10)
    at Module.load (internal/modules/cjs/loader.js:986:32)
    at Function.Module._load (internal/modules/cjs/loader.js:879:14)
    at Module.require (internal/modules/cjs/loader.js:1026:19)
    at require (internal/modules/cjs/helpers.js:72:18)
    at Object.<anonymous> (/github/workspace/functions/node_modules/sharp/lib/index.js:3:15)
    at Module._compile (internal/modules/cjs/loader.js:1138:30)
```

### 問題のGithub Actions

```yaml
name: deploy
on:
  push:
    branches:
      - dev

jobs:
  build:
    runs-on: ubuntu-latest

    strategy:
      matrix:
        node-version: [8.x]

    steps:
      - uses: actions/checkout@v2
      - name: Use Node.js ${{ matrix.node-version }}
        uses: actions/setup-node@v1
        with:
          node-version: ${{ matrix.node-version }}
      - name: npm install, build
        working-directory: ./functions
        run: |
          npm install
          npm run build
      - name: Run tests
        working-directory: ./functions
        run: npm run test
      - name: Deploy to Cloud Functions
        uses: w9jds/firebase-action@master
        with:
          args: deploy --only functions
        env:
          FIREBASE_TOKEN: ${{ secrets.FIREBASE_TOKEN }}
          PROJECT_ID: "default"
```

# 対策

npm install時にplatformにlinuxmuslを指定してみる

`npm install --arch=x64 --platform=linuxmusl`

###

```yaml
name: deploy
on:
  push:
    branches:
      - dev

jobs:
  build:
    runs-on: ubuntu-latest

    strategy:
      matrix:
        node-version: [8.x]

    steps:
      - uses: actions/checkout@v2
      - name: Use Node.js ${{ matrix.node-version }}
        uses: actions/setup-node@v1
        with:
          node-version: ${{ matrix.node-version }}
      - name: npm install, build
        working-directory: ./functions
        run: |
          npm install --arch=x64 --platform=linuxmusl
          npm run build
      - name: Run tests
        working-directory: ./functions
        run: npm run test
      - name: Deploy to Cloud Functions
        uses: w9jds/firebase-action@master
        with:
          args: deploy --only functions
        env:
          FIREBASE_TOKEN: ${{ secrets.FIREBASE_TOKEN }}
          PROJECT_ID: "default"
```

# 結果

成功