ci.yml 7.1 KB

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