340 lines
14 KiB
YAML
340 lines
14 KiB
YAML
name: CI
|
|
on:
|
|
push:
|
|
branches-ignore:
|
|
- 'update-dependencies'
|
|
- 'dependabot/*'
|
|
pull_request:
|
|
env:
|
|
FORCE_COLOR: "1"
|
|
PY_COLORS: "1"
|
|
MYPY_FORCE_TERMINAL_WIDTH: "180"
|
|
|
|
jobs:
|
|
linters:
|
|
if: "!contains(github.event.head_commit.message, '[ci skip]')"
|
|
timeout-minutes: 10
|
|
runs-on: ubuntu-24.04
|
|
strategy:
|
|
fail-fast: false
|
|
matrix:
|
|
include:
|
|
- testenv: pylint
|
|
- testenv: flake8
|
|
- testenv: mypy-pyqt6
|
|
- testenv: mypy-pyqt5
|
|
- testenv: docs
|
|
- testenv: vulture
|
|
- testenv: misc
|
|
- testenv: pyroma
|
|
- testenv: eslint
|
|
- testenv: shellcheck
|
|
args: "-f gcc" # For problem matchers
|
|
- testenv: yamllint
|
|
- testenv: actionlint
|
|
- testenv: package
|
|
steps:
|
|
- uses: actions/checkout@v6
|
|
with:
|
|
persist-credentials: false
|
|
- uses: actions/cache@v5
|
|
with:
|
|
path: |
|
|
.mypy_cache
|
|
.tox
|
|
~/.cache/pip
|
|
key: "${{ matrix.testenv }}-${{ hashFiles('misc/requirements/requirements-*.txt') }}-${{ hashFiles('requirements.txt') }}-${{ hashFiles('scripts/dev/pylint_checkers/qute_pylint/*.py') }}"
|
|
- uses: actions/setup-python@v6
|
|
with:
|
|
python-version: '3.10'
|
|
- uses: actions/setup-node@v6
|
|
with:
|
|
node-version: '22.x'
|
|
if: "matrix.testenv == 'eslint'"
|
|
- name: Set up problem matchers
|
|
run: "python scripts/dev/ci/problemmatchers.py ${{ matrix.testenv }} ${{ runner.temp }}"
|
|
- name: Install dependencies
|
|
run: |
|
|
[[ ${{ matrix.testenv }} == eslint ]] && npm install -g 'eslint@<9.0.0'
|
|
[[ ${{ matrix.testenv }} == docs ]] && sudo apt-get update && sudo apt-get install --no-install-recommends asciidoc libegl1
|
|
[[ ${{ matrix.testenv }} == vulture || ${{ matrix.testenv }} == pylint ]] && sudo apt-get update && sudo apt-get install --no-install-recommends libegl1
|
|
if [[ ${{ matrix.testenv }} == shellcheck ]]; then
|
|
scversion="stable"
|
|
bindir="$HOME/.local/bin"
|
|
mkdir -p "$bindir"
|
|
wget -qO- "https://github.com/koalaman/shellcheck/releases/download/$scversion/shellcheck-$scversion.linux.x86_64.tar.xz" | tar -xJv --strip-components 1 -C "$bindir" shellcheck-$scversion/shellcheck
|
|
echo "$bindir" >> "$GITHUB_PATH"
|
|
fi
|
|
if [[ ${{ matrix.testenv }} == actionlint ]]; then
|
|
bindir="$HOME/.local/bin"
|
|
mkdir -p "$bindir"
|
|
wget -q https://raw.githubusercontent.com/rhysd/actionlint/main/scripts/download-actionlint.bash
|
|
bash download-actionlint.bash latest "$bindir"
|
|
echo "$bindir" >> "$GITHUB_PATH"
|
|
fi
|
|
python -m pip install -U pip
|
|
python -m pip install -U -r misc/requirements/requirements-tox.txt
|
|
- name: "Run ${{ matrix.testenv }}"
|
|
run: |
|
|
if [[ -z "${{ matrix.args }}" ]]; then
|
|
dbus-run-session -- tox -e ${{ matrix.testenv }}
|
|
else
|
|
dbus-run-session -- tox -e ${{ matrix.testenv }} -- ${{ matrix.args }}
|
|
fi
|
|
|
|
tests-docker:
|
|
if: "!contains(github.event.head_commit.message, '[ci skip]')"
|
|
timeout-minutes: 45
|
|
runs-on: ubuntu-22.04 # not 24.04 because sandboxing fails by default (#8424)
|
|
strategy:
|
|
fail-fast: false
|
|
matrix:
|
|
include:
|
|
- testenv: py
|
|
image: archlinux-webengine
|
|
- testenv: py
|
|
image: archlinux-webengine-unstable
|
|
container:
|
|
image: "qutebrowser/ci:${{ matrix.image }}"
|
|
env:
|
|
DOCKER: "${{ matrix.image }}"
|
|
CI: true
|
|
PYTEST_ADDOPTS: "--color=yes"
|
|
TMPDIR: "${{ runner.temp }}"
|
|
volumes:
|
|
# Hardcoded because we can't use ${{ runner.temp }} here apparently.
|
|
- /home/runner/work/_temp/:/home/runner/work/_temp/
|
|
options: --privileged --tty
|
|
steps:
|
|
- uses: actions/checkout@v6
|
|
with:
|
|
persist-credentials: false
|
|
- name: Set up problem matchers
|
|
run: "python scripts/dev/ci/problemmatchers.py tests ${{ runner.temp }}"
|
|
- name: Run tox
|
|
run: "dbus-run-session -- tox -e ${{ matrix.testenv }}"
|
|
- name: Gather info
|
|
id: info
|
|
run: |
|
|
echo "date=$(date +'%Y-%m-%d')" >> "$GITHUB_OUTPUT"
|
|
echo "sha_short=$(git rev-parse --short HEAD)" >> "$GITHUB_OUTPUT"
|
|
shell: bash
|
|
if: failure()
|
|
- name: Upload screenshots
|
|
uses: actions/upload-artifact@v6
|
|
with:
|
|
name: "end2end-screenshots-${{ steps.info.outputs.date }}-${{ steps.info.outputs.sha_short }}-${{ matrix.image }}"
|
|
path: |
|
|
${{ runner.temp }}/pytest-of-user/pytest-current/pytest-screenshots/*.png
|
|
if-no-files-found: ignore
|
|
if: failure()
|
|
|
|
tests:
|
|
if: "!contains(github.event.head_commit.message, '[ci skip]')"
|
|
timeout-minutes: 45
|
|
# continue-on-error: "${{ matrix.experimental == true }}"
|
|
strategy:
|
|
fail-fast: false
|
|
matrix:
|
|
include:
|
|
### PyQt 5.15.2 (Python 3.9)
|
|
- testenv: py39-pyqt5152
|
|
os: ubuntu-22.04
|
|
python: "3.9"
|
|
### PyQt 5.15 (Python 3.10, with coverage)
|
|
# FIXME:qt6
|
|
# - testenv: py310-pyqt515-cov
|
|
# os: ubuntu-22.04
|
|
# python: "3.10"
|
|
### PyQt 5.15 (Python 3.11)
|
|
- testenv: py311-pyqt515
|
|
os: ubuntu-22.04
|
|
python: "3.11"
|
|
### PyQt 6.2 (Python 3.9)
|
|
- testenv: py39-pyqt62
|
|
os: ubuntu-22.04
|
|
python: "3.9"
|
|
### PyQt 6.3 (Python 3.9)
|
|
- testenv: py39-pyqt63
|
|
os: ubuntu-22.04
|
|
python: "3.9"
|
|
## PyQt 6.4 (Python 3.9)
|
|
- testenv: py39-pyqt64
|
|
os: ubuntu-22.04
|
|
python: "3.9"
|
|
### PyQt 6.5 (Python 3.10)
|
|
- testenv: py310-pyqt65
|
|
os: ubuntu-22.04
|
|
python: "3.10"
|
|
### PyQt 6.6 (Python 3.11)
|
|
- testenv: py311-pyqt66
|
|
os: ubuntu-22.04
|
|
python: "3.11"
|
|
### PyQt 6.6 (Python 3.12)
|
|
- testenv: py312-pyqt66
|
|
os: ubuntu-22.04
|
|
python: "3.12"
|
|
### PyQt 6.7 (Python 3.11)
|
|
- testenv: py311-pyqt67
|
|
os: ubuntu-22.04
|
|
python: "3.11"
|
|
### PyQt 6.7 (Python 3.12)
|
|
- testenv: py312-pyqt67
|
|
os: ubuntu-22.04
|
|
python: "3.12"
|
|
### PyQt 6.8 (Python 3.13)
|
|
- testenv: py313-pyqt68
|
|
os: ubuntu-24.04
|
|
python: "3.13"
|
|
### PyQt 6.8 (Python 3.13)
|
|
- testenv: py313-pyqt68
|
|
os: ubuntu-24.04
|
|
python: "3.13"
|
|
### PyQt 6.9 (Python 3.14)
|
|
- testenv: py314-pyqt69
|
|
os: ubuntu-24.04
|
|
python: "3.14"
|
|
### PyQt 6.10 (Python 3.14)
|
|
- testenv: py314-pyqt610
|
|
os: ubuntu-24.04
|
|
python: "3.14"
|
|
### macOS Sonoma (M1 runner)
|
|
- testenv: py314-pyqt610
|
|
os: macos-14
|
|
python: "3.14"
|
|
args: "tests/unit" # Only run unit tests on macOS
|
|
### macOS Sequoia (Intel runner)
|
|
- testenv: py314-pyqt610
|
|
os: macos-15-intel
|
|
python: "3.14"
|
|
args: "tests/unit" # Only run unit tests on macOS
|
|
### Windows
|
|
- testenv: py314-pyqt610
|
|
os: windows-2022
|
|
python: "3.14"
|
|
- testenv: py314-pyqt610
|
|
os: windows-2025
|
|
python: "3.14"
|
|
runs-on: "${{ matrix.os }}"
|
|
steps:
|
|
- uses: actions/checkout@v6
|
|
with:
|
|
persist-credentials: false
|
|
- uses: actions/cache@v5
|
|
with:
|
|
path: |
|
|
.mypy_cache
|
|
.tox
|
|
~/.cache/pip
|
|
key: "${{ matrix.testenv }}-${{ matrix.os }}-${{ matrix.python }}-${{ hashFiles('misc/requirements/requirements-*.txt') }}-${{ hashFiles('requirements.txt') }}"
|
|
- name: Set up Python
|
|
uses: actions/setup-python@v6
|
|
with:
|
|
python-version: "${{ matrix.python }}"
|
|
- name: Set up problem matchers
|
|
run: "python scripts/dev/ci/problemmatchers.py ${{ matrix.testenv }} ${{ runner.temp }}"
|
|
- name: Install apt dependencies
|
|
run: |
|
|
sudo apt-get update
|
|
sudo apt-get install --no-install-recommends libyaml-dev libegl1 libxkbcommon-x11-0 libxcb-icccm4 libxcb-image0 libxcb-keysyms1 libxcb-randr0 libxcb-render-util0 libxcb-xinerama0 libxcb-shape0 libxcb-cursor0 libjpeg-dev
|
|
if: "startsWith(matrix.os, 'ubuntu-')"
|
|
- name: Install dependencies
|
|
run: |
|
|
python -m pip install -U pip
|
|
python -m pip install -U -r misc/requirements/requirements-tox.txt
|
|
- name: Upgrade 3rd party assets
|
|
run: "tox exec -e ${{ matrix.testenv }} -- python scripts/dev/update_3rdparty.py --gh-token ${{ secrets.GITHUB_TOKEN }}"
|
|
if: "startsWith(matrix.os, 'windows-')"
|
|
- name: "Set TMPDIR for pytest"
|
|
run: 'echo "TMPDIR=${{ runner.temp }}" >> "$GITHUB_ENV"'
|
|
- name: "Run ${{ matrix.testenv }}"
|
|
run: "dbus-run-session -- tox -e ${{ matrix.testenv }} -- ${{ matrix.args }}"
|
|
if: "startsWith(matrix.os, 'ubuntu-')"
|
|
- name: "Run ${{ matrix.testenv }} without DBus"
|
|
run: "tox -e ${{ matrix.testenv }} -- ${{ matrix.args }}"
|
|
if: "!startsWith(matrix.os, 'ubuntu-')"
|
|
- name: Analyze backtraces
|
|
run: "bash scripts/dev/ci/backtrace.sh ${{ matrix.testenv }}"
|
|
if: "failure()"
|
|
- name: Upload coverage
|
|
if: "endsWith(matrix.testenv, '-cov')"
|
|
uses: codecov/codecov-action@v5
|
|
with:
|
|
name: "${{ matrix.testenv }}"
|
|
- name: Gather info
|
|
id: info
|
|
run: |
|
|
echo "date=$(date +'%Y-%m-%d')" >> "$GITHUB_OUTPUT"
|
|
echo "sha_short=$(git rev-parse --short HEAD)" >> "$GITHUB_OUTPUT"
|
|
shell: bash
|
|
if: failure()
|
|
- name: Upload screenshots
|
|
uses: actions/upload-artifact@v6
|
|
with:
|
|
name: "end2end-screenshots-${{ steps.info.outputs.date }}-${{ steps.info.outputs.sha_short }}-${{ matrix.testenv }}-${{ matrix.os }}"
|
|
path: |
|
|
${{ runner.temp }}/pytest-of-runner/pytest-current/pytest-screenshots/*.png
|
|
if-no-files-found: ignore
|
|
if: failure()
|
|
|
|
codeql:
|
|
if: "!contains(github.event.head_commit.message, '[ci skip]')"
|
|
permissions:
|
|
security-events: write
|
|
timeout-minutes: 15
|
|
runs-on: ubuntu-24.04
|
|
steps:
|
|
- name: Checkout repository
|
|
uses: actions/checkout@v6
|
|
with:
|
|
persist-credentials: false
|
|
- name: Initialize CodeQL
|
|
uses: github/codeql-action/init@v4
|
|
with:
|
|
languages: javascript, python
|
|
queries: +security-extended
|
|
- name: Perform CodeQL Analysis
|
|
uses: github/codeql-action/analyze@v4
|
|
|
|
irc:
|
|
timeout-minutes: 2
|
|
continue-on-error: true
|
|
runs-on: ubuntu-24.04
|
|
needs: [linters, tests, tests-docker, codeql]
|
|
if: "always() && github.repository_owner == 'qutebrowser'"
|
|
steps:
|
|
- name: Send success IRC notification
|
|
uses: Gottox/irc-message-action@v2
|
|
if: "needs.linters.result == 'success' && needs.tests.result == 'success' && needs.tests-docker.result == 'success' && needs.codeql.result == 'success'"
|
|
with:
|
|
server: irc.libera.chat
|
|
channel: '#qutebrowser-bots'
|
|
nickname: qutebrowser-bot
|
|
message: "[${{ github.workflow }}] \u00033Success:\u0003 ${{ github.ref }} https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }} (@${{ github.actor }})"
|
|
- name: Send failure IRC notification
|
|
uses: Gottox/irc-message-action@v2
|
|
if: "needs.linters.result == 'failure' || needs.tests.result == 'failure' || needs.tests-docker.result == 'failure' || needs.codeql.result == 'failure'"
|
|
with:
|
|
server: irc.libera.chat
|
|
channel: '#qutebrowser-bots'
|
|
nickname: qutebrowser-bot
|
|
message: "[${{ github.workflow }}] \u00034FAIL:\u0003 ${{ github.ref }} https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }} (@${{ github.actor }})\n
|
|
linters: ${{ needs.linters.result }}, tests: ${{ needs.tests.result }}, tests-docker: ${{ needs.tests-docker.result }}, codeql: ${{ needs.codeql.result }}"
|
|
- name: Send skipped IRC notification
|
|
uses: Gottox/irc-message-action@v2
|
|
if: "needs.linters.result == 'skipped' || needs.tests.result == 'skipped' || needs.tests-docker.result == 'skipped' || needs.codeql.result == 'skipped'"
|
|
with:
|
|
server: irc.libera.chat
|
|
channel: '#qutebrowser-bots'
|
|
nickname: qutebrowser-bot
|
|
message: "[${{ github.workflow }}] \u00038Skipped:\u0003 ${{ github.ref }} https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }} (@${{ github.actor }})"
|
|
- name: Send cancelled IRC notification
|
|
uses: Gottox/irc-message-action@v2
|
|
if: "needs.linters.result == 'cancelled' || needs.tests.result == 'cancelled' || needs.tests-docker.result == 'cancelled' || needs.codeql.result == 'cancelled'"
|
|
with:
|
|
server: irc.libera.chat
|
|
channel: '#qutebrowser-bots'
|
|
nickname: qutebrowser-bot
|
|
message: "[${{ github.workflow }}] \u000314Cancelled:\u0003 ${{ github.ref }} https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }} (@${{ github.actor }})\n
|
|
linters: ${{ needs.linters.result }}, tests: ${{ needs.tests.result }}, tests-docker: ${{ needs.tests-docker.result }}, codeql: ${{ needs.codeql.result }}"
|