name: Prebuild Binaries

on:
  pull_request:

jobs:
  prebuild-linux:
    name: Prebuild Binaries for Linux
    runs-on: ubuntu-latest
    timeout-minutes: 30
    steps:
      - name: Setup Dependencies
        run: |
          sudo dpkg --add-architecture i386
          sudo apt-get update -y -qq
          sudo apt-get install -y g++-multilib gcc-multilib libcups2-dev libcups2-dev:i386 libc6-dev-i386 linux-libc-dev linux-libc-dev:i386
      - uses: actions/setup-node@v1
        with:
          node-version: 16.x
      - uses: actions/checkout@v1
      - run: npm i
      - name: Prebuild
        run: |
          npm run apply-patches
          npm run prebuild -- --strip --all --arch ia32
          npm run prebuild -- --strip --all --arch x64
  prebuild-macos:
    name: Prebuild Binaries for macOS
    runs-on: macos-latest
    timeout-minutes: 30
    steps:
      - uses: actions/setup-node@v1
        with:
          node-version: 16.x
      - uses: actions/checkout@v1
      - run: npm i
      - name: Prebuild
        run: |
          npm run apply-patches
          npm run prebuild -- --strip --all --arch x64
  prebuild-windows:
    name: Prebuild Binaries for Windows
    runs-on: windows-latest
    timeout-minutes: 30
    steps:
      - uses: actions/setup-node@v1
        with:
          node-version: 16.x
      - uses: actions/checkout@v1
      - run: npm i
      - name: Prebuild
        run: |
          npm run apply-patches
          npm run prebuild -- --strip --all --arch ia32
          npm run prebuild -- --strip --all --arch x64
