From c3f7ed953c5071110e83897173ae34ddd395b3f0 Mon Sep 17 00:00:00 2001 From: Guillaume Ayoub Date: Sun, 23 Jul 2023 15:51:27 +0200 Subject: [PATCH] Add executable generation --- .github/workflows/exe.yml | 50 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 50 insertions(+) create mode 100644 .github/workflows/exe.yml diff --git a/.github/workflows/exe.yml b/.github/workflows/exe.yml new file mode 100644 index 000000000..b3d2a8020 --- /dev/null +++ b/.github/workflows/exe.yml @@ -0,0 +1,50 @@ +name: WeasyPrint’s exe generation +on: [push] + +jobs: + generate: + name: ${{ matrix.os }} + runs-on: ${{ matrix.os }} + strategy: + matrix: + os: ['ubuntu-20.04', 'macos-11', 'windows-2019'] + steps: + - uses: actions/checkout@v3 + - uses: actions/setup-python@v4 + with: + python-version: '3.11' + - name: Use absolute imports + if: matrix.os == 'ubuntu-20.04' + run: | + sed -i 's/^from \. /from weasyprint /' weasyprint/__main__.py + sed -i 's/^from \./from weasyprint\./' weasyprint/__main__.py + - name: Use absolute imports and install Pango (MacOS) + if: matrix.os == 'macos-11' + run: | + sed -i '' 's/^from \. /from weasyprint /' weasyprint/__main__.py + sed -i '' 's/^from \./from weasyprint\./' weasyprint/__main__.py + rm /usr/local/bin/2to3 + brew install pango + - name: Use absolute imports and install Pango (Windows) + if: matrix.os == 'windows-2019' + run: | + C:\msys64\usr\bin\bash -lc 'pacman -S mingw-w64-x86_64-pango mingw-w64-x86_64-sed --noconfirm' + C:\msys64\mingw64\bin\sed -i 's/^from \. /from weasyprint /' weasyprint/__main__.py + C:\msys64\mingw64\bin\sed -i 's/^from \./from weasyprint\./' weasyprint/__main__.py + 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 + - name: Test executable + run: dist/weasyprint --info + - name: Store executable + uses: actions/upload-artifact@v3 + with: + name: weasyprint-${{ matrix.os }} + path: | + dist/weasyprint + dist/weasyprint.exe + README.rst + LICENSE