| 1 |
name: CI |
| 2 |
|
| 3 |
on: |
| 4 |
push: |
| 5 |
pull_request: |
| 6 |
|
| 7 |
# Allows you to run this workflow manually from the Actions tab |
| 8 |
workflow_dispatch: |
| 9 |
inputs: |
| 10 |
core-dump: |
| 11 |
description: "Set to 1 to enable retrieving core dump from crashes" |
| 12 |
default: "0" |
| 13 |
|
| 14 |
env: |
| 15 |
UV_SYSTEM_PYTHON: 1 |
| 16 |
|
| 17 |
jobs: |
| 18 |
test-linux: |
| 19 |
runs-on: ubuntu-22.04 |
| 20 |
timeout-minutes: 10 |
| 21 |
strategy: |
| 22 |
matrix: |
| 23 |
python-version: ["3.10", "3.13"] |
| 24 |
|
| 25 |
steps: |
| 26 |
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it |
| 27 |
- uses: actions/checkout@v4 |
| 28 |
with: |
| 29 |
fetch-depth: 0 |
| 30 |
|
| 31 |
- name: Set up Python |
| 32 |
uses: actions/setup-python@v5 |
| 33 |
with: |
| 34 |
python-version: ${{ matrix.python-version }} |
| 35 |
|
| 36 |
- name: Install uv |
| 37 |
uses: astral-sh/setup-uv@v6 |
| 38 |
with: |
| 39 |
enable-cache: true |
| 40 |
|
| 41 |
- name: Sets env var for security |
| 42 |
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')) |
| 43 |
run: echo "SECURITY_TESTS=True" >> $GITHUB_ENV |
| 44 |
|
| 45 |
- name: Install dependencies |
| 46 |
run: | |
| 47 |
uv pip install -r requirements-ci.txt |
| 48 |
uv pip install -e . |
| 49 |
|
| 50 |
- name: Install security dependencies |
| 51 |
if: contains(env.SECURITY_TESTS, 'True') |
| 52 |
run: | |
| 53 |
wget -O- $TESTSSL_URL$TESTSSL_VER | tar xz |
| 54 |
mv -t deluge/tests/data testssl.sh-$TESTSSL_VER/testssl.sh testssl.sh-$TESTSSL_VER/etc/; |
| 55 |
env: |
| 56 |
TESTSSL_VER: 3.0.6 |
| 57 |
TESTSSL_URL: https://codeload.github.com/drwetter/testssl.sh/tar.gz/refs/tags/v |
| 58 |
|
| 59 |
- name: Setup core dump catch and store |
| 60 |
if: github.event.inputs.core-dump == '1' |
| 61 |
run: | |
| 62 |
sudo mkdir /cores/ && sudo chmod 777 /cores/ |
| 63 |
echo "/cores/%E.%p" | sudo tee /proc/sys/kernel/core_pattern |
| 64 |
ulimit -c unlimited |
| 65 |
sudo apt install glibc-tools |
| 66 |
echo "DEBUG_PREFIX=catchsegv python -X dev -m" >> $GITHUB_ENV |
| 67 |
|
| 68 |
- name: Test with pytest |
| 69 |
run: | |
| 70 |
python -c 'from deluge._libtorrent import lt; print(lt.__version__)'; |
| 71 |
$DEBUG_PREFIX pytest -v -m "not (todo or gtkui or internet)" deluge |
| 72 |
|
| 73 |
- uses: actions/upload-artifact@v4 |
| 74 |
# capture all crashes as build artifacts |
| 75 |
if: failure() |
| 76 |
with: |
| 77 |
name: crashes |
| 78 |
path: /cores |
| 79 |
|
| 80 |
test-windows: |
| 81 |
runs-on: windows-2022 |
| 82 |
timeout-minutes: 10 |
| 83 |
strategy: |
| 84 |
matrix: |
| 85 |
python-version: ["3.10"] |
| 86 |
|
| 87 |
steps: |
| 88 |
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it |
| 89 |
- uses: actions/checkout@v4 |
| 90 |
with: |
| 91 |
fetch-depth: 0 |
| 92 |
|
| 93 |
- name: Set up Python |
| 94 |
uses: actions/setup-python@v5 |
| 95 |
with: |
| 96 |
python-version: ${{ matrix.python-version }} |
| 97 |
|
| 98 |
- name: Install uv |
| 99 |
uses: astral-sh/setup-uv@v6 |
| 100 |
with: |
| 101 |
enable-cache: true |
| 102 |
|
| 103 |
- name: Install dependencies |
| 104 |
run: | |
| 105 |
uv pip install -r requirements-ci.txt |
| 106 |
uv pip install -e . |
| 107 |
|
| 108 |
- name: Install OpenSSL |
| 109 |
run: | |
| 110 |
choco install openssl.light --version=1.1.1.20181020 |
| 111 |
|
| 112 |
- name: Patch Twisted |
| 113 |
shell: bash |
| 114 |
run: | |
| 115 |
# Find the site-packages where Twisted source installed |
| 116 |
SITE_PACKAGES=$(python -c "import sysconfig; print(sysconfig.get_path('purelib'))") |
| 117 |
echo "Site packages at: $SITE_PACKAGES" |
| 118 |
|
| 119 |
cd "$SITE_PACKAGES" |
| 120 |
patch -p1 < "$GITHUB_WORKSPACE/.github/patches/twisted-glib-windows.patch" |
| 121 |
|
| 122 |
echo "Patch applied successfully" |
| 123 |
|
| 124 |
- name: Test with pytest |
| 125 |
run: | |
| 126 |
python -c 'import libtorrent as lt; print(lt.__version__)'; |
| 127 |
pytest -v -m "not (todo or gtkui or security or internet)" deluge |