ci.yml 6.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233
  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-22.04
  59. python-version: '3.12'
  60. toxenv: py312-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: brew bundle install
  145. - name: Install Python requirements
  146. run: |
  147. python -m pip install --upgrade pip setuptools wheel
  148. pip install -r requirements.d/development.txt
  149. - name: Install borgbackup
  150. env:
  151. # we already have that in the global env, but something is broken and overwrites that.
  152. # so, set it here, again.
  153. PKG_CONFIG_PATH: "/opt/homebrew/opt/openssl@3.0/lib/pkgconfig:$PKG_CONFIG_PATH"
  154. run: |
  155. pip install -ve .
  156. - name: run tox env
  157. env:
  158. # we already have that in the global env, but something is broken and overwrites that.
  159. # so, set it here, again.
  160. PKG_CONFIG_PATH: "/opt/homebrew/opt/openssl@3.0/lib/pkgconfig:$PKG_CONFIG_PATH"
  161. XDISTN: "6"
  162. run: |
  163. # do not use fakeroot, but run as root. avoids the dreaded EISDIR sporadic failures. see #2482.
  164. #sudo -E bash -c "tox -e py"
  165. tox --skip-missing-interpreters
  166. - name: Upload coverage to Codecov
  167. uses: codecov/codecov-action@v4
  168. env:
  169. OS: ${{ runner.os }}
  170. python: ${{ matrix.python-version }}
  171. with:
  172. token: ${{ secrets.CODECOV_TOKEN }}
  173. env_vars: OS, python
  174. windows:
  175. if: false # build is broken, thus disabled, see #8264
  176. runs-on: windows-latest
  177. timeout-minutes: 120
  178. needs: linux
  179. env:
  180. SETUPTOOLS_USE_DISTUTILS: stdlib # Needed for pip to work - https://www.msys2.org/docs/python/#known-issues
  181. PY_COLORS: 1
  182. defaults:
  183. run:
  184. shell: msys2 {0}
  185. steps:
  186. - uses: actions/checkout@v4
  187. with:
  188. fetch-depth: 0
  189. - uses: msys2/setup-msys2@v2
  190. with:
  191. msystem: UCRT64
  192. update: true
  193. - name: Install dependencies
  194. run: ./scripts/msys2-install-deps development
  195. - name: Build
  196. run: |
  197. # build borg.exe
  198. SETUPTOOLS_USE_DISTUTILS=stdlib pip install -e .
  199. pyinstaller -y scripts/borg.exe.spec
  200. # build sdist and wheel in dist/...
  201. SETUPTOOLS_USE_DISTUTILS=stdlib python -m build
  202. - uses: actions/upload-artifact@v4
  203. with:
  204. name: borg-windows
  205. path: dist/borg.exe
  206. - name: Run tests
  207. run: |
  208. ./dist/borg.exe -V
  209. pytest -n4 --benchmark-skip -vv -rs -k "not remote"