summaryrefslogtreecommitdiffstats
path: root/.github/workflows/cd.yml
blob: 7485f225e237205a087cacb013769028626b5c71 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
name: CD

on:
  push:
    tags-ignore:
      - "*.dev0"
  pull_request:
    branches:
      - develop

  # Allows you to run this workflow manually from the Actions tab
  workflow_dispatch:

jobs:
  Build:
    runs-on: windows-latest
    strategy:
      matrix:
        arch: [x64, x86]
        python: [3.9]
        libtorrent: [1.2.15]

    steps:
      # Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
      - uses: actions/checkout@v2
        with:
          fetch-depth: 0

      - name: Set up Python
        uses: actions/setup-python@v2
        with:
          python-version: ${{ matrix.python}}
          architecture: ${{ matrix.arch }}

      - name: Cache pip
        uses: actions/cache@v2
        with:
          path: '%LOCALAPPDATA%\pip\Cache'
          # Look to see if there is a cache hit for the corresponding requirements file
          key: ${{ runner.os }}-pip-${{ hashFiles('tox.ini', 'setup.py', 'requirements*.txt') }}
          restore-keys: |
            ${{ runner.os }}-pip-
            ${{ runner.os }}-

      - name: Install dependencies
        run: |
          $WebClient = New-Object System.Net.WebClient
          $WebClient.DownloadFile("https://github.com/deluge-torrent/gvsbuild-release/releases/download/latest/gvsbuild-py${{ matrix.python }}-vs16-${{ matrix.arch }}.zip","C:\GTK.zip")
          7z x C:\GTK.zip -oc:\GTK
          $env:Path = "C:\GTK\release;C:\GTK\release\bin;C:\GTK\release\lib;$env:Path"
          python -m pip install --upgrade pip wheel
          $pycairopath = Get-Childitem –Path "C:\GTK\release\python\" -Include pycairo*.whl -File -Recurse -ErrorAction SilentlyContinue | select -expand FullName
          $PyGObjectpath = Get-Childitem –Path "C:\GTK\release\python\" -Include PyGObject*.whl -File -Recurse -ErrorAction SilentlyContinue | select -expand FullName
          pip install $pycairopath
          pip install $PyGObjectpath
          pip install https://github.com/doadin/twisted/releases/download/latest/Twisted-21.7.0.post0-py3-none-any.whl
          python -m pip install libtorrent==${{ matrix.libtorrent }}
          pip install -r requirements.txt
          pip install pyinstaller

      - name: Install Deluge
        run: |
          pip install .
          python setup.py install_scripts

      - name: Freeze Deluge
        run: |
          $env:Path = "C:\GTK\release;C:\GTK\release\bin;C:\GTK\release\lib;$env:Path"
          pyinstaller --clean $env:GITHUB_WORKSPACE\packaging\win\delugewin.spec --distpath $env:GITHUB_WORKSPACE\packaging\win\freeze

      - name: Fix OpenSSL For Libtorrent
        if: ${{ matrix.arch == 'x64' }}
        run: |
          Copy-Item -Path $env:GITHUB_WORKSPACE\packaging\win\freeze\Deluge\libssl-1_1.dll -Destination $env:GITHUB_WORKSPACE\packaging\win\freeze\Deluge\libssl-1_1-x64.dll
          Copy-Item -Path $env:GITHUB_WORKSPACE\packaging\win\freeze\Deluge\libcrypto-1_1.dll -Destination $env:GITHUB_WORKSPACE\packaging\win\freeze\Deluge\libcrypto-1_1-x64.dll

      - name: Make Deluge Installer
        working-directory: ./packaging/win
        run: |
          python setup_nsis.py
          makensis /Darch=${{ matrix.arch }} deluge-win-installer.nsi

      - uses: actions/upload-artifact@v2
        with:
          name: deluge-py${{matrix.python}}-lt${{matrix.libtorrent}}
          path: packaging/win/*.exe