From 63d9f928cd36202b149be297cc0a14d9c7fc834b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Albert=20=C3=96rwall?= Date: Wed, 31 Jul 2024 15:19:33 +0200 Subject: [PATCH] Testing --- .github/workflows/run-tests.yml | 28 +++++++++------------------- tests/conftest.py | 9 +++++++++ 2 files changed, 18 insertions(+), 19 deletions(-) diff --git a/.github/workflows/run-tests.yml b/.github/workflows/run-tests.yml index 84f4cec9..9e2c0857 100644 --- a/.github/workflows/run-tests.yml +++ b/.github/workflows/run-tests.yml @@ -10,9 +10,9 @@ jobs: test: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - name: Set up Python - uses: actions/setup-python@v4 + uses: actions/setup-python@v5 with: python-version: '3.10' - name: Install Poetry @@ -21,33 +21,23 @@ jobs: run: poetry install - name: Cache REPO_DIR - uses: actions/cache@v3 + uses: actions/cache@v4 with: - path: /tmp/repos - key: ${{ runner.os }}-repo-${{ github.sha }} - restore-keys: | - ${{ runner.os }}-repo- - - - name: Cache INDEX_STORE_DIR - uses: actions/cache@v3 - with: - path: /tmp/index-store - key: ${{ runner.os }}-index-store-${{ github.sha }} - restore-keys: | - ${{ runner.os }}-index-store- - + path: /tmp/cache + key: ${{ runner.os }}-moatless-${{ github.sha }} + - name: Run tests env: OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }} VOYAGE_API_KEY: ${{ secrets.VOYAGE_API_KEY }} INDEX_STORE_URL: ${{ vars.INDEX_STORE_URL }} - INDEX_STORE_DIR: /tmp/index-store + INDEX_STORE_DIR: /tmp/cache/index-store + REPO_DIR: /tmp/cache/repos MOATLESS_DIR: /tmp/moatless - REPO_DIR: /tmp/repos run: poetry run pytest - name: Upload MOATLESS_DIR contents - uses: actions/upload-artifact@v3 + uses: actions/upload-artifact@v4 if: ${{ success() && hashFiles('/tmp/moatless/**') != '' }} with: name: moatless-artifacts diff --git a/tests/conftest.py b/tests/conftest.py index a31d422d..2a5a72d7 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -50,6 +50,15 @@ def set_env_vars(monkeypatch, request): logger.debug(f"Setting REPO_DIR={repo_dir}") logger.debug(f"Setting MOATLESS_DIR={moatless_dir}") + if not os.path.exists(index_store_dir): + os.makedirs(index_store_dir) + + if not os.path.exists(repo_dir): + os.makedirs(repo_dir) + + if not os.path.exists(moatless_dir): + os.makedirs(moatless_dir) + monkeypatch.setenv("INDEX_STORE_DIR", index_store_dir) monkeypatch.setenv("REPO_DIR", repo_dir) monkeypatch.setenv("MOATLESS_DIR", moatless_dir)