#
# THIS FILE IS GENERATED. SEE https://github.com/Chia-Network/chia-blockchain/tree/main/tests#readme
#
name: MacOS TEST_NAME Tests

on:
  push:
    branches:
      - main
    tags:
        - '**'
  pull_request:
    branches:
      - '**'

jobs:
  build:
    name: MacOS TEST_NAME Tests
    runs-on: ${{ matrix.os }}
    timeout-minutes: JOB_TIMEOUT
    strategy:
      fail-fast: false
      max-parallel: 4
      matrix:
        python-version: [3.8, 3.9]
        os: [macOS-latest]

    steps:
    - name: Cancel previous runs on the same branch
      if: ${{ github.ref != 'refs/heads/main' }}
      uses: styfle/cancel-workflow-action@0.9.1
      with:
        access_token: ${{ github.token }}

    - name: Checkout Code
      uses: actions/checkout@v2
      with:
        fetch-depth: 0

    - name: Setup Python environment
      uses: actions/setup-python@v2
      with:
        python-version: ${{ matrix.python-version }}

    - name: Create keychain for CI use
      run: |
        security create-keychain -p foo chiachain
        security default-keychain -s chiachain
        security unlock-keychain -p foo chiachain
        security set-keychain-settings -t 7200 -u chiachain

    - name: Get pip cache dir
      id: pip-cache
      run: |
        echo "::set-output name=dir::$(pip cache dir)"

    - name: Cache pip
      uses: actions/cache@v2.1.6
      with:
        # Note that new runners may break this https://github.com/actions/cache/issues/292
        path: ${{ steps.pip-cache.outputs.dir }}
        key: ${{ runner.os }}-pip-${{ hashFiles('**/setup.py') }}
        restore-keys: |
          ${{ runner.os }}-pip-

CHECKOUT_TEST_BLOCKS_AND_PLOTS

    - name: Link home directory
      run: |
        cd $HOME
        ln -s $GITHUB_WORKSPACE/.chia
        echo "$HOME/.chia"
        ls -al $HOME/.chia

    - name: Run install script
      env:
        INSTALL_PYTHON_VERSION: ${{ matrix.python-version }}
        BUILD_VDF_CLIENT: "N"
      run: |
        brew install boost
        sh install.sh

INSTALL_TIMELORD

    - name: Install developer requirements
      run: |
        . ./activate
        venv/bin/python -m pip install pytest pytest-asyncio pytest-xdist

    - name: Test TEST_NAME code with pytest
      run: |
        . ./activate
        ./venv/bin/py.test TEST_DIR -s -v --durations 0PYTEST_PARALLEL_ARGS
#
# THIS FILE IS GENERATED. SEE https://github.com/Chia-Network/chia-blockchain/tree/main/tests#readme
#
