tests.yml 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302
  1. name: Tests
  2. on:
  3. push:
  4. branches: [main, 'wip/**']
  5. pull_request:
  6. # A newer push to the same branch cancels the older run (work branches are pushed often); main keeps every run.
  7. concurrency:
  8. group: tests-${{ github.ref }}
  9. cancel-in-progress: ${{ github.ref != 'refs/heads/main' }}
  10. env:
  11. JUCE_VERSION: 8.0.4
  12. JUCE_SHA256: 0effe9823a6fd8a4f98e5c08be7d308350e417b2d15dcf34011e778fefbbf005
  13. jobs:
  14. server:
  15. name: Server limits
  16. runs-on: ubuntu-24.04
  17. steps:
  18. - uses: actions/checkout@v5
  19. # (the runners' package mirror sometimes fails to resolve for a minute: try again instead of failing the job)
  20. # (python3-numpy: LYNX Model's timbre-score tests, tools/physmod; Ubuntu's system Python takes packages from apt, not pip)
  21. - run: for i in 1 2 3 4 5 6; do sudo apt-get update -q && sudo apt-get install -y -q python3-aiohttp python3-numpy && break; [ $i = 6 ] && exit 1; sleep 30; done
  22. - run: /usr/bin/python3 -m unittest discover -s server/tests -p 'test_*.py' -v
  23. - run: /usr/bin/python3 -m unittest discover -s tools/physmod -p 'test_*.py' -v
  24. # Round speed185a: a Core job took 76-130 min, ~90 % of it compiling the core again for every tool (now once, in
  25. # parallel: scripts/cxx-once.sh) and the rest running the tests one by one (now in parallel shards, then the
  26. # timing-sensitive ones alone: scripts/run-tests.sh). ccache keeps the objects between runs: main saves the cache,
  27. # every other branch starts from main's. Every test still runs in every job.
  28. core:
  29. name: Core (${{ matrix.os }}, ${{ matrix.compiler }})
  30. runs-on: ${{ matrix.os }}
  31. strategy:
  32. fail-fast: false
  33. matrix:
  34. include:
  35. - { os: ubuntu-24.04, compiler: g++ }
  36. - { os: ubuntu-24.04, compiler: clang++ }
  37. - { os: macos-15, compiler: clang++ }
  38. env:
  39. CCACHE_DIR: ${{ github.workspace }}/.ccache
  40. CCACHE_MAXSIZE: 1500M
  41. CCACHE_COMPILERCHECK: content
  42. steps:
  43. - uses: actions/checkout@v5
  44. - name: ccache
  45. shell: bash
  46. run: |
  47. if [[ "$RUNNER_OS" == Linux ]]; then sudo apt-get install -y -q ccache > /dev/null || for i in 1 2 3 4 5 6; do sudo apt-get update -q && sudo apt-get install -y -q ccache && break; [ $i = 6 ] && exit 1; sleep 30; done
  48. else brew list ccache > /dev/null 2>&1 || brew install ccache; fi
  49. - uses: actions/cache/restore@v4
  50. with:
  51. path: .ccache
  52. key: ccache-core-${{ matrix.os }}-${{ matrix.compiler }}-${{ github.sha }}
  53. restore-keys: ccache-core-${{ matrix.os }}-${{ matrix.compiler }}-
  54. - name: Build and test the core (no JUCE)
  55. env:
  56. CXX: ccache ${{ matrix.compiler }}
  57. LYNX_TEST_JOBS: auto
  58. run: |
  59. ccache --zero-stats > /dev/null # (after the restore: the statistics live in the cache folder)
  60. ./scripts/build-local.sh
  61. - name: ccache statistics
  62. if: always()
  63. run: ccache --show-stats || true
  64. - uses: actions/cache/save@v4
  65. if: always() && github.ref == 'refs/heads/main'
  66. with:
  67. path: .ccache
  68. key: ccache-core-${{ matrix.os }}-${{ matrix.compiler }}-${{ github.sha }}
  69. - name: Upload the test logs
  70. if: always()
  71. uses: actions/upload-artifact@v4
  72. with:
  73. name: core-test-logs-${{ matrix.os }}-${{ matrix.compiler }}
  74. path: build-local/lynx_tests.shards
  75. retention-days: 7
  76. if-no-files-found: ignore
  77. # The whole app (JUCE) on Linux and macOS: it must build and pass its self-test. Windows is built by release.yml.
  78. app:
  79. name: App (${{ matrix.os }})
  80. runs-on: ${{ matrix.os }}
  81. strategy:
  82. fail-fast: false
  83. matrix:
  84. os: [ubuntu-24.04, macos-15]
  85. env:
  86. CCACHE_DIR: ${{ github.workspace }}/.ccache
  87. CCACHE_MAXSIZE: 1500M
  88. CCACHE_COMPILERCHECK: content
  89. steps:
  90. - uses: actions/checkout@v5
  91. - name: Linux build dependencies
  92. if: runner.os == 'Linux'
  93. run: |
  94. for i in 1 2 3 4 5 6; do
  95. sudo apt-get update -q && sudo apt-get install -y -q ccache ninja-build pkg-config xvfb libasound2-dev libjack-jackd2-dev libx11-dev libxrandr-dev \
  96. libxinerama-dev libxcursor-dev libxext-dev libxcomposite-dev libfreetype-dev libfontconfig1-dev libgl-dev && break
  97. [ $i = 6 ] && exit 1; sleep 30
  98. done
  99. - name: macOS build dependencies
  100. if: runner.os == 'macOS'
  101. run: |
  102. brew list ninja > /dev/null 2>&1 || brew install ninja
  103. brew list ccache > /dev/null 2>&1 || brew install ccache
  104. # (round speed185a) ccache between runs: main saves it, other branches start from main's
  105. - uses: actions/cache/restore@v4
  106. with:
  107. path: .ccache
  108. key: ccache-app-${{ matrix.os }}-${{ github.sha }}
  109. restore-keys: ccache-app-${{ matrix.os }}-
  110. - name: JUCE (checksum verified)
  111. shell: bash
  112. run: |
  113. curl -fsSL -o juce.tar.gz "https://github.com/juce-framework/JUCE/archive/refs/tags/$JUCE_VERSION.tar.gz"
  114. echo "$JUCE_SHA256 juce.tar.gz" | shasum -a 256 -c -
  115. mkdir -p "$RUNNER_TEMP/juce" && tar xzf juce.tar.gz -C "$RUNNER_TEMP/juce" --strip-components 1 && rm juce.tar.gz
  116. - name: Build
  117. shell: bash
  118. run: |
  119. ccache --zero-stats > /dev/null
  120. cmake -S . -B build -G Ninja -DCMAKE_BUILD_TYPE=Release -DFETCHCONTENT_SOURCE_DIR_JUCE="$RUNNER_TEMP/juce" \
  121. -DCMAKE_C_COMPILER_LAUNCHER=ccache -DCMAKE_CXX_COMPILER_LAUNCHER=ccache -DCMAKE_OBJC_COMPILER_LAUNCHER=ccache -DCMAKE_OBJCXX_COMPILER_LAUNCHER=ccache \
  122. -DLYNX_LTO=OFF
  123. cmake --build build --target LYNX lynx_remote_project_tests perfbench -- -k 0
  124. ccache --show-stats || true
  125. - name: Remote project document regressions
  126. run: ctest --test-dir build --output-on-failure -R '^lynx_remote_project_tests$'
  127. - uses: actions/cache/save@v4
  128. if: always() && github.ref == 'refs/heads/main'
  129. with:
  130. path: .ccache
  131. key: ccache-app-${{ matrix.os }}-${{ github.sha }}
  132. - name: Self-test
  133. shell: bash
  134. run: |
  135. if [[ "$RUNNER_OS" == Linux ]]; then
  136. bin=build/LYNX_artefacts/Release/LYNX; run=(xvfb-run -a)
  137. else
  138. bin=build/LYNX_artefacts/Release/LYNX.app/Contents/MacOS/LYNX; run=()
  139. fi
  140. "${run[@]}" "$bin" --selftest "$PWD/selftest.txt" "$PWD/selftest-demo.lynx" || true
  141. cat selftest.txt
  142. grep -q '^result=OK' selftest.txt
  143. # Round perfgate190id (community slice B12): the big-project performance gate on the synthetic projects
  144. # (core/PerfProjects.h): audio CPU per block size, load / rebuild time, memory, .lynx save / load, open time and
  145. # paint per frame of every view, against tests/perf/baseline-ci-ubuntu.json (scripts/perf-gate.sh; times are
  146. # divided by a fixed calibration run, failing cells are measured again before the gate fails).
  147. - name: Performance gate (big projects)
  148. if: runner.os == 'Linux'
  149. shell: bash
  150. run: |
  151. python3 -m unittest discover -s tests/perf -p 'test_*.py'
  152. sudo sysctl -w kernel.perf_event_paranoid=1 > /dev/null 2>&1 || true # (the CPU's instruction counter, where the VM has one)
  153. PROFILE=ci-ubuntu PERFBENCH=build/perfbench LYNX_APP=build/LYNX_artefacts/Release/LYNX \
  154. scripts/perf-gate.sh compare "$PWD/perfgate"
  155. - name: Upload the performance gate results
  156. if: always() && runner.os == 'Linux'
  157. uses: actions/upload-artifact@v4
  158. with:
  159. name: perfgate-results
  160. path: |
  161. perfgate/*.txt
  162. perfgate/*.json
  163. perfgate/*.md
  164. retention-days: 30
  165. if-no-files-found: ignore
  166. # Issue #85: no LV2 child while nothing changed, one when something did; a child that fails changes nothing
  167. - name: LV2 scan
  168. if: runner.os == 'Linux'
  169. shell: bash
  170. run: |
  171. LYNX_PROFILE_DIR="$PWD/lv2-profile" xvfb-run -a build/LYNX_artefacts/Release/LYNX --lv2scantest "$PWD/lv2scan.txt" || true
  172. cat lv2scan.txt
  173. grep -q '^result=OK' lv2scan.txt
  174. # Round 170c (issue #11): the plugin editors as this platform draws them (macOS = CoreGraphics), one PNG each,
  175. # and the renderer probe (gradient text / empty paths must stay inside their shapes). Kept as an artifact.
  176. - name: Editor pictures
  177. if: always()
  178. shell: bash
  179. run: |
  180. if [[ "$RUNNER_OS" == Linux ]]; then
  181. bin=build/LYNX_artefacts/Release/LYNX; run=(xvfb-run -a)
  182. else
  183. bin=build/LYNX_artefacts/Release/LYNX.app/Contents/MacOS/LYNX; run=()
  184. fi
  185. mkdir -p editor-pictures
  186. "${run[@]}" "$bin" --gfxprobe "$PWD/editor-pictures/gfxprobe.txt" || true
  187. cat editor-pictures/gfxprobe.txt || true
  188. perl -e 'alarm shift; exec @ARGV' 600 "${run[@]}" "$bin" --steppertest "$PWD/editor-pictures/steppertest.txt" || true
  189. tail -3 editor-pictures/steppertest.txt || true
  190. perl -e 'alarm shift; exec @ARGV' 1200 "${run[@]}" "$bin" --plugui "$PWD/editor-pictures" || true
  191. ls editor-pictures | wc -l
  192. - name: Upload the editor pictures
  193. if: always()
  194. uses: actions/upload-artifact@v4
  195. with:
  196. name: editor-pictures-${{ runner.os }}
  197. path: editor-pictures
  198. retention-days: 14
  199. # A plugin that kills the scan's child process is blacklisted, not described again at every start
  200. - name: Crashing plugin
  201. if: runner.os == 'Linux'
  202. shell: bash
  203. run: |
  204. mkdir crash-plugin
  205. echo 'void __attribute__ ((constructor)) crash (void) { __builtin_trap(); }' | cc -shared -fPIC -x c - -o crash-plugin/crash.clap
  206. LYNX_PROFILE_DIR="$PWD/crash-profile" xvfb-run -a build/LYNX_artefacts/Release/LYNX --scantest "$PWD/crash-plugin" "$PWD/crash.txt" || true
  207. cat crash.txt
  208. grep -q 'blacklisted: .*crash.clap' crash.txt
  209. # Issue #155: a VST3 that ignores bus activation (as every nih-plug plugin does) reads its sidechain bus while LYNX
  210. # keeps that bus off; JUCE passed null sample pointers there (nih-plug: memcpy from null, LYNX crashed). The test
  211. # plugin goes silent on a null pointer, so this fails (peak=0) unless the off bus holds silence (cmake fix 24).
  212. - name: Inactive sidechain bus (VST3)
  213. if: runner.os == 'Linux'
  214. shell: bash
  215. run: |
  216. V="$RUNNER_TEMP/juce/modules/juce_audio_processors/format_types/VST3_SDK"
  217. B="sc-plugin/LYNX Test Sidechain.vst3/Contents/x86_64-linux"
  218. mkdir -p "$B"
  219. c++ -shared -fPIC -O2 -std=c++17 -I"$V" tools/testplugin/lynx_test_sidechain_vst3.cpp "$V/pluginterfaces/base/funknown.cpp" -o "$B/LYNX Test Sidechain.so"
  220. LYNX_PROFILE_DIR="$PWD/sc-profile" xvfb-run -a build/LYNX_artefacts/Release/LYNX --plugintest "$PWD/sc-plugin/LYNX Test Sidechain.vst3" "$PWD/sc.txt" || true
  221. cat sc.txt
  222. grep -q '^result=OK' sc.txt && grep -q '^plugin_crashes=0' sc.txt
  223. # Issue #138 (round 190hn): a hosted synth that drops notes while it boots (1.5 s of audio, as a hardware emulator
  224. # booting its firmware) must still play a short note at tick 0 of an export (the plugin warm-up)
  225. - name: Short export of a booting synth (VST3)
  226. if: runner.os == 'Linux'
  227. shell: bash
  228. run: |
  229. V="$RUNNER_TEMP/juce/modules/juce_audio_processors/format_types/VST3_SDK"
  230. B="boot-plugin/LYNX Test Synth.vst3/Contents/x86_64-linux"
  231. mkdir -p "$B"
  232. c++ -shared -fPIC -O2 -std=c++17 -I"$V" tools/testplugin/lynx_test_synth_vst3.cpp "$V/pluginterfaces/base/funknown.cpp" -o "$B/LYNX Test Synth.so"
  233. LYNX_TEST_SYNTH_BOOT_MS=1500 LYNX_PROFILE_DIR="$PWD/boot-profile" xvfb-run -a build/LYNX_artefacts/Release/LYNX --shortexporttest "$PWD/boot.txt" 1 --quick --plugin "$PWD/boot-plugin/LYNX Test Synth.vst3" || true
  234. grep -E 'hosted|^short_export=|^result=' boot.txt
  235. grep -q '^result=OK' boot.txt
  236. # Round 190jb (FL renders with the plugin instances that play): an export made with the Export window's hold renders
  237. # with the live engine's instance. The test synth's seeded mode gives every instance its own pitches: the export
  238. # must equal playback (a new instance can't), playback after it must equal playback before it, the plugin back at
  239. # its rate in real-time mode (the synth built by the step above)
  240. - name: Export with the live plugin instances (VST3)
  241. if: runner.os == 'Linux'
  242. shell: bash
  243. run: |
  244. LYNX_TEST_SYNTH_SEED=1 LYNX_PROFILE_DIR="$PWD/live-profile" xvfb-run -a build/LYNX_artefacts/Release/LYNX --exportlivetest "$PWD/live.txt" --plugin "$PWD/boot-plugin/LYNX Test Synth.vst3" || true
  245. cat live.txt
  246. grep -q '^result=OK' live.txt
  247. # Round 190dt: a hosted plugin that crashes in its audio processing (a null write, and a memcpy from null as in
  248. # issue #155) is switched off and LYNX keeps playing, saves and reloads it; a plugin that crashes on its saved state
  249. # is left out as the project opens; LYNX's own faults inside a plugin call still end in the crash handler.
  250. # Linux: CLAP + VST3; macOS: CLAP.
  251. - name: Crashing plugin guard
  252. shell: bash
  253. run: |
  254. if [[ "$RUNNER_OS" == Linux ]]; then
  255. bin=build/LYNX_artefacts/Release/LYNX; run=(xvfb-run -a)
  256. else
  257. bin=build/LYNX_artefacts/Release/LYNX.app/Contents/MacOS/LYNX; run=()
  258. fi
  259. mkdir -p cg-plugins
  260. cc -shared -fPIC -O2 -Ithird_party/clap/include tools/testplugin/lynx_test_crash.c -o "cg-plugins/LYNX Test Crash.clap"
  261. plugins=("LYNX Test Crash.clap" "LYNX Test Crash.clap")
  262. modes=(process memcpy)
  263. if [[ "$RUNNER_OS" == Linux ]]; then
  264. V="$RUNNER_TEMP/juce/modules/juce_audio_processors/format_types/VST3_SDK"
  265. B="cg-plugins/LYNX Test Crash.vst3/Contents/x86_64-linux"
  266. mkdir -p "$B"
  267. c++ -shared -fPIC -O2 -std=c++17 -I"$V" tools/testplugin/lynx_test_crash_vst3.cpp "$V/pluginterfaces/base/funknown.cpp" -o "$B/LYNX Test Crash.so"
  268. plugins+=("LYNX Test Crash.vst3" "LYNX Test Crash.vst3")
  269. modes+=(process memcpy)
  270. fi
  271. status=0
  272. for i in "${!plugins[@]}"; do
  273. report="$PWD/crashguard-$i.txt"
  274. LYNX_PROFILE_DIR="$PWD/cg-profile-$i" perl -e 'alarm shift; exec @ARGV' 600 "${run[@]}" "$bin" --crashguardtest "$PWD/cg-plugins/${plugins[$i]}" "$report" "${modes[$i]}" || true
  275. echo "--- ${plugins[$i]} (${modes[$i]})"; cat "$report" || true
  276. grep -q '^result=OK' "$report" || status=1
  277. done
  278. exit $status