# This file is auto-generated
#
# To regenerate it run
#
#     make github-actions
#
name: Bootstrap
on:
  push:
    branches:
      - master
  pull_request:
  release:
    types:
      - created

jobs:
  boostrap-linux:
    name: Bootstrap on Linux
    runs-on: ubuntu-18.04
    steps:
      - uses: actions/checkout@v2
      - name: bootstrap.py
        run: |
          ghcup config set cache true
          ghcup install ghc 8.10.7
          python3 bootstrap/bootstrap.py -w $(ghcup whereis ghc 8.10.7) -d bootstrap/linux-8.10.7.json

      - name: Smoke test
        run: |
          _build/bin/cabal --version

      - uses: actions/upload-artifact@v2
        with:
          name: cabal-linux-bootstrapped
          path: _build/artifacts/*

  boostrap-macos:
    name: Bootstrap on macOS
    runs-on: macos-latest
    steps:
      - name: Install GHC
        run: |
          cd $(mktemp -d)
          curl -sLO "https://downloads.haskell.org/~ghc/8.10.7/ghc-8.10.7-x86_64-apple-darwin.tar.xz"
          tar -xJf ghc-*.tar.xz
          cd ghc-*
          ./configure --prefix=/opt/ghc/8.10.7
          sudo make install
      - uses: actions/checkout@v2

      # We use linux dependencies
      - name: bootstrap.py
        run: |
          ghcup config set cache true
          ghcup install ghc 8.10.7
          python3 bootstrap/bootstrap.py -w $(ghcup whereis ghc 8.10.7) -d bootstrap/linux-8.10.7.json

      - name: Smoke test
        run: |
          _build/bin/cabal --version

      - uses: actions/upload-artifact@v2
        with:
          name: cabal-macos-bootstrapped
          path: _build/artifacts/*
