Add: split and first mode, as well as tests for them #18
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: Run Unit Test via Pytest | |
| on: [push] | |
| jobs: | |
| build: | |
| runs-on: ubuntu-latest | |
| strategy: | |
| matrix: | |
| python-version: ["3.10", "3.11", "3.12", "3.13"] | |
| steps: | |
| - uses: actions/checkout@v3 | |
| - name: Set up Python ${{ matrix.python-version }} | |
| uses: actions/setup-python@v4 | |
| with: | |
| python-version: ${{ matrix.python-version }} | |
| - name: Bootstrap poetry | |
| run: | | |
| curl -sL https://install.python-poetry.org | python - -y | |
| - name: Update PATH | |
| run: echo "$HOME/.local/bin" >> $GITHUB_PATH | |
| - name: Configure poetry | |
| run: poetry config virtualenvs.in-project true | |
| - name: Set up cache | |
| uses: actions/cache@v3 | |
| id: cache | |
| with: | |
| path: .venv | |
| key: venv-${{ runner.os }}-${{ steps.full-python-version.outputs.version }}-${{ hashFiles('**/poetry.lock') }} | |
| - name: Ensure cache is healthy | |
| if: steps.cache.outputs.cache-hit == 'true' | |
| run: | | |
| # `timeout` is not available on macOS, so we define a custom function. | |
| [ "$(command -v timeout)" ] || function timeout() { perl -e 'alarm shift; exec @ARGV' "$@"; } | |
| # Using `timeout` is a safeguard against the Poetry command hanging for some reason. | |
| timeout 10s poetry run pip --version || rm -rf .venv | |
| - name: Install dependencies | |
| run: poetry install --with dev | |
| - name: Pre-commit hooks | |
| run: poetry run pre-commit run --all-files | |
| - name: Run pytest | |
| run: poetry run pytest --cov --cov-branch --cov-report=xml | |
| - name: Upload coverage reports to Codecov | |
| uses: codecov/codecov-action@v5 | |
| with: | |
| token: ${{ secrets.CODECOV_TOKEN }} |