| 1 |
# NB: this name is used in the status badge |
| 2 |
name: build |
| 3 |
|
| 4 |
on: |
| 5 |
push: |
| 6 |
branches: |
| 7 |
- master |
| 8 |
pull_request: |
| 9 |
branches: |
| 10 |
- master |
| 11 |
workflow_dispatch: |
| 12 |
schedule: |
| 13 |
- cron: "0 5 * * 6" # 5:00 UTC every Saturday |
| 14 |
|
| 15 |
jobs: |
| 16 |
build: |
| 17 |
name: Python ${{ matrix.python-version }} on ${{ matrix.os }}, ${{ matrix.vcs }} |
| 18 |
runs-on: ${{ matrix.os }} |
| 19 |
continue-on-error: ${{ matrix.python-version == 'pypy3.11' }} |
| 20 |
|
| 21 |
strategy: |
| 22 |
fail-fast: true |
| 23 |
matrix: |
| 24 |
python-version: |
| 25 |
- "3.10" |
| 26 |
- "3.11" |
| 27 |
- "3.12" |
| 28 |
- "3.13" |
| 29 |
- "3.14" |
| 30 |
- "pypy3.11" |
| 31 |
os: |
| 32 |
- ubuntu-22.04 # ubuntu-latest aka ubuntu-24.04 has busted bzr |
| 33 |
- windows-latest |
| 34 |
vcs: |
| 35 |
- bzr |
| 36 |
- git |
| 37 |
- hg |
| 38 |
- svn |
| 39 |
|
| 40 |
steps: |
| 41 |
- name: Install OS-level dependencies (Linux) |
| 42 |
# NB: at some point I'll want to switch from legacy Bazaar (apt package |
| 43 |
# bzr) to Breezy (apt package brz). They're both available in |
| 44 |
# ubuntu-18.04 and ubuntu-20.04. |
| 45 |
if: runner.os == 'Linux' |
| 46 |
run: | |
| 47 |
sudo apt-get install -y bzr git mercurial subversion |
| 48 |
|
| 49 |
- name: Install OS-level dependencies (Windows) |
| 50 |
if: runner.os == 'Windows' |
| 51 |
run: | |
| 52 |
choco install --no-progress bzr hg svn |
| 53 |
|
| 54 |
- name: Git clone |
| 55 |
uses: actions/checkout@v6 |
| 56 |
|
| 57 |
- name: Set up Python ${{ matrix.python-version }} |
| 58 |
uses: actions/setup-python@v6 |
| 59 |
with: |
| 60 |
python-version: "${{ matrix.python-version }}" |
| 61 |
cache: pip |
| 62 |
cache-dependency-path: | |
| 63 |
setup.py |
| 64 |
|
| 65 |
- name: Install Python dependencies |
| 66 |
run: | |
| 67 |
python -m pip install -U pip |
| 68 |
python -m pip install -U setuptools wheel |
| 69 |
python -m pip install -U coverage pytest flake8 |
| 70 |
python -m pip install -e .[test] |
| 71 |
|
| 72 |
- name: Run tests |
| 73 |
shell: bash |
| 74 |
run: | |
| 75 |
# It is utter nonsense that I have to do this |
| 76 |
case "$RUNNER_OS" in |
| 77 |
Windows) |
| 78 |
PATH=$PATH:"/c/Program Files (x86)/Bazaar" |
| 79 |
PATH=$PATH:"/c/Program Files (x86)/Subversion/bin" |
| 80 |
PATH=$PATH:"/c/Program Files/Mercurial" |
| 81 |
;; |
| 82 |
esac |
| 83 |
|
| 84 |
set -x |
| 85 |
|
| 86 |
git --version |
| 87 |
hg --version |
| 88 |
svn --version |
| 89 |
bzr --version |
| 90 |
|
| 91 |
coverage run -m pytest |
| 92 |
env: |
| 93 |
SKIP_NO_TESTS: "1" |
| 94 |
FORCE_TEST_VCS: ${{ matrix.vcs }} |
| 95 |
|
| 96 |
- name: Check test coverage |
| 97 |
run: | |
| 98 |
coverage xml |
| 99 |
coverage report -m --fail-under=${{ runner.os == 'Windows' && '98' || matrix.vcs == 'bzr' && 99 || 100 }} |
| 100 |
|
| 101 |
- name: Run check-manifest on itself |
| 102 |
run: python check_manifest.py |
| 103 |
|
| 104 |
- name: Report to coveralls |
| 105 |
uses: coverallsapp/github-action@v2 |
| 106 |
continue-on-error: true # coveralls is unreliable |
| 107 |
with: |
| 108 |
file: coverage.xml |
| 109 |
|
| 110 |
lint: |
| 111 |
name: ${{ matrix.toxenv }} |
| 112 |
runs-on: ubuntu-latest |
| 113 |
|
| 114 |
strategy: |
| 115 |
matrix: |
| 116 |
toxenv: |
| 117 |
- flake8 |
| 118 |
- mypy |
| 119 |
- isort |
| 120 |
- check-manifest |
| 121 |
- check-python-versions |
| 122 |
|
| 123 |
steps: |
| 124 |
- name: Git clone |
| 125 |
uses: actions/checkout@v6 |
| 126 |
|
| 127 |
- name: Set up Python ${{ env.default_python || '3.12' }} |
| 128 |
uses: actions/setup-python@v6 |
| 129 |
with: |
| 130 |
python-version: "${{ env.default_python || '3.12' }}" |
| 131 |
|
| 132 |
- name: Pip cache |
| 133 |
uses: actions/cache@v5 |
| 134 |
with: |
| 135 |
path: ~/.cache/pip |
| 136 |
key: ${{ runner.os }}-pip-${{ matrix.toxenv }}-${{ hashFiles('tox.ini', 'setup.py') }} |
| 137 |
restore-keys: | |
| 138 |
${{ runner.os }}-pip-${{ matrix.toxenv }}- |
| 139 |
${{ runner.os }}-pip- |
| 140 |
|
| 141 |
- name: Install dependencies |
| 142 |
run: | |
| 143 |
python -m pip install -U pip |
| 144 |
python -m pip install -U setuptools wheel |
| 145 |
python -m pip install -U tox |
| 146 |
|
| 147 |
- name: Run ${{ matrix.toxenv }} |
| 148 |
run: python -m tox -e ${{ matrix.toxenv }} |