Loading...
No commits yet
Not committed History
Blame
compilation-demo.yml • 2.2 KB
name: Compilation Demo

on:
  push:
    branches: [ main, develop ]
  pull_request:
    branches: [ main, develop ]
  workflow_dispatch:

concurrency:
  group: ${{ github.workflow }}-${{ github.ref }}
  cancel-in-progress: true

jobs:
  compile:
    runs-on: ubuntu-latest
    timeout-minutes: 20

    steps:
    - uses: actions/checkout@v4

    - name: Install dependencies
      run: |
        sudo apt-get update

        # Install Apptainer from PPA (for container support)
        sudo add-apt-repository -y ppa:apptainer/ppa 2>/dev/null || true
        sudo apt-get update 2>/dev/null || true
        sudo apt-get install -y apptainer 2>/dev/null || true

        # Always install TeXLive and required tools for native compilation
        echo "Installing TeXLive and dependencies for manuscript compilation..."
        sudo apt-get install -y texlive-full latexdiff ghostscript imagemagick perl parallel 2>/dev/null || \
        echo "Warning: Some dependencies may not be available"

    - name: Install Python dependencies
      run: |
        python3 -m pip install --upgrade pip
        pip install xlsx2csv csv2latex bibtexparser || echo "Warning: Some Python dependencies may not be available"

    - name: Compile manuscript
      run: ./compile.sh manuscript

    - name: Compile supplementary
      run: ./compile.sh supplementary --no-figs --no-diff

    - name: Compile revision
      run: ./compile.sh revision --no-figs --no-tables --draft

    - name: Verify all PDFs generated
      run: |
        FAIL=0
        for pdf in 01_manuscript/manuscript.pdf 02_supplementary/supplementary.pdf 03_revision/revision.pdf; do
          if [ -f "$pdf" ]; then
            SIZE=$(stat -c%s "$pdf" 2>/dev/null || stat -f%z "$pdf")
            echo "OK: $pdf ($SIZE bytes)"
          else
            echo "FAIL: $pdf not found"
            FAIL=1
          fi
        done
        exit $FAIL

    - name: Upload compiled PDFs
      uses: actions/upload-artifact@v4
      if: success()
      with:
        name: compiled-pdfs
        path: |
          01_manuscript/manuscript.pdf
          01_manuscript/manuscript_diff.pdf
          02_supplementary/supplementary.pdf
          03_revision/revision.pdf
        retention-days: 30