Repository navigation
Test #248
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Test | |
| on: | |
| pull_request: | |
| push: | |
| branches: [main] | |
| workflow_dispatch: | |
| schedule: | |
| # Run tests at night during each Sunday | |
| - cron: "0 1 * * 0" | |
| jobs: | |
| test: | |
| name: Test Python ${{ matrix.python-version }} | |
| runs-on: ubuntu-latest | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| python-version: ["3.9", "3.10", "3.11", "3.12", "3.13"] | |
| services: | |
| opensearch: | |
| image: opensearchproject/opensearch:2.14.0 | |
| env: | |
| discovery.type: single-node | |
| OPENSEARCH_JAVA_OPTS: "-Xms1g -Xmx1g" | |
| DISABLE_SECURITY_PLUGIN: true | |
| DISABLE_INSTALL_DEMO_CONFIG: true | |
| cluster.name: test-cluster | |
| node.name: test-node | |
| bootstrap.memory_lock: false | |
| options: >- | |
| --health-cmd "curl -f http://localhost:9200/_cluster/health || exit 1" | |
| --health-interval 10s | |
| --health-timeout 5s | |
| --health-retries 30 | |
| ports: | |
| - 9200:9200 | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Install uv | |
| uses: astral-sh/setup-uv@v3 | |
| - name: Set up Python ${{ matrix.python-version }} | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: ${{ matrix.python-version }} | |
| - name: Install dependencies | |
| run: | | |
| uv sync --all-extras | |
| - name: Wait for OpenSearch | |
| run: | | |
| until curl -s http://localhost:9200/_cluster/health | grep -E '"status":"(yellow|green)"'; do | |
| echo "Waiting for OpenSearch..." | |
| sleep 5 | |
| done | |
| - name: Run tests | |
| env: | |
| TEST_OPENSEARCH_HOST: "http://localhost:9200" | |
| run: | | |
| uv run pytest -x | |
| - name: Run test coverage | |
| env: | |
| TEST_OPENSEARCH_HOST: "http://localhost:9200" | |
| run: | | |
| uv run pytest --cov --cov-report=xml --cov-config=pyproject.toml | |
| if: matrix.python-version == '3.11' | |
| - name: Upload coverage results | |
| uses: codecov/codecov-action@v4 | |
| with: | |
| file: ./coverage.xml | |
| fail_ci_if_error: false | |
| token: ${{ secrets.CODECOV_TOKEN }} | |
| if: matrix.python-version == '3.11' |