name: test-lock

on:
  schedule:
    - cron: '0 19 * * *'  # Every 19:00 UTC = 12:00 PST

jobs:
  check-rebuild-lock:
    strategy:
      matrix:
        os: [ ubuntu-latest ]
        python-version: [ "3.8", "3.9", "3.10", "3.11" ]
    runs-on: ${{ matrix.os }}
    steps:
      - name: Check out OQpy
        uses: actions/checkout@v3

      - name: Set up Python ${{ matrix.python-version }}
        id: setup-python
        uses: actions/setup-python@v4
        with:
          python-version: ${{ matrix.python-version }}

      - name: Install poetry
        run: |
          make install-poetry poetry_version=1.5.1
          poetry --version
          poetry config virtualenvs.in-project true

      - name: Build lock file
        run: poetry lock

      - name: Install dependencies
        run: poetry install --no-root

      - name: Install OQpy using pip
        run: poetry run pip install .

      - name: Run pytest
        run: poetry run make check-tests
