summaryrefslogtreecommitdiffstats
path: root/.github/workflows
diff options
context:
space:
mode:
Diffstat (limited to '.github/workflows')
-rw-r--r--.github/workflows/cd.yml104
-rw-r--r--.github/workflows/ci.yml101
-rw-r--r--.github/workflows/docs.yml38
-rw-r--r--.github/workflows/lint.yml17
4 files changed, 260 insertions, 0 deletions
diff --git a/.github/workflows/cd.yml b/.github/workflows/cd.yml
new file mode 100644
index 0000000..8ef9010
--- /dev/null
+++ b/.github/workflows/cd.yml
@@ -0,0 +1,104 @@
+name: Package
+
+on:
+ push:
+ tags:
+ - "deluge-*"
+ - "!deluge*-dev*"
+ branches:
+ - develop
+ pull_request:
+ types: [labeled, opened, synchronize, reopened]
+
+ # Allows you to run this workflow manually from the Actions tab
+ workflow_dispatch:
+ inputs:
+ ref:
+ description: "Enter a tag or commit to package"
+ default: ""
+
+jobs:
+ windows_package:
+ runs-on: windows-2022
+ if: (github.event_name != 'pull_request' || contains(github.event.pull_request.labels.*.name, 'package'))
+ strategy:
+ matrix:
+ arch: [x64, x86]
+ python: ["3.9"]
+ libtorrent: [2.0.7, 1.2.19]
+
+ steps:
+ # Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
+ - uses: actions/checkout@v3
+ with:
+ fetch-depth: 0
+
+ # Checkout Deluge source to subdir to enable packaging any tag/commit
+ - name: Checkout Deluge source
+ uses: actions/checkout@v3
+ with:
+ ref: ${{ github.event.inputs.ref }}
+ fetch-depth: 0
+ path: deluge_src
+
+ - name: Set up Python
+ uses: actions/setup-python@v4
+ with:
+ python-version: ${{ matrix.python}}
+ architecture: ${{ matrix.arch }}
+ cache: pip
+
+ - name: Prepare pip
+ run: python -m pip install wheel setuptools==68.*
+
+ - name: Install GTK
+ 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
+ echo "C:\GTK\release\lib" | Out-File -FilePath $env:GITHUB_PATH -Append
+ echo "C:\GTK\release\bin" | Out-File -FilePath $env:GITHUB_PATH -Append
+ echo "C:\GTK\release" | Out-File -FilePath $env:GITHUB_PATH -Append
+ python -m pip install --no-index --find-links="C:\GTK\release\python" pycairo PyGObject
+
+ - name: Install Python dependencies
+ # Pillow no longer provides 32-bit wheels for Windows
+ # so specify only-binary to install old version.
+ run: >
+ python -m pip install
+ --only-binary=pillow
+ twisted[tls]==22.8.0
+ libtorrent==${{ matrix.libtorrent }}
+ pyinstaller
+ pygame
+ -r requirements.txt
+
+ - name: Install Deluge
+ working-directory: deluge_src
+ run: |
+ python -m pip install .
+ python setup.py install_scripts
+
+ - name: Freeze Deluge
+ working-directory: packaging/win
+ run: |
+ pyinstaller --clean delugewin.spec --distpath freeze
+
+ - name: Verify Deluge exes
+ working-directory: packaging/win/freeze/Deluge/
+ run: |
+ deluge-debug.exe -v
+ deluged-debug.exe -v
+ deluge-web-debug.exe -v
+ deluge-console -v
+
+ - 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@v3
+ with:
+ name: deluge-py${{ matrix.python }}-lt${{ matrix.libtorrent }}-${{ matrix.arch }}
+ path: packaging/win/*.exe
diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
new file mode 100644
index 0000000..1f0675c
--- /dev/null
+++ b/.github/workflows/ci.yml
@@ -0,0 +1,101 @@
+name: CI
+
+on:
+ push:
+ pull_request:
+
+ # Allows you to run this workflow manually from the Actions tab
+ workflow_dispatch:
+ inputs:
+ core-dump:
+ description: "Set to 1 to enable retrieving core dump from crashes"
+ default: "0"
+jobs:
+ test-linux:
+ runs-on: ubuntu-22.04
+ strategy:
+ matrix:
+ python-version: ["3.7", "3.10"]
+
+ steps:
+ # Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
+ - uses: actions/checkout@v3
+ with:
+ fetch-depth: 0
+
+ - name: Set up Python
+ uses: actions/setup-python@v4
+ with:
+ python-version: ${{ matrix.python-version }}
+ cache: "pip"
+ cache-dependency-path: "requirements*.txt"
+
+ - name: Sets env var for security
+ if: (github.event_name == 'pull_request' && contains(github.event.pull_request.body, 'security_test')) || (github.event_name == 'push' && contains(github.event.head_commit.message, 'security_test'))
+ run: echo "SECURITY_TESTS=True" >> $GITHUB_ENV
+
+ - name: Install dependencies
+ run: |
+ pip install --upgrade pip wheel setuptools
+ pip install -r requirements-ci.txt
+ pip install -e .
+
+ - name: Install security dependencies
+ if: contains(env.SECURITY_TESTS, 'True')
+ run: |
+ wget -O- $TESTSSL_URL$TESTSSL_VER | tar xz
+ mv -t deluge/tests/data testssl.sh-$TESTSSL_VER/testssl.sh testssl.sh-$TESTSSL_VER/etc/;
+ env:
+ TESTSSL_VER: 3.0.6
+ TESTSSL_URL: https://codeload.github.com/drwetter/testssl.sh/tar.gz/refs/tags/v
+
+ - name: Setup core dump catch and store
+ if: github.event.inputs.core-dump == '1'
+ run: |
+ sudo mkdir /cores/ && sudo chmod 777 /cores/
+ echo "/cores/%E.%p" | sudo tee /proc/sys/kernel/core_pattern
+ ulimit -c unlimited
+ sudo apt install glibc-tools
+ echo "DEBUG_PREFIX=catchsegv python -X dev -m" >> $GITHUB_ENV
+
+ - name: Test with pytest
+ run: |
+ python -c 'from deluge._libtorrent import lt; print(lt.__version__)';
+ $DEBUG_PREFIX pytest -v -m "not (todo or gtkui)" deluge
+
+ - uses: actions/upload-artifact@v3
+ # capture all crashes as build artifacts
+ if: failure()
+ with:
+ name: crashes
+ path: /cores
+
+ test-windows:
+ runs-on: windows-2022
+ strategy:
+ matrix:
+ python-version: ["3.7", "3.10"]
+
+ steps:
+ # Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
+ - uses: actions/checkout@v3
+ with:
+ fetch-depth: 0
+
+ - name: Set up Python
+ uses: actions/setup-python@v4
+ with:
+ python-version: ${{ matrix.python-version }}
+ cache: "pip"
+ cache-dependency-path: "requirements*.txt"
+
+ - name: Install dependencies
+ run: |
+ pip install --upgrade pip wheel setuptools
+ pip install -r requirements-ci.txt
+ pip install -e .
+
+ - name: Test with pytest
+ run: |
+ python -c 'import libtorrent as lt; print(lt.__version__)';
+ pytest -v -m "not (todo or gtkui or security)" deluge
diff --git a/.github/workflows/docs.yml b/.github/workflows/docs.yml
new file mode 100644
index 0000000..9afa069
--- /dev/null
+++ b/.github/workflows/docs.yml
@@ -0,0 +1,38 @@
+name: Docs
+
+# Controls when the action will run.
+on:
+ # Triggers the workflow on push or pull request events but only for the main branch
+ push:
+ pull_request:
+
+ # Allows you to run this workflow manually from the Actions tab
+ workflow_dispatch:
+
+jobs:
+ build:
+ runs-on: ubuntu-latest
+
+ steps:
+ # Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
+ - uses: actions/checkout@v3
+ with:
+ fetch-depth: 0
+
+ - uses: actions/setup-python@v4
+ with:
+ python-version: "3.10"
+ cache: "pip"
+ cache-dependency-path: "requirements*.txt"
+
+ - name: Install dependencies
+ run: |
+ pip install --upgrade pip wheel
+ pip install tox
+ sudo apt-get install enchant-2
+
+ - name: Build docs with tox
+ env:
+ TOX_ENV: docs
+ run: |
+ tox -e $TOX_ENV
diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml
new file mode 100644
index 0000000..6c55c6b
--- /dev/null
+++ b/.github/workflows/lint.yml
@@ -0,0 +1,17 @@
+name: Linting
+
+on:
+ push:
+ pull_request:
+
+ # Allows you to run this workflow manually from the Actions tab
+ workflow_dispatch:
+
+jobs:
+ lint:
+ runs-on: ubuntu-latest
+ steps:
+ - uses: actions/checkout@v3
+ - uses: actions/setup-python@v4
+ - name: Run pre-commit linting
+ uses: pre-commit/action@v3.0.0