fix: move imports to top-level in test file #29
Workflow file for this run
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: commit | |
| on: | |
| push: | |
| branches: [dev, main] | |
| pull_request: | |
| branches: [main] | |
| concurrency: | |
| group: ${{ github.workflow }}-${{ github.ref }} | |
| cancel-in-progress: true | |
| jobs: | |
| lint: | |
| name: Lint | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: checkout | |
| uses: actions/checkout@v4 | |
| - name: Install uv | |
| uses: astral-sh/setup-uv@v3 | |
| - name: Set up Python | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: '3.10' | |
| - name: Install dependencies | |
| run: uv pip install --system -e ".[dev]" | |
| - name: Run ruff | |
| run: ruff check . | |
| - name: Run mypy | |
| run: mypy contractions/ tests/ | |
| test: | |
| strategy: | |
| matrix: | |
| py-version: ['3.10', '3.11', '3.12', '3.13', '3.14'] | |
| fail-fast: false | |
| name: Pytest | |
| runs-on: ubuntu-latest | |
| needs: lint | |
| steps: | |
| - name: checkout | |
| uses: actions/checkout@v4 | |
| - name: Install uv | |
| uses: astral-sh/setup-uv@v3 | |
| - name: Set up Python | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: ${{ matrix.py-version }} | |
| - name: Install dependencies | |
| run: uv pip install --system -e ".[dev]" | |
| - name: Run pytest with coverage | |
| run: pytest tests/ --cov=contractions --cov-report=xml --cov-report=term | |
| - name: Upload coverage to Codecov | |
| if: matrix.py-version == '3.12' | |
| uses: codecov/codecov-action@v5 | |
| with: | |
| token: ${{ secrets.CODECOV_TOKEN }} | |
| file: ./coverage.xml | |
| fail_ci_if_error: false | |
| performance: | |
| name: Performance Benchmark | |
| runs-on: ubuntu-latest | |
| needs: lint | |
| steps: | |
| - name: checkout | |
| uses: actions/checkout@v4 | |
| - name: Install uv | |
| uses: astral-sh/setup-uv@v3 | |
| - name: Set up Python | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: '3.12' | |
| - name: Install package | |
| run: uv pip install --system -e . | |
| - name: Run performance tests | |
| run: python tests/test_performance.py |