ci.yml 6.7 KB

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