-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
8 changed files
with
392 additions
and
9 deletions.
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,85 @@ | ||
name: CI | ||
|
||
on: | ||
workflow_dispatch: | ||
pull_request: | ||
push: | ||
branches: | ||
- main | ||
- develop | ||
release: | ||
types: | ||
- published | ||
|
||
concurrency: | ||
group: ${{ github.workflow }}-${{ github.ref }} | ||
cancel-in-progress: true | ||
|
||
env: | ||
FORCE_COLOR: 3 | ||
|
||
jobs: | ||
pre-commit: | ||
name: Lint with pre-commit | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- uses: actions/setup-python@v4 | ||
with: | ||
python-version: 3.11 | ||
- uses: pre-commit/[email protected] | ||
|
||
checks: | ||
name: Check Python ${{ matrix.python-version }} on ${{ matrix.runs-on }} | ||
runs-on: ${{ matrix.runs-on }} | ||
needs: [pre-commit] | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
python-version: ["3.11", "3.12"] | ||
runs-on: [ubuntu-latest, macos-latest] | ||
|
||
steps: | ||
- uses: actions/checkout@v4 | ||
with: | ||
fetch-depth: 0 | ||
|
||
- uses: actions/setup-python@v5 | ||
with: | ||
python-version: ${{ matrix.python-version }} | ||
|
||
- name: Install package | ||
run: python -m pip install .[test] | ||
|
||
- name: Test package | ||
run: python -m pytest -ra --cov=batch_llm | ||
|
||
- name: Upload coverage report | ||
uses: codecov/[email protected] | ||
|
||
# dist: | ||
# name: Distribution build | ||
# runs-on: ubuntu-latest | ||
# needs: [pre-commit] | ||
|
||
# steps: | ||
# - uses: actions/checkout@v4 | ||
# with: | ||
# fetch-depth: 0 | ||
|
||
# - name: Build sdist and wheel | ||
# run: pipx run build | ||
|
||
# - uses: actions/upload-artifact@v4 | ||
# with: | ||
# path: dist | ||
|
||
# - name: Check products | ||
# run: pipx run twine check dist/* | ||
|
||
# - uses: pypa/[email protected] | ||
# if: github.event_name == 'release' && github.event.action == 'published' | ||
# with: | ||
# # Remember to generate this and set it in "GitHub Secrets" | ||
# user: __token__ | ||
# password: ${{ secrets.PYPI_API_TOKEN }} |
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
import os | ||
from pathlib import Path | ||
|
||
import pytest | ||
|
||
|
||
@pytest.fixture(autouse=True) | ||
def change_test_dir(request, monkeypatch): | ||
monkeypatch.chdir(request.fspath.dirname) | ||
|
||
|
||
@pytest.fixture() | ||
def temporary_data_folders(tmp_path): | ||
""" | ||
Creates a temporary folder structure for testing. | ||
Has the following structure: | ||
tmp_path | ||
├── data/ | ||
├── dummy_data/ | ||
├── test.txt | ||
""" | ||
# create data folders | ||
data_dir = Path(tmp_path / "data").mkdir() | ||
dummy_data_dir = Path(tmp_path / "dummy_data").mkdir() | ||
|
||
# create a txt file in the folder | ||
with open(Path(tmp_path / "test.txt"), "w") as f: | ||
f.write("test line") | ||
|
||
# store current working directory | ||
cwd = os.getcwd() | ||
|
||
# change to temporary directory | ||
os.chdir(tmp_path) | ||
|
||
yield data_dir, dummy_data_dir | ||
|
||
# change back to original directory | ||
os.chdir(cwd) |
Empty file.
Empty file.
Oops, something went wrong.