Mac E2A Test #185
This file contains hidden or 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: Mac E2A Test | |
on: | |
workflow_dispatch: | |
inputs: | |
wipeAndReinstall: | |
type: boolean | |
description: 'Wipe & Re-Install E2A' | |
pull_request: | |
branches: | |
- main | |
types: | |
- opened | |
- synchronize | |
- reopened | |
paths-ignore: | |
- CODE_OF_CONDUCT.md | |
- LICENSE | |
- README.md | |
- readme/** | |
- dockerfiles/** | |
- Notebooks/** | |
- .github/workflows/stale.yml | |
- .github/workflows/custom-command.yml | |
push: | |
branches: | |
- main | |
paths-ignore: | |
- CODE_OF_CONDUCT.md | |
- LICENSE | |
- README.md | |
- readme/** | |
- dockerfiles/** | |
- Notebooks/** | |
- .github/workflows/stale.yml | |
- .github/workflows/custom-command.yml | |
release: | |
types: | |
- published | |
jobs: | |
macos-E2A: | |
runs-on: [self-hosted, macos] | |
steps: | |
- name: Print runner info | |
shell: bash | |
run: | | |
echo "Running on:" | |
uname -a | |
sw_vers | |
- name: Wipe & Re-Install E2A | |
if: ${{ inputs.wipeAndReinstall }} | |
shell: bash | |
run: rm -rf ~/ebook2audiobook | |
- name: Clone ebook2audiobook | |
shell: bash | |
run: | | |
set -e | |
REPO_DIR=~/ebook2audiobook | |
REPO_URL="https://github.com/${{ github.repository }}" | |
IS_PR="${{ github.event_name == 'pull_request' }}" | |
BASE_REF="${{ github.event.pull_request.base.ref }}" | |
HEAD_REF="${{ github.event.pull_request.head.ref }}" | |
HEAD_SHA="${{ github.event.pull_request.head.sha }}" | |
TRIGGER_SHA="${{ github.sha }}" | |
FRESH_CLONE=0 | |
echo "==> Event: ${{ github.event_name }}" | |
echo "==> Repo: $REPO_URL" | |
# Clone or reuse | |
if [ -d "$REPO_DIR" ]; then | |
echo "==> Reusing existing repo" | |
cd "$REPO_DIR" | |
# Set correct remote and fix ambiguous refs | |
git remote set-url origin "$REPO_URL" | |
git remote set-head origin -a | |
git remote prune origin | |
git fetch --all --prune | |
echo "==> Cleaning working directory" | |
git reset --hard | |
else | |
echo "==> Cloning fresh" | |
git clone "$REPO_URL" "$REPO_DIR" | |
cd "$REPO_DIR" | |
git remote set-head origin -a | |
git remote prune origin | |
git fetch --all --prune | |
FRESH_CLONE=1 | |
fi | |
if [ "$IS_PR" = "true" ]; then | |
echo "==> PR detected: simulating GitHub merge (base: $BASE_REF ← head: $HEAD_REF)" | |
# Fetch both branches | |
git fetch origin "$BASE_REF":"origin/$BASE_REF" | |
git fetch origin "$HEAD_REF":"origin/$HEAD_REF" | |
# Reset to base branch | |
git checkout -B "$BASE_REF" "remotes/origin/$BASE_REF" | |
git reset --hard "origin/$BASE_REF" | |
# Merge PR source | |
if ! git merge --no-ff --no-edit "origin/$HEAD_REF"; then | |
echo "❌ Merge conflict simulating PR merge" | |
echo "❌ Initial merge failed, attempting cleanup of __pycache__ and retry..." | |
# Remove known __pycache__ dirs that may cause conflict | |
echo "==> Cleaning up untracked files like __pycache__" | |
git clean -ffd lib/ | |
# Retry the merge | |
if ! git merge --no-ff --no-edit "origin/$HEAD_REF"; then | |
echo "❌ Merge still failed after cleanup" | |
exit 1 | |
fi | |
fi | |
else | |
echo "==> Not a PR: checking out triggered commit directly" | |
git fetch origin "$TRIGGER_SHA" | |
git checkout --detach "$TRIGGER_SHA" | |
git reset --hard "$TRIGGER_SHA" | |
fi | |
echo "==> Final repo state:" | |
git status | |
git log -1 --oneline | |
if [ "$FRESH_CLONE" -eq 1 ]; then | |
echo "==> Running ./ebook2audiobook.sh --help because this was a fresh clone" | |
if ! ./ebook2audiobook.sh --help; then | |
echo "==> Attempting fallback with conda deactivation" | |
source "$(conda info --base 2>/dev/null)/etc/profile.d/conda.sh" 2>/dev/null && conda deactivate || true | |
./ebook2audiobook.sh --help | |
fi | |
else | |
echo "==> Skipping script run because repo already existed" | |
fi | |
- name: Create Audiobook Output folders for Artifacts | |
shell: bash | |
run: | | |
mkdir -p ~/ebook2audiobook/audiobooks/{PIPER,TACOTRON2,FAIRSEQ,UnFAIRSEQ,VITS,YOURTTS,XTTSv2,XTTSv2FineTune,BARK,PIPER} | |
find ~/ebook2audiobook/audiobooks/{PIPER,TACOTRON2,FAIRSEQ,UnFAIRSEQ,VITS,YOURTTS,XTTSv2,XTTSv2FineTune,BARK,PIPER} -mindepth 1 -exec rm -rf {} + | |
- name: Add set -e at beginning of ebook2audiobook.sh (for error passing) | |
shell: bash | |
run: | | |
echo "Adding set -e at beginning of ebook2audiobook.sh (for error passing)..." | |
cd ~/ebook2audiobook | |
source "$(conda info --base)/etc/profile.d/conda.sh" | |
conda deactivate | |
sed -i '' '1s;^;set -e\n;' ebook2audiobook.sh | |
- name: English KOKORO headless single test | |
shell: bash | |
run: | | |
echo "Running English KOKORO headless single test..." | |
cd ~/ebook2audiobook | |
source "$(conda info --base)/etc/profile.d/conda.sh" | |
conda deactivate | |
./ebook2audiobook.sh --headless --language eng --ebook "tools/workflow-testing/test1.txt" --tts_engine KOKORO --output_dir ~/ebook2audiobook/audiobooks/KOKORO | |
- name: English PIPER headless single test | |
shell: bash | |
run: | | |
echo "Running English PIPER headless single test..." | |
cd ~/ebook2audiobook | |
source "$(conda info --base)/etc/profile.d/conda.sh" | |
conda deactivate | |
./ebook2audiobook.sh --headless --language eng --ebook "tools/workflow-testing/test1.txt" --tts_engine PIPER --output_dir ~/ebook2audiobook/audiobooks/PIPER | |
- name: English TACOTRON2 Custom-Voice headless single test | |
shell: bash | |
run: | | |
echo "Running English TACOTRON2 Custom-Voice headless single test..." | |
cd ~/ebook2audiobook | |
source "$(conda info --base)/etc/profile.d/conda.sh" | |
conda deactivate | |
./ebook2audiobook.sh --headless --language eng --ebook "tools/workflow-testing/test1.txt" --tts_engine TACOTRON2 --voice "voices/eng/elder/male/DavidAttenborough.wav" --output_dir ~/ebook2audiobook/audiobooks/TACOTRON2 | |
- name: English FAIRSEQ Custom-Voice headless single test | |
shell: bash | |
run: | | |
echo "Running English FAIRSEQ Custom-Voice headless single test..." | |
cd ~/ebook2audiobook | |
source "$(conda info --base)/etc/profile.d/conda.sh" | |
conda deactivate | |
./ebook2audiobook.sh --headless --language eng --ebook "tools/workflow-testing/test1.txt" --tts_engine FAIRSEQ --voice "voices/eng/elder/male/DavidAttenborough.wav" --output_dir ~/ebook2audiobook/audiobooks/FAIRSEQ | |
- name: Unusual FAIRSEQ Custom-Voice headless single test | |
shell: bash | |
run: | | |
echo "Running Unusual FAIRSEQ Custom-Voice headless single test..." | |
cd ~/ebook2audiobook | |
source "$(conda info --base)/etc/profile.d/conda.sh" | |
conda deactivate | |
./ebook2audiobook.sh --headless --language urd-script_devanagari --ebook "tools/workflow-testing/urd-script_davanagari-test.txt" --tts_engine FAIRSEQ --voice "voices/eng/elder/male/DavidAttenborough.wav" --output_dir ~/ebook2audiobook/audiobooks/UnFAIRSEQ | |
- name: English VITS Custom-Voice headless single test | |
shell: bash | |
run: | | |
echo "Running English VITS Custom-Voice headless single test..." | |
cd ~/ebook2audiobook | |
source "$(conda info --base)/etc/profile.d/conda.sh" | |
conda deactivate | |
./ebook2audiobook.sh --headless --language eng --ebook "tools/workflow-testing/test1.txt" --tts_engine VITS --voice "voices/eng/elder/male/DavidAttenborough.wav" --output_dir ~/ebook2audiobook/audiobooks/VITS | |
- name: English YOURTTS Custom-Voice headless batch test | |
shell: bash | |
run: | | |
echo "Running English YOURTTS Custom-Voice headless batch test..." | |
cd ~/ebook2audiobook | |
source "$(conda info --base)/etc/profile.d/conda.sh" | |
conda deactivate | |
./ebook2audiobook.sh --headless --language eng --ebooks_dir "tools/workflow-testing" --tts_engine YOURTTS --voice "voices/eng/elder/male/DavidAttenborough.wav" --output_dir ~/ebook2audiobook/audiobooks/YOURTTS | |
- name: Default XTTSv2 headless Custom-Voice single test | |
shell: bash | |
run: | | |
echo "Running Default XTTSv2 headless Custom-Voice single test..." | |
cd ~/ebook2audiobook | |
source "$(conda info --base)/etc/profile.d/conda.sh" | |
conda deactivate | |
./ebook2audiobook.sh --headless --language eng --ebook "tools/workflow-testing/test1.txt" --tts_engine XTTSv2 --voice "voices/eng/elder/male/DavidAttenborough.wav" --output_dir ~/ebook2audiobook/audiobooks/XTTSv2 | |
- name: English XTTSv2 headless fine-tuned XTTSv2 model single test | |
shell: bash | |
run: | | |
echo "Running English XTTSv2 headless fine-tuned XTTSv2 model single test..." | |
cd ~/ebook2audiobook | |
source "$(conda info --base)/etc/profile.d/conda.sh" | |
conda deactivate | |
./ebook2audiobook.sh --headless --language eng --ebook "tools/workflow-testing/test1.txt" --tts_engine XTTSv2 --fine_tuned AiExplained --output_dir ~/ebook2audiobook/audiobooks/XTTSv2FineTune | |
- name: English BARK Custom-Voice headless single test | |
shell: bash | |
run: | | |
echo "Running English XTTSv2 headless fine-tuned XTTSv2 model single test..." | |
cd ~/ebook2audiobook | |
source "$(conda info --base)/etc/profile.d/conda.sh" | |
conda deactivate | |
./ebook2audiobook.sh --headless --language eng --ebook "tools/workflow-testing/test1.txt" --tts_engine BARK --voice "voices/eng/elder/male/DavidAttenborough.wav" --output_dir ~/ebook2audiobook/audiobooks/BARK | |
- name: Upload audiobooks folder artifact | |
if: always() | |
uses: actions/upload-artifact@v4 | |
with: | |
name: audiobooks | |
path: ~/ebook2audiobook/audiobooks |