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