| 1 |
name: Package |
| 2 |
|
| 3 |
on: |
| 4 |
push: |
| 5 |
tags: |
| 6 |
- "deluge-*" |
| 7 |
- "!deluge*-dev*" |
| 8 |
branches: |
| 9 |
- develop |
| 10 |
pull_request: |
| 11 |
types: [labeled, opened, synchronize, reopened] |
| 12 |
|
| 13 |
# Allows you to run this workflow manually from the Actions tab |
| 14 |
workflow_dispatch: |
| 15 |
inputs: |
| 16 |
ref: |
| 17 |
description: "Enter a tag or commit to package" |
| 18 |
default: "" |
| 19 |
|
| 20 |
jobs: |
| 21 |
windows_package: |
| 22 |
runs-on: windows-2022 |
| 23 |
timeout-minutes: 30 |
| 24 |
if: (github.event_name != 'pull_request' || contains(github.event.pull_request.labels.*.name, 'package')) |
| 25 |
strategy: |
| 26 |
matrix: |
| 27 |
arch: [x64] |
| 28 |
python: ["3.10"] |
| 29 |
libtorrent: [2.0.11, 1.2.19] |
| 30 |
|
| 31 |
steps: |
| 32 |
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it |
| 33 |
- uses: actions/checkout@v4 |
| 34 |
with: |
| 35 |
fetch-depth: 0 |
| 36 |
|
| 37 |
# Checkout Deluge source to subdir to enable packaging any tag/commit |
| 38 |
- name: Checkout Deluge source |
| 39 |
uses: actions/checkout@v4 |
| 40 |
with: |
| 41 |
ref: ${{ github.event.inputs.ref }} |
| 42 |
fetch-depth: 0 |
| 43 |
path: deluge_src |
| 44 |
|
| 45 |
- name: Set up Python |
| 46 |
uses: actions/setup-python@v5 |
| 47 |
with: |
| 48 |
python-version: ${{ matrix.python}} |
| 49 |
architecture: ${{ matrix.arch }} |
| 50 |
cache: pip |
| 51 |
|
| 52 |
- name: Prepare pip |
| 53 |
run: python -m pip install wheel setuptools==68.* |
| 54 |
- name: Install GTK |
| 55 |
run: | |
| 56 |
$WebClient = New-Object System.Net.WebClient |
| 57 |
$WebClient.DownloadFile("https://github.com/deluge-torrent/gvsbuild-release/releases/download/gvsbuild-2026.1.0-afc4141a/gvsbuild-py${{ matrix.python }}-vs17-${{ matrix.arch }}.zip","C:\GTK.zip") |
| 58 |
7z x C:\GTK.zip -oc:\GTK |
| 59 |
echo "C:\GTK\release\lib" | Out-File -FilePath $env:GITHUB_PATH -Append |
| 60 |
echo "C:\GTK\release\bin" | Out-File -FilePath $env:GITHUB_PATH -Append |
| 61 |
echo "C:\GTK\release" | Out-File -FilePath $env:GITHUB_PATH -Append |
| 62 |
python -m pip install --no-index --find-links="C:\GTK\release\python" pycairo PyGObject |
| 63 |
|
| 64 |
- name: Install Python dependencies |
| 65 |
# Pillow no longer provides 32-bit wheels for Windows |
| 66 |
# so specify only-binary to install old version. |
| 67 |
run: > |
| 68 |
python -m pip install |
| 69 |
--only-binary=pillow |
| 70 |
libtorrent==${{ matrix.libtorrent }} |
| 71 |
pyinstaller |
| 72 |
pygame |
| 73 |
-r requirements.txt |
| 74 |
|
| 75 |
- name: Install OpenSSL 1.1.1 |
| 76 |
run: | |
| 77 |
choco install openssl.light --version=1.1.1.20181020 |
| 78 |
|
| 79 |
- name: Verify libtorrent |
| 80 |
run: python -c 'import libtorrent as lt; print(lt.__version__)' |
| 81 |
|
| 82 |
- name: Patch Twisted |
| 83 |
shell: bash |
| 84 |
run: | |
| 85 |
# Find the site-packages where Twisted source installed |
| 86 |
SITE_PACKAGES=$(python -c "import sysconfig; print(sysconfig.get_path('purelib'))") |
| 87 |
echo "Site packages at: $SITE_PACKAGES" |
| 88 |
|
| 89 |
# Apply the patch |
| 90 |
cd "$SITE_PACKAGES" |
| 91 |
patch -p1 < "$GITHUB_WORKSPACE/.github/patches/twisted-glib-windows.patch" |
| 92 |
|
| 93 |
echo "Patch applied successfully" |
| 94 |
|
| 95 |
- name: Install Deluge |
| 96 |
working-directory: deluge_src |
| 97 |
run: | |
| 98 |
python -m pip install . |
| 99 |
python setup.py install_scripts |
| 100 |
|
| 101 |
- name: Freeze Deluge |
| 102 |
working-directory: packaging/win |
| 103 |
run: | |
| 104 |
pyinstaller --clean delugewin.spec --distpath freeze |
| 105 |
|
| 106 |
- name: Make Deluge Installer |
| 107 |
working-directory: ./packaging/win |
| 108 |
run: | |
| 109 |
python setup_nsis.py |
| 110 |
makensis /Darch=${{ matrix.arch }} deluge-win-installer.nsi |
| 111 |
|
| 112 |
- uses: actions/upload-artifact@v6 |
| 113 |
with: |
| 114 |
name: deluge-py${{ matrix.python }}-lt${{ matrix.libtorrent }}-${{ matrix.arch }} |
| 115 |
path: packaging/win/*.exe |
| 116 |
|
| 117 |
windows_verify: |
| 118 |
needs: windows_package |
| 119 |
runs-on: windows-2022 |
| 120 |
strategy: |
| 121 |
matrix: |
| 122 |
arch: [x64] |
| 123 |
python: ["3.10"] |
| 124 |
libtorrent: [2.0.11] |
| 125 |
steps: |
| 126 |
- name: Download installer |
| 127 |
uses: actions/download-artifact@v7 |
| 128 |
with: |
| 129 |
name: deluge-py${{ matrix.python }}-lt${{ matrix.libtorrent }}-${{ matrix.arch }} |
| 130 |
|
| 131 |
- name: Install Deluge |
| 132 |
run: Start-Process -Wait -FilePath (Get-Item *.exe).FullName -ArgumentList '/S' |
| 133 |
|
| 134 |
- name: Verify installed exes |
| 135 |
shell: bash |
| 136 |
run: | |
| 137 |
for exe in deluge-debug.exe deluged-debug.exe deluge-web-debug.exe deluge-console; do |
| 138 |
echo "Verifying $exe" |
| 139 |
"$PROGRAMFILES/Deluge/$exe" --version |
| 140 |
"$PROGRAMFILES/Deluge/$exe" --help |
| 141 |
done |