Skip to content

Commit

Permalink
Merge branch 'main' of github.com:transloadit/python-sdk
Browse files Browse the repository at this point in the history
  • Loading branch information
cdr-chakotay committed Nov 28, 2024
2 parents d7debe6 + 2c91899 commit db2ea55
Show file tree
Hide file tree
Showing 7 changed files with 752 additions and 197 deletions.
57 changes: 51 additions & 6 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,24 +8,69 @@ jobs:
strategy:
matrix:
os: [ubuntu-latest, windows-latest]
python-version: ["3.9", "3.10", "3.11", "3.12"]
python-version: ['3.9', '3.10', '3.11', '3.12']

steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4

- uses: actions/setup-node@v4
with:
node-version: '20'
- name: Install tsx
run: npm install -g tsx

- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
architecture: x64
cache: "pip"
cache: 'pip'

- name: Install Poetry manager
- name: Install Poetry (Windows)
if: runner.os == 'Windows'
run: |
(Invoke-WebRequest -Uri https://install.python-poetry.org -UseBasicParsing).Content | python -
echo "$HOME\AppData\Roaming\Python\Scripts" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append
- name: Install Poetry (Unix)
if: runner.os != 'Windows'
run: pip install --upgrade poetry

- name: Install Dependencies
run: poetry install

- name: Test with pytest
- name: Test with coverage
if: matrix.os == 'ubuntu-latest' && matrix.python-version == '3.12'
run: |
poetry run pytest --cov=transloadit tests
poetry run pytest --cov=transloadit \
--cov-report=xml \
--cov-report=json \
--cov-report=html \
--cov-report=term-missing \
--cov-fail-under=65 \
tests
env:
TEST_NODE_PARITY: 1

- name: Test without coverage
if: matrix.os != 'ubuntu-latest' || matrix.python-version != '3.12'
run: poetry run pytest tests

- name: Upload coverage reports
if: matrix.os == 'ubuntu-latest' && matrix.python-version == '3.12'
uses: codecov/codecov-action@v4
with:
token: ${{ secrets.CODECOV_TOKEN }}
files: ./coverage.xml
flags: unittests
name: python-sdk
fail_ci_if_error: true

- name: Upload coverage artifacts
if: matrix.os == 'ubuntu-latest' && matrix.python-version == '3.12'
uses: actions/upload-artifact@v4
with:
name: coverage-reports
path: |
coverage.json
htmlcov/
31 changes: 31 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
[![Build status](https://github.com/transloadit/python-sdk/actions/workflows/ci.yml/badge.svg)](https://github.com/transloadit/python-sdk/actions/workflows/ci.yml)
[![Coverage](https://codecov.io/gh/transloadit/python-sdk/branch/main/graph/badge.svg)](https://codecov.io/gh/transloadit/python-sdk)

# Transloadit python-sdk

Expand Down Expand Up @@ -42,3 +43,33 @@ For fully working examples, take a look at [`examples/`](https://github.com/tran
## Documentation

See [readthedocs](https://transloadit.readthedocs.io) for full API documentation.

## Contributing

### Running tests

If you have a global installation of `poetry`, you can run the tests with:

```bash
poetry run pytest --cov=transloadit tests
```

If you can't use a global installation of `poetry`, e.g. when using Nix Home Manager, you can create a Python virtual environment and install Poetry there:

```bash
python -m venv .venv && source .venv/bin/activate && pip install poetry && poetry install
```

Then to run the tests:

```bash
source .venv/bin/activate && poetry run pytest --cov=transloadit tests
```

Generate a coverage report with:

```bash
poetry run pytest --cov=transloadit --cov-report=html tests
```

Then view the coverage report locally by opening `htmlcov/index.html` in your browser.
Loading

0 comments on commit db2ea55

Please sign in to comment.