Loading...
No commits yet
Not committed History
Blame
compile-test.yml • 4.6 KB
name: Compile Test

on:
  push:
    branches: [ main, develop ]
    paths:
      - '01_manuscript/**'
      - '02_supplementary/**'
      - '03_revision/**'
      - '00_shared/**'
      - 'scripts/shell/**'
      - 'config/**'
      - 'scripts/installation/requirements/**'
      - '.github/workflows/compile-test.yml'
  pull_request:
    branches: [ main, develop ]
    paths:
      - '01_manuscript/**'
      - '02_supplementary/**'
      - '03_revision/**'
      - '00_shared/**'
      - 'scripts/shell/**'
      - 'config/**'
      - 'scripts/installation/requirements/**'
      - '.github/workflows/compile-test.yml'

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

jobs:
  compile:
    runs-on: ubuntu-latest

    steps:
    - uses: actions/checkout@v4

    - name: Cache pip dependencies
      uses: actions/cache@v4
      with:
        path: ~/.cache/pip
        key: pip-${{ runner.os }}-xlsx2csv-csv2latex
        restore-keys: |
          pip-${{ runner.os }}-

    - name: Install dependencies
      run: |
        sudo apt-get update
        xargs sudo apt-get install -y < scripts/installation/requirements/system-debian.txt

        # Install yq (Go version)
        sudo wget -qO /usr/local/bin/yq \
          https://github.com/mikefarah/yq/releases/latest/download/yq_linux_amd64
        sudo chmod +x /usr/local/bin/yq

        # Install Python dependencies
        python3 -m pip install --upgrade pip
        pip install xlsx2csv csv2latex bibtexparser

    - name: Test compilation (full mode)
      run: |
        echo "Testing full compilation..."
        ./compile.sh manuscript

        # Verify PDF was generated
        if [ ! -f "01_manuscript/manuscript.pdf" ]; then
          echo "ERROR: manuscript.pdf not generated"
          exit 1
        fi

        # Verify PDF has reasonable size (> 10KB)
        SIZE=$(stat -f%z "01_manuscript/manuscript.pdf" 2>/dev/null || stat -c%s "01_manuscript/manuscript.pdf")
        if [ "$SIZE" -lt 10240 ]; then
          echo "ERROR: PDF too small ($SIZE bytes), likely corrupted"
          exit 1
        fi

        echo "✓ Full compilation successful: manuscript.pdf ($SIZE bytes)"

    - name: Test compilation (fast mode with --no_diff)
      run: |
        echo "Testing fast compilation mode..."
        ./compile.sh manuscript --no-figs --no-diff

        # Verify PDF was generated
        if [ ! -f "01_manuscript/manuscript.pdf" ]; then
          echo "ERROR: Fast mode PDF not generated"
          exit 1
        fi

        echo "✓ Fast mode compilation successful"

    - name: Test compilation (draft mode)
      run: |
        echo "Testing draft mode..."
        ./compile.sh manuscript --no-figs --no-tables --draft

        # Verify PDF was generated
        if [ ! -f "01_manuscript/manuscript.pdf" ]; then
          echo "ERROR: Draft mode PDF not generated"
          exit 1
        fi

        echo "✓ Draft mode compilation successful"

    - name: Test compilation (dark mode)
      run: |
        echo "Testing dark mode..."
        ./compile.sh manuscript --no-figs --no-tables --no-diff --dark-mode

        # Verify PDF was generated
        if [ ! -f "01_manuscript/manuscript.pdf" ]; then
          echo "ERROR: Dark mode PDF not generated"
          exit 1
        fi

        # Verify dark mode was injected
        if ! grep -q "dark_mode.tex" "01_manuscript/manuscript.tex"; then
          echo "ERROR: Dark mode styling not injected"
          exit 1
        fi

        echo "✓ Dark mode compilation successful"

    - name: Test supplementary compilation
      run: |
        echo "Testing supplementary compilation..."
        ./compile.sh supplementary --no-figs --no-diff

        # Verify PDF was generated
        if [ ! -f "02_supplementary/supplementary.pdf" ]; then
          echo "ERROR: Supplementary PDF not generated"
          exit 1
        fi

        echo "✓ Supplementary compilation successful"

    - name: Test revision compilation
      run: |
        echo "Testing revision compilation..."
        ./compile.sh revision --no-figs --no-tables --draft

        # Verify PDF was generated
        if [ ! -f "03_revision/revision.pdf" ]; then
          echo "ERROR: revision.pdf not generated"
          exit 1
        fi

        echo "✓ Revision compilation successful"

    - 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
        if-no-files-found: warn