ci.yml 6.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225
  1. name: CI
  2. on: [push, pull_request]
  3. env:
  4. CI: 'true'
  5. ASAN_OPTIONS: detect_leaks=0
  6. LC_ALL: en_US.UTF-8
  7. LANG: en_US.UTF-8
  8. permissions:
  9. contents: read # to fetch code (actions/checkout)
  10. jobs:
  11. linux:
  12. name: Linux (python=${{ matrix.pyver }} cc=${{ matrix.cc }} sanitize=${{ matrix.sanitize }})
  13. runs-on: ubuntu-latest
  14. env:
  15. CC: ${{ matrix.cc }}
  16. KITTY_SANITIZE: ${{ matrix.sanitize }}
  17. strategy:
  18. matrix:
  19. python: [a, b, c]
  20. cc: [gcc, clang]
  21. include:
  22. - python: a
  23. pyver: "3.10"
  24. sanitize: 0
  25. - python: b
  26. pyver: "3.11"
  27. sanitize: 1
  28. - python: c
  29. pyver: "3.12"
  30. sanitize: 1
  31. exclude:
  32. - python: a
  33. cc: clang
  34. - python: b
  35. cc: clang
  36. - python: c
  37. cc: gcc
  38. steps:
  39. - name: Checkout source code
  40. uses: actions/checkout@v3
  41. with:
  42. fetch-depth: 10
  43. persist-credentials: false
  44. - name: Set up Python ${{ matrix.pyver }}
  45. uses: actions/setup-python@v4
  46. with:
  47. python-version: ${{ matrix.pyver }}
  48. - name: Install Go
  49. uses: actions/setup-go@v4
  50. with:
  51. go-version-file: go.mod
  52. - name: Build kitty
  53. run: python .github/workflows/ci.py build
  54. - name: Test kitty
  55. run: python .github/workflows/ci.py test
  56. linux-package:
  57. name: Linux package
  58. runs-on: ubuntu-latest
  59. env:
  60. CFLAGS: -funsigned-char
  61. steps:
  62. - name: Checkout source code
  63. uses: actions/checkout@v3
  64. with:
  65. fetch-depth: 0 # needed for :commit: docs role
  66. persist-credentials: false
  67. - name: Test for trailing whitespace
  68. run: if grep -Inr '\s$' kitty kitty_tests kittens docs *.py *.asciidoc *.rst *.go .gitattributes .gitignore; then echo Trailing whitespace found, aborting.; exit 1; fi
  69. - name: Test for bad code block formatting
  70. run: if grep -Inr ':code:`\s' kitty kitty_tests kittens docs *.py *.asciidoc *.rst *.go .gitattributes .gitignore; then echo Space at code block start found, aborting.; exit 1; fi
  71. - name: Set up Python
  72. uses: actions/setup-python@v4
  73. with:
  74. python-version: "3.13"
  75. - name: Install Go
  76. uses: actions/setup-go@v4
  77. with:
  78. go-version-file: go.mod
  79. cache: false
  80. - name: Cache Go build artifacts separately
  81. uses: actions/cache@v3
  82. with:
  83. path: |
  84. ~/.cache/go-build
  85. ~/go/pkg/mod
  86. key: ${{ runner.os }}-golang-static-${{ hashFiles('**/go.sum') }}
  87. restore-keys: |
  88. ${{ runner.os }}-golang-static-
  89. - name: Install build-only deps
  90. run: python -m pip install -r docs/requirements.txt ruff mypy types-requests types-docutils
  91. - name: Run ruff
  92. run: ruff check .
  93. - name: Run gofmt
  94. run: go version && python .github/workflows/ci.py gofmt
  95. - name: Build kitty package
  96. run: python .github/workflows/ci.py package
  97. - name: Build kitty
  98. run: python setup.py build --debug
  99. - name: Run mypy
  100. run: which python && python -m mypy --version && ./test.py mypy
  101. - name: Run go vet
  102. run: go version && go vet -tags testing ./...
  103. - name: Build man page
  104. run: make FAIL_WARN=1 man
  105. - name: Build HTML docs
  106. run: make FAIL_WARN=1 html
  107. - name: Build static kittens
  108. run: python setup.py build-static-binaries
  109. bundle:
  110. name: Bundle test (${{ matrix.os }})
  111. runs-on: ${{ matrix.os }}
  112. strategy:
  113. matrix:
  114. os: [ubuntu-latest, macos-latest]
  115. env:
  116. KITTY_BUNDLE: 1
  117. steps:
  118. - name: Checkout source code
  119. uses: actions/checkout@v3
  120. with:
  121. fetch-depth: 10
  122. persist-credentials: false
  123. - name: Install Go
  124. uses: actions/setup-go@v4
  125. with:
  126. go-version-file: go.mod
  127. - name: Build kitty
  128. run: which python3 && python3 .github/workflows/ci.py build
  129. - name: Test kitty
  130. run: python3 .github/workflows/ci.py test
  131. brew:
  132. name: macOS Brew
  133. runs-on: macos-latest
  134. steps:
  135. - name: Checkout source code
  136. uses: actions/checkout@v3
  137. with:
  138. fetch-depth: 0 # needed for :commit: docs role
  139. persist-credentials: false
  140. - name: Set up Python
  141. uses: actions/setup-python@v4
  142. with:
  143. python-version: "3.11"
  144. - name: Install Go
  145. uses: actions/setup-go@v4
  146. with:
  147. go-version-file: go.mod
  148. - name: Build kitty
  149. run: python3 .github/workflows/ci.py build
  150. - name: Test kitty
  151. run: python3 .github/workflows/ci.py test
  152. - name: Install deps for docs
  153. run: python3 -m pip install -r docs/requirements.txt
  154. - name: Builds docs
  155. run: make FAIL_WARN=1 docs
  156. - name: Build kitty package
  157. run: python3 .github/workflows/ci.py package
  158. - name: Run benchmarks
  159. run: ./benchmark.py
  160. linux-dev:
  161. name: Test ./dev.sh and benchmark
  162. runs-on: ubuntu-latest
  163. steps:
  164. - name: Checkout source code
  165. uses: actions/checkout@v3
  166. with:
  167. fetch-depth: 10
  168. persist-credentials: false
  169. - name: Install build deps
  170. run: sudo apt-get update && sudo apt-get install -y curl xz-utils build-essential git pkg-config libxrandr-dev libxinerama-dev libxcursor-dev libxi-dev libgl1-mesa-dev libxkbcommon-x11-dev libfontconfig-dev libx11-xcb-dev libdbus-1-dev
  171. - name: Install Go
  172. uses: actions/setup-go@v4
  173. with:
  174. go-version-file: go.mod
  175. - name: Build kitty
  176. run: ./dev.sh build
  177. - name: Run benchmarks
  178. run: ./benchmark.py