name: build

on:
  push:
    branches:
      - '*'

jobs:

  ubuntu-22-04:
    runs-on: ubuntu-22.04
    steps:
    - uses: actions/checkout@master
    - name: Install-prerequisites
      run: sudo ./scripts/InstallPrerequisites-Ubuntu.sh
    - name: Build-ubuntu-22.04
      run: |
        lsb_release -a
        tar -cvf shasta-docs.tar --transform='s/docs/shastaDocs/' docs       
        mkdir shasta-build
        cd shasta-build 
        #cmake .. -DBUILD_ID="Shasta unreleased test build newer than release 0.14.0 at commit "$GITHUB_SHA
        cmake .. -DBUILD_ID="Shasta Release 0.14.0" 
        make -j 2 all
        make install/strip
        mv shasta-install shasta-Ubuntu-22.04
        tar -cvf shasta-Ubuntu-22.04.tar shasta-Ubuntu-22.04        
    - name: Test-ubuntu-22.04
      run: |
        sudo apt install gzip
        gunzip tests/TinyTest.fasta.gz
        shasta-build/shasta-Ubuntu-22.04/bin/shasta --config Nanopore-Sep2020 --input tests/TinyTest.fasta
        ls -l ShastaRun/Assembly.fasta
    - uses: actions/upload-artifact@master
      with:
        name: shasta-docs.tar
        path: shasta-docs.tar
    - uses: actions/upload-artifact@master
      with:
        name: shasta-Linux
        path: shasta-build/shasta-Ubuntu-22.04/bin/shasta
    - uses: actions/upload-artifact@master
      with:
        name: shasta-Ubuntu-22.04.tar
        path: shasta-build/shasta-Ubuntu-22.04.tar
    
  ubuntu-24-04:
    runs-on: ubuntu-24.04
    steps:
    - uses: actions/checkout@master
    - name: Install-prerequisites
      run: sudo ./scripts/InstallPrerequisites-Ubuntu.sh
    - name: Build-ubuntu-24.04
      run: |
        lsb_release -a
        tar -cvf shasta-docs.tar --transform='s/docs/shastaDocs/' docs       
        mkdir shasta-build
        cd shasta-build 
        # cmake .. -DBUILD_ID="Shasta unreleased test build newer than release 0.14.0 at commit "$GITHUB_SHA
        cmake .. -DBUILD_ID="Shasta Release 0.14.0" 
        make -j 2 all
        make install/strip
        mv shasta-install shasta-Ubuntu-24.04
        tar -cvf shasta-Ubuntu-24.04.tar shasta-Ubuntu-24.04        
    - name: Test-ubuntu-24.04
      run: |
        sudo apt install gzip
        gunzip tests/TinyTest.fasta.gz
        shasta-build/shasta-Ubuntu-24.04/bin/shasta --config Nanopore-Sep2020 --input tests/TinyTest.fasta
        ls -l ShastaRun/Assembly.fasta

