mirror of
https://github.com/Hopiu/linkchecker.git
synced 2026-04-17 12:51:01 +00:00
GeoIP requires libGeoIP which tox deps cannot install. Likewise the GeoLiteCountry database which is also required by TestLocationInfo(). The last GeoIP release was in 2014, and libGeoIP has been EOL since 2022, but it is still available in Debian/Ubuntu.
208 lines
5.6 KiB
YAML
208 lines
5.6 KiB
YAML
# NB: this name is used in the status badge, where we want to see "build: passing"
|
|
name: build
|
|
permissions:
|
|
contents: read
|
|
|
|
on:
|
|
push:
|
|
branches:
|
|
- master
|
|
pull_request:
|
|
branches:
|
|
- master
|
|
workflow_dispatch: # allow manual triggering from GitHub UI
|
|
schedule:
|
|
- cron: "0 5 * * 6" # 5:00 UTC every Saturday
|
|
|
|
jobs:
|
|
build:
|
|
name: Python ${{ matrix.python-version }}
|
|
runs-on: ubuntu-latest
|
|
|
|
strategy:
|
|
matrix:
|
|
python-version:
|
|
- "3.10"
|
|
- "3.11"
|
|
- "3.12"
|
|
- "3.13"
|
|
toxenv: [py]
|
|
include:
|
|
- python-version: "3.9"
|
|
toxenv: minreqs
|
|
|
|
services:
|
|
httpbin:
|
|
image: kennethreitz/httpbin
|
|
ports:
|
|
- 8080:80
|
|
|
|
steps:
|
|
- name: Install OS dependencies
|
|
run: |
|
|
sudo apt-get update
|
|
sudo apt-get install -y clamav-daemon geoip-database libgeoip-dev gettext
|
|
|
|
- name: Make ClamAV cache directory writeable for cache action
|
|
run: |
|
|
sudo chown -R runner:docker /var/lib/clamav
|
|
|
|
- name: ClamAV cache
|
|
id: cache-clamav
|
|
uses: actions/cache@v4
|
|
with:
|
|
path: /var/lib/clamav
|
|
key: clamav-v1
|
|
|
|
- name: Restore ClamAV directory ownership
|
|
run: |
|
|
sudo chown -R clamav:clamav /var/lib/clamav
|
|
|
|
- name: Restart ClamAV Daemon
|
|
if: ${{ steps.cache-clamav.outputs.cache-hit == 'true' }}
|
|
run: |
|
|
sudo service clamav-daemon restart
|
|
|
|
- name: Download the ClamAV signature database
|
|
if: ${{ steps.cache-clamav.outputs.cache-hit != 'true' }}
|
|
run: |
|
|
sudo service clamav-freshclam stop
|
|
sudo freshclam
|
|
sudo service clamav-daemon restart
|
|
sudo service clamav-daemon status
|
|
|
|
- name: Git clone
|
|
uses: actions/checkout@v4
|
|
with:
|
|
show-progress: false
|
|
|
|
- name: Set up Python ${{ matrix.python-version }}
|
|
uses: actions/setup-python@v5
|
|
with:
|
|
python-version: "${{ matrix.python-version }}"
|
|
allow-prereleases: true
|
|
|
|
- name: Pip cache
|
|
uses: actions/cache@v4
|
|
with:
|
|
path: ~/.cache/pip
|
|
key: ${{ runner.os }}-pip-${{ matrix.python-version }}-${{ hashFiles('tox.ini', 'pyproject.toml') }}
|
|
restore-keys: |
|
|
${{ runner.os }}-pip-${{ matrix.python-version }}-
|
|
${{ runner.os }}-pip-
|
|
|
|
- name: Install Python dependencies
|
|
# coverage is required by coverallsapp/github-action
|
|
run: |
|
|
python -m pip install -U pip
|
|
python -m pip install -U hatchling hatch-vcs polib
|
|
python -m pip install -U tox coverage
|
|
|
|
- name: Wait for ClamAV to be ready
|
|
run: |
|
|
while ! test -S /run/clamav/clamd.ctl; do printf "."; sleep 1; done
|
|
|
|
- name: Run tests
|
|
run: |
|
|
python -m hatchling build -t sdist --hooks-only
|
|
python -m tox -e ${{ matrix.toxenv }}-geoip
|
|
|
|
- name: Report to coveralls
|
|
uses: coverallsapp/github-action@f350da2c033043742f89e8c0b7b5145a1616da6d # v2.1.2
|
|
with:
|
|
parallel: true
|
|
flag-name: run-${{ matrix.python-version }}
|
|
|
|
finish:
|
|
needs: build
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: Close coveralls parallel build
|
|
uses: coverallsapp/github-action@f350da2c033043742f89e8c0b7b5145a1616da6d # v2.1.2
|
|
with:
|
|
parallel-finished: true
|
|
|
|
docs:
|
|
# there's some overlap with publish-pages.yml, but this one runs on pull
|
|
# requests, doesn't publish, and runs more doc checks
|
|
name: docs
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
- name: Git clone
|
|
uses: actions/checkout@v4
|
|
with:
|
|
show-progress: false
|
|
|
|
- name: Install Ubuntu packages
|
|
run: |
|
|
sudo apt-get install -y graphviz mandoc
|
|
|
|
- name: Set up Python
|
|
uses: actions/setup-python@v5
|
|
with:
|
|
python-version: "3.x"
|
|
|
|
- name: Pip cache
|
|
uses: actions/cache@v4
|
|
with:
|
|
path: ~/.cache/pip
|
|
key: ${{ runner.os }}-pip-docs-${{ hashFiles('tox.ini') }}
|
|
restore-keys: |
|
|
${{ runner.os }}-pip-docs-
|
|
${{ runner.os }}-pip-
|
|
|
|
- name: Install Python packages
|
|
run: |
|
|
pip install -U dnspython beautifulsoup4 requests \
|
|
hatchling hatch-vcs sphinx sphinx-epytext \
|
|
sphinx-intl sphinx-rtd-theme sphinx-sitemap
|
|
|
|
- name: Build
|
|
run: |
|
|
python3 -m hatchling build -t sdist --hooks-only
|
|
make -C doc html
|
|
make -C doc locale
|
|
make -C doc man
|
|
make -C doc check
|
|
|
|
lint:
|
|
name: ${{ matrix.toxenv }}
|
|
runs-on: ubuntu-latest
|
|
|
|
strategy:
|
|
matrix:
|
|
toxenv:
|
|
- flake8
|
|
- check-python-versions
|
|
- pylint
|
|
- yamllint
|
|
|
|
steps:
|
|
- name: Git clone
|
|
uses: actions/checkout@v4
|
|
with:
|
|
show-progress: false
|
|
|
|
- name: Set up Python
|
|
uses: actions/setup-python@v5
|
|
with:
|
|
python-version: "3.x"
|
|
|
|
- name: Pip cache
|
|
uses: actions/cache@v4
|
|
with:
|
|
path: ~/.cache/pip
|
|
key: ${{ runner.os }}-pip-${{ matrix.toxenv }}-${{ hashFiles('tox.ini') }}
|
|
restore-keys: |
|
|
${{ runner.os }}-pip-${{ matrix.toxenv }}-
|
|
${{ runner.os }}-pip-
|
|
|
|
- name: Install dependencies
|
|
run: |
|
|
python -m pip install -U pip
|
|
python -m pip install -U hatchling hatch-vcs polib
|
|
python -m pip install -U tox
|
|
|
|
- name: Run ${{ matrix.toxenv }}
|
|
run: python -m tox -e ${{ matrix.toxenv }}
|