ci.yml 6.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235
  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-20.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-20.04
  49. python-version: '3.9'
  50. toxenv: mypy
  51. - os: ubuntu-20.04
  52. python-version: '3.9'
  53. toxenv: py39-fuse2
  54. - os: ubuntu-20.04
  55. python-version: '3.10'
  56. toxenv: py310-fuse3
  57. - os: ubuntu-20.04
  58. python-version: '3.11'
  59. toxenv: py311-fuse3
  60. env:
  61. TOXENV: ${{ matrix.toxenv }}
  62. runs-on: ${{ matrix.os }}
  63. timeout-minutes: 60
  64. steps:
  65. - uses: actions/checkout@v3
  66. with:
  67. # just fetching 1 commit is not enough for setuptools-scm, so we fetch all
  68. fetch-depth: 0
  69. - name: Set up Python ${{ matrix.python-version }}
  70. uses: actions/setup-python@v4
  71. with:
  72. python-version: ${{ matrix.python-version }}
  73. - name: Cache pip
  74. uses: actions/cache@v3
  75. with:
  76. path: ~/.cache/pip
  77. key: ${{ runner.os }}-pip-${{ hashFiles('requirements.d/development.txt') }}
  78. restore-keys: |
  79. ${{ runner.os }}-pip-
  80. ${{ runner.os }}-
  81. - name: Install Linux packages
  82. run: |
  83. sudo apt-get update
  84. sudo apt-get install -y pkg-config build-essential
  85. sudo apt-get install -y libssl-dev libacl1-dev libxxhash-dev liblz4-dev libzstd-dev
  86. sudo apt-get install -y libfuse-dev fuse || true # Required for Python llfuse module
  87. sudo apt-get install -y libfuse3-dev fuse3 || true # Required for Python pyfuse3 module
  88. - name: Install Python requirements
  89. run: |
  90. python -m pip install --upgrade pip setuptools wheel
  91. pip install -r requirements.d/development.txt
  92. - name: Install borgbackup
  93. run: |
  94. # pip install -e .
  95. python setup.py -v develop
  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@v3
  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-12
  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: "/usr/local/opt/openssl@1.1/lib/pkgconfig:$PKG_CONFIG_PATH"
  123. TOXENV: ${{ matrix.toxenv }}
  124. runs-on: ${{ matrix.os }}
  125. timeout-minutes: 60
  126. steps:
  127. - uses: actions/checkout@v3
  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@v4
  133. with:
  134. python-version: ${{ matrix.python-version }}
  135. - name: Cache pip
  136. uses: actions/cache@v3
  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: |
  145. brew install pkg-config || brew upgrade pkg-config
  146. brew install zstd || brew upgrade zstd
  147. brew install lz4 || brew upgrade lz4
  148. brew install xxhash || brew upgrade xxhash
  149. brew install openssl@1.1 || brew upgrade openssl@1.1
  150. - name: Install Python requirements
  151. run: |
  152. python -m pip install --upgrade pip setuptools wheel
  153. pip install -r requirements.d/development.txt
  154. - name: Install borgbackup
  155. env:
  156. # we already have that in the global env, but something is broken and overwrites that.
  157. # so, set it here, again.
  158. PKG_CONFIG_PATH: "/usr/local/opt/openssl@1.1/lib/pkgconfig:$PKG_CONFIG_PATH"
  159. run: |
  160. # pip install -e .
  161. python setup.py -v develop
  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. pip install -e .
  203. pyinstaller -y scripts/borg.exe.spec
  204. - uses: actions/upload-artifact@v3
  205. with:
  206. name: borg-windows
  207. path: dist/borg.exe
  208. - name: Run tests
  209. run: |
  210. ./dist/borg.exe -V
  211. pytest -n4 --benchmark-skip -vv -rs -k "not remote"