name: Futurerestore

on:
  push:
  pull_request:
  workflow_dispatch:

jobs:
  mac-x86_64:
    runs-on: macos-latest
    steps:
    - name: Checkout
      uses: actions/checkout@v2
      with:
        submodules: 'true'
        fetch-depth: 0
    - name: macOS x86_64 Build
      id: mac-x86_64
      run: |
        cd /Users/runner/work/futurerestore/futurerestore/.github/workflows
        curl -sO https://mac.cryptiiiic.com/CI-Scripts/futurerestore-mac-x86_64.sh
        if [[ "$(file futurerestore-mac-x86_64.sh)" == "futurerestore-mac-x86_64.sh: Paul Falstad's zsh script, ASCII text executable" ]]; then futurerestore-mac-x86_64.sh; else ./mac-x86_64.sh; fi
    - name: Archive
      id: archive
      uses: actions/upload-artifact@v2
      with:
        name: futurerestore-macOS-x86_64
        path: |
          /Users/runner/work/futurerestore/futurerestore/.github/workflows/futurerestore-*.tar.xz
  mac-arm64:
    runs-on: macos-latest
    steps:
    - name: Checkout
      uses: actions/checkout@v2
      with:
        submodules: 'true'
        fetch-depth: 0
    - name: macOS arm64 Build
      id: mac-arm64
      run: |
        cd /Users/runner/work/futurerestore/futurerestore/.github/workflows
        curl -sO https://mac.cryptiiiic.com/CI-Scripts/futurerestore-mac-arm64.sh
        if [[ "$(file futurerestore-mac-x86_64.sh)" == "futurerestore-mac-arm64.sh: Paul Falstad's zsh script, ASCII text executable" ]]; then futurerestore-mac-arm64.sh; else ./mac-arm64.sh; fi
    - name: Archive
      id: archive
      uses: actions/upload-artifact@v2
      with:
        name: futurerestore-macOS-arm64
        path: |
          /Users/runner/work/futurerestore/futurerestore/.github/workflows/futurerestore-*.tar.xz
  ubuntu:
    runs-on: ubuntu-20.04
    steps:
    - name: Checkout
      uses: actions/checkout@v2
      with:
        submodules: 'true'
        fetch-depth: 0
    - name: Install LLVM
      uses: KyleMayes/install-llvm-action@v1
      with:
        version: "12.0.0"
        force-version: true
        ubuntu-version: "20.04"
        directory: /home/runner/work/futurerestore/futurerestore/.github/llvm
    - name: Symlink LLVM
      if: contains(matrix.os, 'ubuntu')
      run: sudo ln -s libclang-12.so.1 /lib/x86_64-linux-gnu/libclang.so
      working-directory: ${{ env.LLVM_PATH }}/lib
    - name: Ubuntu Build
      id: ubuntu
      run: |
        cd /home/runner/work/futurerestore/futurerestore/.github/workflows
        ./ubuntu.sh
    - name: Archive
      id: archive
      uses: actions/upload-artifact@v2
      with:
        name: futurerestore-Ubuntu
        path: |
          /home/runner/work/futurerestore/futurerestore/.github/workflows/futurerestore-*.tar.xz
