-
-
Notifications
You must be signed in to change notification settings - Fork 3
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
10 changed files
with
143 additions
and
15 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 |
---|---|---|
|
@@ -17,8 +17,10 @@ env: | |
|
||
jobs: | ||
lint: | ||
name: Linting | ||
name: Lint | ||
runs-on: ubuntu-latest | ||
permissions: | ||
contents: read | ||
steps: | ||
- | ||
uses: actions/checkout@v3 | ||
|
@@ -41,8 +43,10 @@ jobs: | |
uses: pre-commit/[email protected] | ||
|
||
test: | ||
name: Python ${{ matrix.python-version }} | ||
name: Test (Python ${{ matrix.python-version }}) | ||
runs-on: ubuntu-latest | ||
permissions: | ||
contents: read | ||
needs: | ||
- lint | ||
strategy: | ||
|
@@ -89,10 +93,12 @@ jobs: | |
docker compose --file ${GITHUB_WORKSPACE}/.docker/docker-compose.ci-test.yml down | ||
build: | ||
name: Build project | ||
name: Build | ||
runs-on: ubuntu-latest | ||
permissions: | ||
contents: read | ||
needs: | ||
- test | ||
- lint | ||
steps: | ||
- | ||
uses: actions/checkout@v3 | ||
|
@@ -118,14 +124,51 @@ jobs: | |
if-no-files-found: error | ||
retention-days: 7 | ||
|
||
publish: | ||
name: Publish project | ||
create-release: | ||
name: Release | ||
runs-on: ubuntu-latest | ||
if: startsWith(github.ref, 'refs/tags/') | ||
permissions: | ||
contents: write | ||
needs: | ||
- build | ||
- test | ||
steps: | ||
- | ||
uses: actions/checkout@v3 | ||
- | ||
uses: actions/download-artifact@v3 | ||
with: | ||
name: artifacts | ||
path: dist | ||
- | ||
name: Get latest release info | ||
id: query-release-info | ||
uses: release-flow/keep-a-changelog-action@v2 | ||
with: | ||
command: query | ||
version: ${{ github.ref_name }} | ||
- | ||
name: Display release info | ||
run: | | ||
echo "$Version: ${{ steps.query-release-info.outputs.version }}" | ||
echo "$Date: ${{ steps.query-release-info.outputs.release-date }}" | ||
echo "${{ steps.query-release-info.outputs.release-notes }}" | ||
- | ||
uses: ncipollo/release-action@v1 | ||
with: | ||
artifacts: "dist/*.tar.gz,dist/*.whl" | ||
body: ${{ steps.query-release-info.outputs.release-notes }} | ||
|
||
pypi-publish: | ||
name: Publish | ||
runs-on: ubuntu-latest | ||
if: startsWith(github.ref, 'refs/tags/') | ||
permissions: | ||
id-token: write # IMPORTANT: this permission is mandatory for trusted publishing | ||
needs: | ||
- build | ||
- test | ||
steps: | ||
- | ||
uses: actions/download-artifact@v3 | ||
|
@@ -134,4 +177,4 @@ jobs: | |
path: dist | ||
- | ||
name: Publish build to PyPI | ||
uses: pypa/[email protected].6 | ||
uses: pypa/[email protected].7 |
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 |
---|---|---|
@@ -1,5 +1,5 @@ | ||
# TODO | ||
|
||
- Create a mixin for some fields which seem often paired together, such as `dc:created` and `dc:modified` | ||
- Testing with sample email documents | ||
- Testing with the sample image documents | ||
- Add Github pages with more detailed documentation |
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 |
---|---|---|
@@ -1 +1 @@ | ||
__version__ = "0.2.0" | ||
__version__ = "0.3.0" |
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 |
---|---|---|
@@ -1,2 +1,5 @@ | ||
sample.jpg - https://unsplash.com/photos/8OyKWQgBsKQ | ||
sample.png - https://unsplash.com/photos/iar-afB0QQw | ||
|
||
microsoft-sample.docx - produced by Microsoft Office | ||
sample-libre-office.odt - produced by LibreOffice Writer 7.5.12 |
Binary file not shown.
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,31 @@ | ||
from datetime import datetime | ||
from datetime import timezone | ||
|
||
import magic | ||
|
||
from tests.conftest import SAMPLE_DIR | ||
from tika_client.client import TikaClient | ||
|
||
|
||
class TestLibreOfficeFormats: | ||
def test_parse_libre_office_writer_document(self, tika_client: TikaClient): | ||
test_file = SAMPLE_DIR / "sample-libre-office.odt" | ||
resp = tika_client.tika.as_html.from_file(test_file, magic.from_file(str(test_file), mime=True)) | ||
|
||
assert resp.type == "application/vnd.oasis.opendocument.text" | ||
assert ( | ||
"<body><p>This is a document created by LibreOffice Writer 7.5.12, on July 19th, 2023</p>\n</body>" | ||
in resp.content | ||
) | ||
assert resp.content_length == 11149 | ||
assert resp.created is not None | ||
assert resp.created == datetime( | ||
year=2023, | ||
month=7, | ||
day=19, | ||
hour=11, | ||
minute=30, | ||
second=44, | ||
microsecond=719000, | ||
tzinfo=timezone.utc, | ||
) |