name: run_tests
on: [push]
jobs:
  all:
    runs-on: self-hosted
    steps:
      - uses: actions/checkout@v3

      - name: Install Manta from Source
        run: |
          # Make venv
          python3 -m venv venv/
          source venv/bin/activate

          # Update pip
          python3 -m pip install -U pip

          # omitting the following commmand causes the version of setuptools
          # used by python to get confused, and it doesn't detect the name
          # or version of the package from pyproject.toml - so the following
          # workaround is used:
          # https://github.com/pypa/setuptools/issues/3269#issuecomment-1254507377
          export DEB_PYTHON_INSTALL_LAYOUT=deb_system

          # Install Manta, with optional dev-only dependencies
          python3 -m pip install ".[dev]"

      - name: Run tests
        run:  |
          # export tool paths
          export VIVADO=/tools/Xilinx/Vivado/2023.1/bin/vivado
          export YOSYS=/tools/oss-cad-suite/bin/yosys
          export NEXTPNR_ICE40=/tools/oss-cad-suite/bin/nextpnr-ice40
          export ICEPACK=/tools/oss-cad-suite/bin/icepack
          export ICEPROG=/tools/oss-cad-suite/bin/iceprog

          source venv/bin/activate

          make test