ci.yml 6.5 KB

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