ci.yml 6.4 KB

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