name: Build CPU miner

on: [push]

jobs:
  build:

    runs-on: ubuntu-18.04
    
    steps:
    - uses: actions/checkout@v1
    - name: Get static libcurl-dev package
      run: cd deps-linux64/ && ls && chmod +x ./deps-linux64.sh && ./deps-linux64.sh
    - name: Set-up autoconf
      run: chmod +x ./autogen.sh && ./autogen.sh
    - name: configure
      run: chmod +x ./configure && ./configure CFLAGS="-Wall -O2 -fomit-frame-pointer" LDFLAGS="-static" CXXFLAGS="$CFLAGS -std=gnu++11" --with-curl=/usr/local/ --with-crypto=/usr/local/ssl
    - name: make
      run: make
    - name: make check
      run: make check
    - name: CPU test
      run: ./nolambocoin-miner --help
    - name: Zips
      run: zip --junk-paths cpuminer nolambocoin-miner
    - name: Upload Release Asset
      id: upload-release-asset 
      uses: actions/upload-release-asset@v1
      env:
        GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
      with:
        upload_url: ${{ steps.get_release.outputs.upload_url }} 
        asset_path: ./cpuminer.zip
        asset_name: cpuminer.zip
        asset_content_type: application/zip
