Skip to content

Commit

Permalink
💚 Build CI
Browse files Browse the repository at this point in the history
  • Loading branch information
Namgyu-Youn committed Jan 2, 2025
1 parent e36153b commit 55edeea
Show file tree
Hide file tree
Showing 7 changed files with 156 additions and 1,351 deletions.
75 changes: 75 additions & 0 deletions .github/workflows/ci.yml
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 }}
18 changes: 17 additions & 1 deletion .gitignore
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
25 changes: 25 additions & 0 deletions Dockerfile
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"]
1,350 changes: 0 additions & 1,350 deletions Visual_Instruction_Tuning.md

This file was deleted.

Binary file removed Visual_Instruction_Tuning.pdf
Binary file not shown.
8 changes: 8 additions & 0 deletions docker-compose.yml
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"]
31 changes: 31 additions & 0 deletions pyproject.toml
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"

0 comments on commit 55edeea

Please sign in to comment.