diff options
author | Calum Lind <calumlind+deluge@gmail.com> | 2021-07-24 18:30:45 +0200 |
---|---|---|
committer | Calum Lind <calumlind+deluge@gmail.com> | 2021-07-25 14:27:26 +0200 |
commit | e5388048a95df6ba38d406043ec068928bd3dbcf (patch) | |
tree | 490abdc1b948ef2f1711b775d9ce90059f32eddd /.github/workflows | |
parent | [AutoAdd|3295] Correctly fix auto-adding magnets (diff) | |
download | deluge-e5388048a95df6ba38d406043ec068928bd3dbcf.tar.xz deluge-e5388048a95df6ba38d406043ec068928bd3dbcf.zip |
[CI/CD] Add github actions to replace Travis
Due to new limitations for open-source projects on Travis we are
switching to GitHub actions.
* Notes about system site-packages
We had many problems with accessing system python packages on Travis for
libtorrent and GTK and the problems are harder on Github since there is
no more access. For now copying the python libtorrent binary into the
deluge source is the workaround. There is a pip package that could be
used in future.
Fixed failing tests with libtorrent 1.2 which required a non-zero length
file in torrent and workarounds for async alert delay.
Diffstat (limited to '.github/workflows')
-rw-r--r-- | .github/workflows/ci.yml | 90 | ||||
-rw-r--r-- | .github/workflows/docs.yml | 45 | ||||
-rw-r--r-- | .github/workflows/lint.yml | 17 |
3 files changed, 152 insertions, 0 deletions
diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 000000000..d43dffa65 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,90 @@ +name: Deluge CI + +on: + push: + pull_request: + + # Allows you to run this workflow manually from the Actions tab + workflow_dispatch: + +jobs: + test-linux: + runs-on: ubuntu-20.04 + + 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: "3.8" + + - name: Cache pip + uses: actions/cache@v2 + with: + path: ~/.cache/pip + # 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: Add libtorrent deb repository + uses: myci-actions/add-deb-repo@8 + with: + repo: deb http://ppa.launchpad.net/libtorrent.org/1.2-daily/ubuntu focal main + repo-name: libtorrent + keys: 58E5430D9667FAEFFCA0B93F32309D6B9E009EDB + key-server: keyserver.ubuntu.com + install: python3-libtorrent + + - name: Install dependencies + run: | + pip install --upgrade pip wheel + pip install -r requirements.txt -r requirements-tests.txt + pip install -e . + + - name: Test with pytest + run: | + cp /usr/lib/python3/dist-packages/libtorrent*.so $GITHUB_WORKSPACE/deluge + python -c 'from deluge._libtorrent import lt; print(lt.__version__)'; + pytest -m "not (todo or gtkui or security)" deluge + + test-windows: + runs-on: windows-latest + + 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: "3.6" + + - 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: | + python -m pip install --upgrade pip wheel certifi + python -m pip install deluge-libtorrent + pip install -r requirements.txt -r requirements-tests.txt + pip install -e . + + - name: Test with pytest + run: | + python -c 'import libtorrent as lt; print(lt.__version__)'; + pytest -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 000000000..f2eaaaa1a --- /dev/null +++ b/.github/workflows/docs.yml @@ -0,0 +1,45 @@ +name: Deluge Documentation + +# 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@v2 + with: + fetch-depth: 0 + - uses: actions/setup-python@v2 + with: + python-version: "3.8" + - name: Cache pip + uses: actions/cache@v2 + with: + # This path is specific to Ubuntu + path: ~/.cache/pip + # Look to see if there is a cache hit for the corresponding requirements file + key: ${{ runner.os }}-pip-${{ hashFiles('requirements*.txt') }} + restore-keys: | + ${{ runner.os }}-pip- + ${{ runner.os }}- + + - name: Install dependencies + run: | + pip install --upgrade pip wheel + pip install tox + sudo apt-get install enchant + + - name: Test 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 000000000..e0792ac10 --- /dev/null +++ b/.github/workflows/lint.yml @@ -0,0 +1,17 @@ +name: Deluge 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@v2 + - uses: actions/setup-python@v2 + - name: Run pre-commit linting + uses: pre-commit/action@v2.0.2 |