ci.yml 6.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245
  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.10'
  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.10'
  51. toxenv: py310-fuse2
  52. - os: ubuntu-22.04
  53. python-version: '3.11'
  54. toxenv: py311-fuse3
  55. - os: ubuntu-24.04
  56. python-version: '3.12'
  57. toxenv: py312-fuse3
  58. - os: ubuntu-24.04
  59. python-version: '3.13'
  60. toxenv: py313-fuse3
  61. env:
  62. TOXENV: ${{ matrix.toxenv }}
  63. runs-on: ${{ matrix.os }}
  64. timeout-minutes: 120
  65. steps:
  66. - uses: actions/checkout@v4
  67. with:
  68. # just fetching 1 commit is not enough for setuptools-scm, so we fetch all
  69. fetch-depth: 0
  70. - name: Set up Python ${{ matrix.python-version }}
  71. uses: actions/setup-python@v5
  72. with:
  73. python-version: ${{ matrix.python-version }}
  74. - name: Cache pip
  75. uses: actions/cache@v4
  76. with:
  77. path: ~/.cache/pip
  78. key: ${{ runner.os }}-pip-${{ hashFiles('requirements.d/development.txt') }}
  79. restore-keys: |
  80. ${{ runner.os }}-pip-
  81. ${{ runner.os }}-
  82. - name: Install Linux packages
  83. run: |
  84. sudo apt-get update
  85. sudo apt-get install -y pkg-config build-essential
  86. sudo apt-get install -y libssl-dev libacl1-dev libxxhash-dev liblz4-dev libzstd-dev
  87. sudo apt-get install -y libfuse-dev fuse || true # Required for Python llfuse module
  88. sudo apt-get install -y libfuse3-dev fuse3 || true # Required for Python pyfuse3 module
  89. - name: Install Python requirements
  90. run: |
  91. python -m pip install --upgrade pip setuptools wheel
  92. pip install -r requirements.d/development.txt
  93. - name: Install borgbackup
  94. run: |
  95. pip install -e .
  96. - name: run tox env
  97. env:
  98. XDISTN: "4"
  99. run: |
  100. # do not use fakeroot, but run as root. avoids the dreaded EISDIR sporadic failures. see #2482.
  101. #sudo -E bash -c "tox -e py"
  102. tox --skip-missing-interpreters
  103. - name: Upload coverage to Codecov
  104. uses: codecov/codecov-action@v4
  105. env:
  106. OS: ${{ runner.os }}
  107. python: ${{ matrix.python-version }}
  108. with:
  109. token: ${{ secrets.CODECOV_TOKEN }}
  110. env_vars: OS, python
  111. macOS:
  112. needs: linux
  113. strategy:
  114. fail-fast: true
  115. matrix:
  116. include:
  117. - os: macos-14
  118. python-version: '3.11'
  119. toxenv: py311-none # note: no fuse testing, due to #6099, see also #6196.
  120. env:
  121. # Configure pkg-config to use OpenSSL from Homebrew
  122. PKG_CONFIG_PATH: "/opt/homebrew/opt/openssl@3.0/lib/pkgconfig:$PKG_CONFIG_PATH"
  123. TOXENV: ${{ matrix.toxenv }}
  124. runs-on: ${{ matrix.os }}
  125. timeout-minutes: 180
  126. steps:
  127. - uses: actions/checkout@v4
  128. with:
  129. # just fetching 1 commit is not enough for setuptools-scm, so we fetch all
  130. fetch-depth: 0
  131. - name: Set up Python ${{ matrix.python-version }}
  132. uses: actions/setup-python@v5
  133. with:
  134. python-version: ${{ matrix.python-version }}
  135. - name: Cache pip
  136. uses: actions/cache@v4
  137. with:
  138. path: ~/.cache/pip
  139. key: ${{ runner.os }}-pip-${{ hashFiles('requirements.d/development.txt') }}
  140. restore-keys: |
  141. ${{ runner.os }}-pip-
  142. ${{ runner.os }}-
  143. - name: Install macOS packages
  144. run: |
  145. brew unlink pkg-config@0.29.2 || true
  146. brew bundle install
  147. - name: Install Python requirements
  148. run: |
  149. python -m pip install --upgrade pip setuptools wheel
  150. pip install -r requirements.d/development.txt
  151. - name: Install borgbackup
  152. env:
  153. # we already have that in the global env, but something is broken and overwrites that.
  154. # so, set it here, again.
  155. PKG_CONFIG_PATH: "/opt/homebrew/opt/openssl@3.0/lib/pkgconfig:$PKG_CONFIG_PATH"
  156. run: |
  157. pip install -ve .
  158. - name: run tox env
  159. env:
  160. # we already have that in the global env, but something is broken and overwrites that.
  161. # so, set it here, again.
  162. PKG_CONFIG_PATH: "/opt/homebrew/opt/openssl@3.0/lib/pkgconfig:$PKG_CONFIG_PATH"
  163. XDISTN: "6"
  164. run: |
  165. # do not use fakeroot, but run as root. avoids the dreaded EISDIR sporadic failures. see #2482.
  166. #sudo -E bash -c "tox -e py"
  167. tox --skip-missing-interpreters
  168. - name: Upload coverage to Codecov
  169. uses: codecov/codecov-action@v4
  170. env:
  171. OS: ${{ runner.os }}
  172. python: ${{ matrix.python-version }}
  173. with:
  174. token: ${{ secrets.CODECOV_TOKEN }}
  175. env_vars: OS, python
  176. windows:
  177. if: true # can be used to temporary disable build
  178. runs-on: windows-latest
  179. timeout-minutes: 120
  180. needs: linux
  181. env:
  182. PY_COLORS: 1
  183. defaults:
  184. run:
  185. shell: msys2 {0}
  186. steps:
  187. - uses: actions/checkout@v4
  188. with:
  189. fetch-depth: 0
  190. - uses: msys2/setup-msys2@v2
  191. with:
  192. msystem: UCRT64
  193. update: true
  194. - name: Install system packages
  195. run: ./scripts/msys2-install-deps development
  196. - name: Build python venv
  197. run: |
  198. # building cffi / argon2-cffi in the venv fails, so we try to use the system packages
  199. python -m venv --system-site-packages env
  200. . env/bin/activate
  201. # python -m pip install --upgrade pip
  202. # pip install --upgrade setuptools build wheel
  203. pip install pyinstaller==6.11.1
  204. - name: Build
  205. run: |
  206. # build borg.exe
  207. . env/bin/activate
  208. pip install -e .
  209. pyinstaller -y scripts/borg.exe.spec
  210. # build sdist and wheel in dist/...
  211. python -m build
  212. - uses: actions/upload-artifact@v4
  213. with:
  214. name: borg-windows
  215. path: dist/borg.exe
  216. - name: Run tests
  217. run: |
  218. ./dist/borg.exe -V
  219. . env/bin/activate
  220. borg -V
  221. python -m pytest -n4 --benchmark-skip -vv -rs -k "not remote"