-
Notifications
You must be signed in to change notification settings - Fork 0
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
1 parent
e36153b
commit 55edeea
Showing
7 changed files
with
156 additions
and
1,351 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,75 @@ | ||
name: CI/CD | ||
|
||
on: | ||
push: | ||
branches: [ main ] | ||
pull_request: | ||
branches: [ main ] | ||
|
||
jobs: | ||
test: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
|
||
- name: Set up Python | ||
uses: actions/setup-python@v4 | ||
with: | ||
python-version: '3.12' | ||
|
||
- name: Install system dependencies | ||
run: | | ||
sudo apt-get update | ||
sudo apt-get install -y tesseract-ocr poppler-utils | ||
- name: Install Poetry | ||
run: | | ||
curl -sSL https://install.python-poetry.org | python3 - | ||
- name: Configure Poetry | ||
run: | | ||
poetry config virtualenvs.create true | ||
poetry config virtualenvs.in-project true | ||
- name: Cache Poetry dependencies | ||
uses: actions/cache@v3 | ||
with: | ||
path: ./.venv | ||
key: ${{ runner.os }}-poetry-${{ hashFiles('poetry.lock') }} | ||
|
||
- name: Install dependencies | ||
run: poetry install | ||
|
||
- name: Run linting | ||
run: | | ||
poetry run black . --check | ||
poetry run isort . --check | ||
poetry run flake8 . | ||
- name: Run tests | ||
run: poetry run pytest | ||
|
||
build-and-push: | ||
needs: test | ||
if: github.event_name == 'push' && github.ref == 'refs/heads/main' | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
|
||
- name: Set up Docker Buildx | ||
uses: docker/setup-buildx-action@v2 | ||
|
||
- name: Login to Docker Hub | ||
uses: docker/login-action@v2 | ||
with: | ||
username: ${{ secrets.DOCKERHUB_USERNAME }} | ||
password: ${{ secrets.DOCKERHUB_TOKEN }} | ||
|
||
- name: Build and push | ||
uses: docker/build-push-action@v4 | ||
with: | ||
context: . | ||
push: true | ||
tags: | | ||
${{ secrets.DOCKERHUB_USERNAME }}/arxiv-to-obsidian:latest | ||
${{ secrets.DOCKERHUB_USERNAME }}/arxiv-to-obsidian:${{ github.sha }} |
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,17 @@ | ||
__pycache__ | ||
# Python | ||
__pycache__/ | ||
|
||
# Poetry | ||
poetry.lock | ||
|
||
# Virtual Environment | ||
.venv/ | ||
venv/ | ||
env/ | ||
|
||
# Logs | ||
*.log | ||
|
||
# OS | ||
.DS_Store | ||
Thumbs.db |
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,25 @@ | ||
FROM python:3.12-slim | ||
|
||
# Install system dependencies | ||
RUN apt-get update && apt-get install -y \ | ||
tesseract-ocr \ | ||
poppler-utils \ | ||
&& rm -rf /var/lib/apt/lists/* | ||
|
||
# Install Poetry | ||
RUN pip install poetry==1.7.1 | ||
|
||
# Set working directory | ||
WORKDIR /app | ||
|
||
# Copy project files | ||
COPY pyproject.toml poetry.lock* ./ | ||
COPY README.md ./ | ||
COPY scripts/ ./scripts/ | ||
|
||
# Install dependencies | ||
RUN poetry config virtualenvs.create false \ | ||
&& poetry install --no-interaction --no-root | ||
|
||
# Set the entrypoint | ||
ENTRYPOINT ["poetry", "run", "arxiv-to-obsidian"] |
This file was deleted.
Oops, something went wrong.
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,8 @@ | ||
version: '3.8' | ||
|
||
services: | ||
arxiv-to-obsidian: | ||
build: . | ||
volumes: | ||
- ./output:/app/output | ||
command: ["--output", "/app/output"] |
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 @@ | ||
[tool.poetry] | ||
name = "arxiv-to-obsidian" | ||
version = "0.1.0" | ||
description = "Convert arXiv papers to Obsidian notes" | ||
authors = ["Your Name <[email protected]>"] | ||
readme = "README.md" | ||
packages = [ | ||
{ include = "scripts" }, | ||
] | ||
|
||
[tool.poetry.dependencies] | ||
python = "^3.12" | ||
arxiv = "^1.4.2" | ||
pypdf = "^3.17.0" | ||
requests = "^2.31.0" | ||
pytesseract = "^0.3.10" | ||
pdf2image = "^1.16.3" | ||
pillow = "^10.1.0" | ||
|
||
[tool.poetry.group.dev.dependencies] | ||
pytest = "^7.4.0" | ||
black = "^23.7.0" | ||
isort = "^5.12.0" | ||
flake8 = "^6.1.0" | ||
|
||
[build-system] | ||
requires = ["poetry-core"] | ||
build-backend = "poetry.core.masonry.api" | ||
|
||
[tool.poetry.scripts] | ||
arxiv-to-obsidian = "scripts.main:main" |