ci.yml 6.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239
  1. # badge: https://github.com/borgbackup/borg/workflows/CI/badge.svg?branch=master
  2. name: CI
  3. on:
  4. push:
  5. branches: [ master ]
  6. paths:
  7. - '**.py'
  8. - '**.pyx'
  9. - '**.c'
  10. - '**.h'
  11. - '**.yml'
  12. - '**.toml'
  13. - '**.cfg'
  14. - '**.ini'
  15. - 'requirements.d/*'
  16. - '!docs/**'
  17. pull_request:
  18. branches: [ master ]
  19. paths:
  20. - '**.py'
  21. - '**.pyx'
  22. - '**.c'
  23. - '**.h'
  24. - '**.yml'
  25. - '**.toml'
  26. - '**.cfg'
  27. - '**.ini'
  28. - 'requirements.d/*'
  29. - '!docs/**'
  30. jobs:
  31. lint:
  32. runs-on: ubuntu-22.04
  33. timeout-minutes: 5
  34. steps:
  35. - uses: actions/checkout@v4
  36. - uses: chartboost/ruff-action@v1
  37. linux:
  38. needs: lint
  39. strategy:
  40. fail-fast: true
  41. matrix:
  42. include:
  43. - os: ubuntu-22.04
  44. python-version: '3.9'
  45. toxenv: mypy
  46. - os: ubuntu-22.04
  47. python-version: '3.11'
  48. toxenv: docs
  49. - os: ubuntu-22.04
  50. python-version: '3.9'
  51. toxenv: py39-fuse2
  52. - os: ubuntu-22.04
  53. python-version: '3.10'
  54. toxenv: py310-fuse3
  55. - os: ubuntu-22.04
  56. python-version: '3.11'
  57. toxenv: py311-fuse3
  58. - os: ubuntu-24.04
  59. python-version: '3.12'
  60. toxenv: py312-fuse3
  61. - os: ubuntu-24.04
  62. python-version: '3.13'
  63. toxenv: py313-fuse3
  64. env:
  65. TOXENV: ${{ matrix.toxenv }}
  66. runs-on: ${{ matrix.os }}
  67. timeout-minutes: 120
  68. steps:
  69. - uses: actions/checkout@v4
  70. with:
  71. # just fetching 1 commit is not enough for setuptools-scm, so we fetch all
  72. fetch-depth: 0
  73. - name: Set up Python ${{ matrix.python-version }}
  74. uses: actions/setup-python@v5
  75. with:
  76. python-version: ${{ matrix.python-version }}
  77. - name: Cache pip
  78. uses: actions/cache@v4
  79. with:
  80. path: ~/.cache/pip
  81. key: ${{ runner.os }}-pip-${{ hashFiles('requirements.d/development.txt') }}
  82. restore-keys: |
  83. ${{ runner.os }}-pip-
  84. ${{ runner.os }}-
  85. - name: Install Linux packages
  86. run: |
  87. sudo apt-get update
  88. sudo apt-get install -y pkg-config build-essential
  89. sudo apt-get install -y libssl-dev libacl1-dev libxxhash-dev liblz4-dev libzstd-dev
  90. sudo apt-get install -y libfuse-dev fuse || true # Required for Python llfuse module
  91. sudo apt-get install -y libfuse3-dev fuse3 || true # Required for Python pyfuse3 module
  92. - name: Install Python requirements
  93. run: |
  94. python -m pip install --upgrade pip setuptools wheel
  95. pip install -r requirements.d/development.txt
  96. - name: Install borgbackup
  97. run: |
  98. pip install -e .
  99. - name: run tox env
  100. env:
  101. XDISTN: "4"
  102. run: |
  103. # do not use fakeroot, but run as root. avoids the dreaded EISDIR sporadic failures. see #2482.
  104. #sudo -E bash -c "tox -e py"
  105. tox --skip-missing-interpreters
  106. - name: Upload coverage to Codecov
  107. uses: codecov/codecov-action@v4
  108. env:
  109. OS: ${{ runner.os }}
  110. python: ${{ matrix.python-version }}
  111. with:
  112. token: ${{ secrets.CODECOV_TOKEN }}
  113. env_vars: OS, python
  114. macOS:
  115. needs: linux
  116. strategy:
  117. fail-fast: true
  118. matrix:
  119. include:
  120. - os: macos-14
  121. python-version: '3.11'
  122. toxenv: py311-none # note: no fuse testing, due to #6099, see also #6196.
  123. env:
  124. # Configure pkg-config to use OpenSSL from Homebrew
  125. PKG_CONFIG_PATH: "/opt/homebrew/opt/openssl@3.0/lib/pkgconfig:$PKG_CONFIG_PATH"
  126. TOXENV: ${{ matrix.toxenv }}
  127. runs-on: ${{ matrix.os }}
  128. timeout-minutes: 180
  129. steps:
  130. - uses: actions/checkout@v4
  131. with:
  132. # just fetching 1 commit is not enough for setuptools-scm, so we fetch all
  133. fetch-depth: 0
  134. - name: Set up Python ${{ matrix.python-version }}
  135. uses: actions/setup-python@v5
  136. with:
  137. python-version: ${{ matrix.python-version }}
  138. - name: Cache pip
  139. uses: actions/cache@v4
  140. with:
  141. path: ~/.cache/pip
  142. key: ${{ runner.os }}-pip-${{ hashFiles('requirements.d/development.txt') }}
  143. restore-keys: |
  144. ${{ runner.os }}-pip-
  145. ${{ runner.os }}-
  146. - name: Install macOS packages
  147. run: |
  148. brew unlink pkg-config@0.29.2 || true
  149. brew bundle install
  150. - name: Install Python requirements
  151. run: |
  152. python -m pip install --upgrade pip setuptools wheel
  153. pip install -r requirements.d/development.txt
  154. - name: Install borgbackup
  155. env:
  156. # we already have that in the global env, but something is broken and overwrites that.
  157. # so, set it here, again.
  158. PKG_CONFIG_PATH: "/opt/homebrew/opt/openssl@3.0/lib/pkgconfig:$PKG_CONFIG_PATH"
  159. run: |
  160. pip install -ve .
  161. - name: run tox env
  162. env:
  163. # we already have that in the global env, but something is broken and overwrites that.
  164. # so, set it here, again.
  165. PKG_CONFIG_PATH: "/opt/homebrew/opt/openssl@3.0/lib/pkgconfig:$PKG_CONFIG_PATH"
  166. XDISTN: "6"
  167. run: |
  168. # do not use fakeroot, but run as root. avoids the dreaded EISDIR sporadic failures. see #2482.
  169. #sudo -E bash -c "tox -e py"
  170. tox --skip-missing-interpreters
  171. - name: Upload coverage to Codecov
  172. uses: codecov/codecov-action@v4
  173. env:
  174. OS: ${{ runner.os }}
  175. python: ${{ matrix.python-version }}
  176. with:
  177. token: ${{ secrets.CODECOV_TOKEN }}
  178. env_vars: OS, python
  179. windows:
  180. if: false # build temporary disabled
  181. runs-on: windows-latest
  182. timeout-minutes: 120
  183. needs: linux
  184. env:
  185. # Needed for setuptools < 70.2.0 to work, see: https://www.msys2.org/docs/python/#known-issues
  186. # SETUPTOOLS_USE_DISTUTILS: stdlib
  187. PY_COLORS: 1
  188. defaults:
  189. run:
  190. shell: msys2 {0}
  191. steps:
  192. - uses: actions/checkout@v4
  193. with:
  194. fetch-depth: 0
  195. - uses: msys2/setup-msys2@v2
  196. with:
  197. msystem: UCRT64
  198. update: true
  199. - name: Install dependencies
  200. run: ./scripts/msys2-install-deps development
  201. - name: Build
  202. run: |
  203. # build borg.exe
  204. pip install -e .
  205. pyinstaller -y scripts/borg.exe.spec
  206. # build sdist and wheel in dist/...
  207. python -m build
  208. - uses: actions/upload-artifact@v4
  209. with:
  210. name: borg-windows
  211. path: dist/borg.exe
  212. - name: Run tests
  213. run: |
  214. ./dist/borg.exe -V
  215. pytest -n4 --benchmark-skip -vv -rs -k "not remote"