Restructure, extract functions to utils with testing. Fix replace with _ #9
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
name: Build | |
on: | |
workflow_call: | |
push: | |
pull_request: | |
jobs: | |
build-english: | |
runs-on: ubuntu-22.04 | |
steps: | |
- name: Set up Git repository | |
uses: actions/checkout@v2 | |
- name: Setup Python3 | |
uses: actions/setup-python@v2 | |
with: | |
python-version: 3.12.1 | |
- name: Install pip dependencies | |
run: | | |
python -m pip install -r requirements.txt | |
- name: Create build and output folder | |
working-directory: ./src | |
run: | | |
mkdir -p build output | |
- name: Upload data as artifact | |
uses: actions/upload-artifact@v4 | |
with: | |
name: english-data | |
path: src/data/english | |
- name: Create format files with Python | |
working-directory: ./src | |
run: | | |
python format_english.py oxford_3000 | |
python format_english.py oxford_5000 | |
python format_english.py oxford_5000_exclusive | |
- name: Upload html as artifact | |
uses: actions/upload-artifact@v4 | |
with: | |
name: english-output-html | |
path: src/output/jxford_*.html | |
- name: Install wkthtmltopdf | |
run: | | |
sudo apt-get update && sudo apt-get install -y wkhtmltopdf | |
- name: Convert html to pdf with wkhtmltopdf | |
working-directory: ./src | |
run: | | |
wkhtmltopdf --user-style-sheet format/table.css output/oxford_3000_alphabetical.html output/oxford_3000_alphabetical.pdf | |
wkhtmltopdf --user-style-sheet format/table.css output/oxford_3000_by_cefr_shuffle.html output/oxford_3000_by_cefr_shuffle.pdf | |
wkhtmltopdf --user-style-sheet format/table.css output/oxford_3000_underscore_alphabetical.html output/oxford_3000_underscore_alphabetical.pdf | |
wkhtmltopdf --user-style-sheet format/table.css output/oxford_3000_underscore_by_cefr.html output/oxford_3000_underscore_by_cefr.pdf | |
wkhtmltopdf --user-style-sheet format/table.css output/oxford_3000_by_cefr.html output/oxford_3000_by_cefr.pdf | |
wkhtmltopdf --user-style-sheet format/table.css output/oxford_5000_alphabetical.html output/oxford_5000_alphabetical.pdf | |
wkhtmltopdf --user-style-sheet format/table.css output/oxford_5000_by_cefr.html output/oxford_5000_by_cefr.pdf | |
wkhtmltopdf --user-style-sheet format/table.css output/oxford_5000_by_cefr_shuffle.html output/oxford_5000_by_cefr_shuffle.pdf | |
wkhtmltopdf --user-style-sheet format/table.css output/oxford_5000_underscore_alphabetical.html output/oxford_5000_underscore_alphabetical.pdf | |
wkhtmltopdf --user-style-sheet format/table.css output/oxford_5000_underscore_by_cefr.html output/oxford_5000_underscore_by_cefr.pdf | |
wkhtmltopdf --user-style-sheet format/table.css output/oxford_5000_exclusive_alphabetical.html output/oxford_5000_exclusive_alphabetical.pdf | |
wkhtmltopdf --user-style-sheet format/table.css output/oxford_5000_exclusive_by_cefr.html output/oxford_5000_exclusive_by_cefr.pdf | |
wkhtmltopdf --user-style-sheet format/table.css output/oxford_5000_exclusive_by_cefr_shuffle.html output/oxford_5000_exclusive_by_cefr_shuffle.pdf | |
wkhtmltopdf --user-style-sheet format/table.css output/oxford_5000_exclusive_underscore_alphabetical.html output/oxford_5000_exclusive_underscore_alphabetical.pdf | |
wkhtmltopdf --user-style-sheet format/table.css output/oxford_5000_exclusive_underscore_by_cefr.html output/oxford_5000_exclusive_underscore_by_cefr.pdf | |
- name: Upload html-to-pdf as artifact | |
uses: actions/upload-artifact@v4 | |
with: | |
name: english-output-pdf-from-html | |
path: src/output/oxford*.pdf | |
- name: Create pdf with Latex | |
uses: xu-cheng/latex-action@v3 | |
with: | |
working_directory: src/format/english | |
latexmk_use_xelatex: true | |
root_file: | | |
*.tex | |
- name: Upload tex-to-pdf as artifact | |
uses: actions/upload-artifact@v4 | |
with: | |
name: english-output-pdf-from-tex | |
path: src/format/english/*.pdf | |
build-spanish: | |
runs-on: ubuntu-22.04 | |
steps: | |
- name: Set up Git repository | |
uses: actions/checkout@v2 | |
- name: Setup Python3 | |
uses: actions/setup-python@v2 | |
with: | |
python-version: 3.12.1 | |
- name: Install pip dependencies | |
run: | | |
python -m pip install -r requirements.txt | |
- name: Create build and output folder | |
working-directory: ./src | |
run: | | |
mkdir -p build output | |
- name: Upload data as artifact | |
uses: actions/upload-artifact@v4 | |
with: | |
name: spanish-data | |
path: data/spanish | |
- name: Create format files with Python | |
working-directory: ./src | |
run: | | |
python format_spanish.py spanish_3000 | |
python format_spanish.py spanish_5000 | |
- name: Upload html as artifact | |
uses: actions/upload-artifact@v4 | |
with: | |
name: spanish-output-html | |
path: src/output/spanish*.html | |
- name: Install wkthtmltopdf | |
run: | | |
sudo apt-get update && sudo apt-get install -y wkhtmltopdf | |
- name: Convert html to pdf with wkhtmltopdf | |
working-directory: ./src | |
run: | | |
wkhtmltopdf --user-style-sheet format/table.css output/spanish_3000_alphabetical.html output/spanish_3000_alphabetical.pdf | |
wkhtmltopdf --user-style-sheet format/table.css output/spanish_3000_shuffled.html output/spanish_3000_shuffled.pdf | |
wkhtmltopdf --user-style-sheet format/table.css output/spanish_3000_underscore_alphabetical.html output/spanish_3000_underscore_alphabetical.pdf | |
wkhtmltopdf --user-style-sheet format/table.css output/spanish_3000_underscore_by_cefr_alphabetical.html output/spanish_3000_underscore_by_cefr_alphabetical.pdf | |
wkhtmltopdf --user-style-sheet format/table.css output/spanish_3000_underscore_by_cefr_shuffled.html output/spanish_3000_underscore_by_cefr_shuffled.pdf | |
wkhtmltopdf --user-style-sheet format/table.css output/spanish_3000_underscore_shuffled.html output/spanish_3000_underscore_shuffled.pdf | |
wkhtmltopdf --user-style-sheet format/table.css output/spanish_5000_alphabetical.html output/spanish_5000_alphabetical.pdf | |
wkhtmltopdf --user-style-sheet format/table.css output/spanish_5000_shuffled.html output/spanish_5000_shuffled.pdf | |
wkhtmltopdf --user-style-sheet format/table.css output/spanish_5000_underscore_alphabetical.html output/spanish_5000_underscore_alphabetical.pdf | |
wkhtmltopdf --user-style-sheet format/table.css output/spanish_5000_underscore_by_cefr_alphabetical.html output/spanish_5000_underscore_by_cefr_alphabetical.pdf | |
wkhtmltopdf --user-style-sheet format/table.css output/spanish_5000_underscore_by_cefr_shuffled.html output/spanish_5000_underscore_by_cefr_shuffled.pdf | |
wkhtmltopdf --user-style-sheet format/table.css output/spanish_5000_underscore_shuffled.html output/spanish_5000_underscore_shuffled.pdf | |
- name: Upload html-to-pdf as artifact | |
uses: actions/upload-artifact@v4 | |
with: | |
name: spanish-output-pdf-from-html | |
path: src/output/spanish*.pdf | |
- name: Create pdf with Latex | |
uses: xu-cheng/latex-action@v3 | |
with: | |
working_directory: src/format/spanish | |
latexmk_use_xelatex: true | |
root_file: | | |
*.tex | |
- name: Upload tex-to-pdf as artifact | |
uses: actions/upload-artifact@v4 | |
with: | |
name: spanish-output-pdf-from-tex | |
path: src/format/spanish/*.pdf |