From 39358c9550b330522f49e7a20d2c27fe76811f05 Mon Sep 17 00:00:00 2001 From: Guillaume Ayoub Date: Thu, 11 Jul 2024 15:14:41 +0200 Subject: [PATCH] WIP --- .github/workflows/doconfly.yml | 29 ------------ .github/workflows/test_samples.yml | 45 ------------------- .github/workflows/tests.yml | 47 -------------------- .github/workflows/{exe.yml => win-wheel.yml} | 23 ++++------ 4 files changed, 8 insertions(+), 136 deletions(-) delete mode 100644 .github/workflows/doconfly.yml delete mode 100644 .github/workflows/test_samples.yml delete mode 100644 .github/workflows/tests.yml rename .github/workflows/{exe.yml => win-wheel.yml} (57%) diff --git a/.github/workflows/doconfly.yml b/.github/workflows/doconfly.yml deleted file mode 100644 index c256435ff..000000000 --- a/.github/workflows/doconfly.yml +++ /dev/null @@ -1,29 +0,0 @@ -name: doconfly -on: - push: - branches: - - main - tags: - - "*" - -jobs: - doconfly: - name: doconfly job - runs-on: ubuntu-latest - env: - PORT: ${{ secrets.PORT }} - SSH_PRIVATE_KEY: ${{ secrets.SSH_PRIVATE_KEY }} - TAKOYAKI: ${{ secrets.TAKOYAKI }} - USER: ${{ secrets.USER }} - DOCUMENTATION_PATH: ${{ secrets.DOCUMENTATION_PATH }} - DOCUMENTATION_URL: ${{ secrets.DOCUMENTATION_URL }} - steps: - - run: | - which ssh-agent || ( apt-get update -y && apt-get install openssh-client -y ) - eval $(ssh-agent -s) - echo "$SSH_PRIVATE_KEY" | tr -d '\r' | ssh-add - - mkdir -p ~/.ssh - chmod 700 ~/.ssh - ssh-keyscan -p $PORT $TAKOYAKI >> ~/.ssh/known_hosts - chmod 644 ~/.ssh/known_hosts - ssh $USER@$TAKOYAKI -p $PORT "doconfly/doconfly.sh $GITHUB_REPOSITORY $GITHUB_REF $DOCUMENTATION_PATH $DOCUMENTATION_URL" diff --git a/.github/workflows/test_samples.yml b/.github/workflows/test_samples.yml deleted file mode 100644 index 614a22d1a..000000000 --- a/.github/workflows/test_samples.yml +++ /dev/null @@ -1,45 +0,0 @@ -name: WeasyPrint's samples tests -on: [push, pull_request] - -env: - REPORTS_FOLDER: 'report' - -jobs: - samples: - name: Generate samples - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v4 - - uses: actions/setup-python@v5 - with: - python-version: ${{ matrix.python-version }} - - name: Upgrade pip and setuptools - run: python -m pip install --upgrade pip setuptools - - name: Install requirements - run: python -m pip install . - - name: Clone samples repository - run: git clone https://github.com/CourtBouillon/weasyprint-samples.git - - name: Create output folder - run: mkdir ${{env.REPORTS_FOLDER}} - - name: Book classical - run: python -m weasyprint weasyprint-samples/book/book.html -s weasyprint-samples/book/book-classical.css ${{env.REPORTS_FOLDER}}/book-classical.pdf - - name: Book fancy - run: python -m weasyprint weasyprint-samples/book/book.html -s weasyprint-samples/book/book.css ${{env.REPORTS_FOLDER}}/book-fancy.pdf - - name: Invoice - run: python -m weasyprint weasyprint-samples/invoice/invoice.html ${{env.REPORTS_FOLDER}}/invoice.pdf - - name: Letter - run: python -m weasyprint weasyprint-samples/letter/letter.html ${{env.REPORTS_FOLDER}}/letter.pdf - - name: Poster - run: python -m weasyprint weasyprint-samples/poster/poster.html -s weasyprint-samples/poster/poster.css ${{env.REPORTS_FOLDER}}/poster.pdf - - name: Flyer - run: python -m weasyprint weasyprint-samples/poster/poster.html -s weasyprint-samples/poster/flyer.css ${{env.REPORTS_FOLDER}}/flyer.pdf - - name: Report - run: python -m weasyprint weasyprint-samples/report/report.html ${{env.REPORTS_FOLDER}}/report.pdf - - name: Ticket - run: python -m weasyprint weasyprint-samples/ticket/ticket.html ${{env.REPORTS_FOLDER}}/ticket.pdf - - name: Archive generated PDFs - uses: actions/upload-artifact@v3 - with: - name: generated-documents - path: ${{env.REPORTS_FOLDER}} - retention-days: 1 diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml deleted file mode 100644 index 3c09b2b00..000000000 --- a/.github/workflows/tests.yml +++ /dev/null @@ -1,47 +0,0 @@ -name: WeasyPrint's tests -on: [push, pull_request] - -jobs: - tests: - name: ${{ matrix.os }} - ${{ matrix.python-version }} - runs-on: ${{ matrix.os }} - strategy: - matrix: - os: [ubuntu-latest, macos-latest, windows-latest] - python-version: ['3.12'] - include: - - os: ubuntu-latest - python-version: '3.9' - - os: ubuntu-latest - python-version: 'pypy-3.9' - steps: - - uses: actions/checkout@v4 - - uses: actions/setup-python@v5 - with: - python-version: ${{ matrix.python-version }} - - name: Install DejaVu and Ghostscript (Ubuntu) - if: matrix.os == 'ubuntu-latest' - run: sudo apt-get update -y && sudo apt-get install fonts-dejavu ghostscript -y - - name: Install DejaVu, Pango and Ghostscript (MacOS) - if: matrix.os == 'macos-latest' - run: | - brew update - brew install --cask font-dejavu - brew install pango ghostscript - - name: Install DejaVu, Pango and Ghostscript (Windows) - if: matrix.os == 'windows-latest' - run: | - C:\msys64\usr\bin\bash -lc 'pacman -S mingw-w64-x86_64-ttf-dejavu mingw-w64-x86_64-pango mingw-w64-x86_64-ghostscript --noconfirm' - xcopy "C:\msys64\mingw64\share\fonts\TTF" "C:\Users\runneradmin\.fonts" /e /i - echo "C:\msys64\mingw64\bin" | Out-File -FilePath $env:GITHUB_PATH - rm C:\msys64\mingw64\bin\python.exe - - name: Upgrade pip and setuptools - run: python -m pip install --upgrade pip setuptools - - name: Install tests’ requirements - run: python -m pip install .[test] pytest-xdist - - name: Launch tests - run: python -m pytest -n auto - env: - DYLD_FALLBACK_LIBRARY_PATH: /opt/homebrew/lib - - name: Check coding style - run: python -m ruff check diff --git a/.github/workflows/exe.yml b/.github/workflows/win-wheel.yml similarity index 57% rename from .github/workflows/exe.yml rename to .github/workflows/win-wheel.yml index 40b167633..2ddfc4215 100644 --- a/.github/workflows/exe.yml +++ b/.github/workflows/win-wheel.yml @@ -1,4 +1,4 @@ -name: WeasyPrint’s exe generation +name: WeasyPrint’s wheel for Windows on: [push] jobs: @@ -18,17 +18,10 @@ jobs: echo "C:\msys64\mingw64\bin" | Out-File -FilePath $env:GITHUB_PATH rm C:\msys64\mingw64\bin\python.exe - name: Install requirements - run: python -m pip install . pyinstaller - - name: Generate executable - run: python -m PyInstaller weasyprint/__main__.py -n weasyprint -F --hidden-import "fontTools.ttLib.tables.V_A_R_C_" - - name: Test executable - run: dist/weasyprint --info - - name: Store executable - uses: actions/upload-artifact@v4 - with: - name: weasyprint-windows - path: | - dist/weasyprint - dist/weasyprint.exe - README.rst - LICENSE + run: python -m pip install . flit delvewheel + - name: Generate wheel + run: python -m flit build + - name: Include Harfbuzz DLL + run: python -m delvewheel repair --add-path="C:\msys64\mingw64\bin" --add-dll="harfbuzz-subset" "dist/weasyprint-62.3-py3-none-any.whl" + - name: Include dependencies + run: python -m delvewheel repair --add-path="C:\msys64\mingw64\bin"