| 1 | name: Run tests |
| 2 | |
| 3 | on: |
| 4 | pull_request: |
| 5 | |
| 6 | concurrency: |
| 7 | group: ${{ github.workflow }}-${{ github.ref_name }} |
| 8 | cancel-in-progress: true |
| 9 | |
| 10 | jobs: |
| 11 | test: |
| 12 | permissions: |
| 13 | contents: "read" |
| 14 | id-token: "write" |
| 15 | runs-on: ubuntu-latest |
| 16 | services: |
| 17 | falkordb: |
| 18 | image: falkordb/falkordb:latest |
| 19 | ports: |
| 20 | - 6379:6379 |
| 21 | ollama: |
| 22 | image: ollama/ollama:latest |
| 23 | ports: |
| 24 | - 1434:11434 |
| 25 | volumes: |
| 26 | - ollama:/root/.ollama |
| 27 | |
| 28 | steps: |
| 29 | - uses: actions/checkout@v4 |
| 30 | |
| 31 | - name: Set up Python |
| 32 | uses: actions/setup-python@v5 |
| 33 | with: |
| 34 | python-version: 3.x # Update with desired Python version |
| 35 | |
| 36 | - name: Cache Poetry virtualenv |
| 37 | id: cache |
| 38 | uses: actions/cache@v4 |
| 39 | with: |
| 40 | path: ~/.poetry/virtualenvs |
| 41 | key: ${{ runner.os }}-poetry-${{ hashFiles('poetry.lock') }} |
| 42 | restore-keys: | |
| 43 | ${{ runner.os }}-poetry- |
| 44 | |
| 45 | - id: "auth" |
| 46 | uses: "google-github-actions/auth@v2" |
| 47 | with: |
| 48 | credentials_json: ${{ secrets.GCP_SA_KEY }} |
| 49 | |
| 50 | - name: "Set up Cloud SDK" |
| 51 | uses: "google-github-actions/setup-gcloud@v2" |
| 52 | with: |
| 53 | version: ">= 363.0.0" |
| 54 | |
| 55 | - name: Install Poetry |
| 56 | if: steps.cache.outputs.cache-hit != true |
| 57 | run: | |
| 58 | curl -sSL https://install.python-poetry.org | python3 - |
| 59 | |
| 60 | - name: Install dependencies |
| 61 | run: poetry install |
| 62 | |
| 63 | - name: Run tests |
| 64 | env: |
| 65 | PROJECT_ID: ${{ secrets.PROJECT_ID }} |
| 66 | REGION: ${{ vars.REGION }} |
| 67 | OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }} |
| 68 | GOOGLE_API_KEY: ${{ secrets.GOOGLE_API_KEY }} |
| 69 | run: poetry run pytest |