mirror of
https://github.com/yihong0618/bilingual_book_maker.git
synced 2025-06-05 19:15:34 +00:00
43 lines
1.4 KiB
YAML
43 lines
1.4 KiB
YAML
name: CI
|
|
|
|
on:
|
|
push:
|
|
branches: [ main ]
|
|
pull_request:
|
|
branches: [ main ]
|
|
workflow_dispatch:
|
|
|
|
env:
|
|
ACTIONS_ALLOW_UNSECURE_COMMANDS: true
|
|
OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }}
|
|
|
|
jobs:
|
|
testing:
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: actions/checkout@v3
|
|
- name: Get epub filename
|
|
run: |
|
|
EPUB_FILENAME_BASE=$(git log --diff-filter=A --name-only --pretty=format: | grep -E "^test_books/.*\.epub$" | head -n 1 | xargs -0 -I {} basename "{}" | sed 's/\.epub//')
|
|
echo "EPUB_FILENAME_BASE=$EPUB_FILENAME_BASE" >> $GITHUB_ENV
|
|
- name: install python 3.9
|
|
uses: actions/setup-python@v4
|
|
with:
|
|
python-version: '3.9'
|
|
cache: 'pip' # caching pip dependencies
|
|
- name: Check formatting (black)
|
|
run: |
|
|
pip install black
|
|
black . --check
|
|
- name: install python requirements
|
|
run: pip install -r requirements.txt
|
|
- name: make test ebook
|
|
if: env.OPENAI_API_KEY != null
|
|
run: python3 make_book.py --book_name "test_books/${{ env.EPUB_FILENAME_BASE}}.epub" --no_limit --test --test_num 5 --language zh-hans
|
|
- name: Rename and Upload ePub
|
|
if: env.OPENAI_API_KEY != null
|
|
uses: actions/upload-artifact@v2
|
|
with:
|
|
name: epub_output
|
|
path: "test_books/${{ env.EPUB_FILENAME_BASE }}_bilingual.epub"
|