tests.yml 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325
  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. # Linux arm64 (round 190oy; free arm runner for public repositories). clang++: Ubuntu 24.04's g++ 13.3 fails
  39. # 5 checks on arm64 that GCC 13.4 (the release's compiler, linux-arm64.yml) and clang pass
  40. - { os: ubuntu-24.04-arm, compiler: clang++ }
  41. env:
  42. CCACHE_DIR: ${{ github.workspace }}/.ccache
  43. CCACHE_MAXSIZE: 1500M
  44. CCACHE_COMPILERCHECK: content
  45. steps:
  46. - uses: actions/checkout@v5
  47. - name: ccache
  48. shell: bash
  49. run: |
  50. 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
  51. else brew list ccache > /dev/null 2>&1 || brew install ccache; fi
  52. - uses: actions/cache/restore@v4
  53. with:
  54. path: .ccache
  55. key: ccache-core-${{ matrix.os }}-${{ matrix.compiler }}-${{ github.sha }}
  56. restore-keys: ccache-core-${{ matrix.os }}-${{ matrix.compiler }}-
  57. - name: Build and test the core (no JUCE)
  58. env:
  59. CXX: ccache ${{ matrix.compiler }}
  60. LYNX_TEST_JOBS: auto
  61. run: |
  62. ccache --zero-stats > /dev/null # (after the restore: the statistics live in the cache folder)
  63. ./scripts/build-local.sh
  64. - name: ccache statistics
  65. if: always()
  66. run: ccache --show-stats || true
  67. # (rollup 0.1.33, 2 Dec) the macOS job also saves on wip/* branches: main's macOS cache had been evicted, so Core (macos-15)
  68. # started from nothing (0 of 512 hits, 1 h 40 of compiling); a rollup's next run starts from the previous one. Only macOS:
  69. # the Linux jobs are fast enough, and their caches would crowd out main's in the repository's 10 GB.
  70. - uses: actions/cache/save@v4
  71. if: always() && (github.ref == 'refs/heads/main' || (runner.os == 'macOS' && startsWith(github.ref, 'refs/heads/wip/')))
  72. with:
  73. path: .ccache
  74. key: ccache-core-${{ matrix.os }}-${{ matrix.compiler }}-${{ github.sha }}
  75. - name: Upload the test logs
  76. if: always()
  77. uses: actions/upload-artifact@v4
  78. with:
  79. name: core-test-logs-${{ matrix.os }}-${{ matrix.compiler }}
  80. path: build-local/lynx_tests.shards
  81. retention-days: 7
  82. if-no-files-found: ignore
  83. # The whole app (JUCE) on Linux and macOS: it must build and pass its self-test. Windows is built by release.yml.
  84. app:
  85. name: App (${{ matrix.os }})
  86. runs-on: ${{ matrix.os }}
  87. strategy:
  88. fail-fast: false
  89. matrix:
  90. os: [ubuntu-24.04, macos-15]
  91. env:
  92. CCACHE_DIR: ${{ github.workspace }}/.ccache
  93. CCACHE_MAXSIZE: 1500M
  94. CCACHE_COMPILERCHECK: content
  95. steps:
  96. - uses: actions/checkout@v5
  97. - name: Linux build dependencies
  98. if: runner.os == 'Linux'
  99. run: |
  100. for i in 1 2 3 4 5 6; do
  101. 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 \
  102. libxinerama-dev libxcursor-dev libxext-dev libxcomposite-dev libfreetype-dev libfontconfig1-dev libgl-dev && break
  103. [ $i = 6 ] && exit 1; sleep 30
  104. done
  105. - name: macOS build dependencies
  106. if: runner.os == 'macOS'
  107. run: |
  108. brew list ninja > /dev/null 2>&1 || brew install ninja
  109. brew list ccache > /dev/null 2>&1 || brew install ccache
  110. # (round speed185a) ccache between runs: main saves it, other branches start from main's
  111. - uses: actions/cache/restore@v4
  112. with:
  113. path: .ccache
  114. key: ccache-app-${{ matrix.os }}-${{ github.sha }}
  115. restore-keys: ccache-app-${{ matrix.os }}-
  116. - name: JUCE (checksum verified)
  117. shell: bash
  118. run: |
  119. curl -fsSL -o juce.tar.gz "https://github.com/juce-framework/JUCE/archive/refs/tags/$JUCE_VERSION.tar.gz"
  120. echo "$JUCE_SHA256 juce.tar.gz" | shasum -a 256 -c -
  121. mkdir -p "$RUNNER_TEMP/juce" && tar xzf juce.tar.gz -C "$RUNNER_TEMP/juce" --strip-components 1 && rm juce.tar.gz
  122. - name: Build
  123. shell: bash
  124. run: |
  125. ccache --zero-stats > /dev/null
  126. cmake -S . -B build -G Ninja -DCMAKE_BUILD_TYPE=Release -DFETCHCONTENT_SOURCE_DIR_JUCE="$RUNNER_TEMP/juce" \
  127. -DCMAKE_C_COMPILER_LAUNCHER=ccache -DCMAKE_CXX_COMPILER_LAUNCHER=ccache -DCMAKE_OBJC_COMPILER_LAUNCHER=ccache -DCMAKE_OBJCXX_COMPILER_LAUNCHER=ccache \
  128. -DLYNX_LTO=OFF
  129. # -j 2 on macOS only (rollup 0.1.32 step 12): the macos-15 runner has 3 cores and 7 GB; three UI objects at once (clang peaks
  130. # 1.1-1.9 GB each) made it swap: single files took 17-41 min (seconds on Linux). Runner RAM, as round 190ov's Windows JOBS=2.
  131. cmake --build build --target LYNX lynx_remote_project_tests perfbench -- -k 0 ${{ runner.os == 'macOS' && '-j 2' || '' }}
  132. ccache --show-stats || true
  133. - name: Remote project document regressions
  134. run: ctest --test-dir build --output-on-failure -R '^lynx_remote_project_tests$'
  135. - uses: actions/cache/save@v4
  136. if: always() && (github.ref == 'refs/heads/main' || (runner.os == 'macOS' && startsWith(github.ref, 'refs/heads/wip/')))
  137. with:
  138. path: .ccache
  139. key: ccache-app-${{ matrix.os }}-${{ github.sha }}
  140. - name: Self-test
  141. shell: bash
  142. run: |
  143. if [[ "$RUNNER_OS" == Linux ]]; then
  144. bin=build/LYNX_artefacts/Release/LYNX; run=(xvfb-run -a)
  145. else
  146. bin=build/LYNX_artefacts/Release/LYNX.app/Contents/MacOS/LYNX; run=()
  147. fi
  148. "${run[@]}" "$bin" --selftest "$PWD/selftest.txt" "$PWD/selftest-demo.lynx" || true
  149. cat selftest.txt
  150. grep -q '^result=OK' selftest.txt
  151. # Round perfgate190id (community slice B12): the big-project performance gate on the synthetic projects
  152. # (core/PerfProjects.h): audio CPU per block size, load / rebuild time, memory, .lynx save / load, open time and
  153. # paint per frame of every view, against tests/perf/baseline-ci-ubuntu.json (scripts/perf-gate.sh; times are
  154. # divided by a fixed calibration run, failing cells are measured again before the gate fails).
  155. - name: Performance gate (big projects)
  156. if: runner.os == 'Linux'
  157. shell: bash
  158. run: |
  159. python3 -m unittest discover -s tests/perf -p 'test_*.py'
  160. sudo sysctl -w kernel.perf_event_paranoid=1 > /dev/null 2>&1 || true # (the CPU's instruction counter, where the VM has one)
  161. PROFILE=ci-ubuntu PERFBENCH=build/perfbench LYNX_APP=build/LYNX_artefacts/Release/LYNX \
  162. scripts/perf-gate.sh compare "$PWD/perfgate"
  163. - name: Upload the performance gate results
  164. if: always() && runner.os == 'Linux'
  165. uses: actions/upload-artifact@v4
  166. with:
  167. name: perfgate-results
  168. path: |
  169. perfgate/*.txt
  170. perfgate/*.json
  171. perfgate/*.md
  172. retention-days: 30
  173. if-no-files-found: ignore
  174. # Issue #85: no LV2 child while nothing changed, one when something did; a child that fails changes nothing
  175. - name: LV2 scan
  176. if: runner.os == 'Linux'
  177. shell: bash
  178. run: |
  179. LYNX_PROFILE_DIR="$PWD/lv2-profile" xvfb-run -a build/LYNX_artefacts/Release/LYNX --lv2scantest "$PWD/lv2scan.txt" || true
  180. cat lv2scan.txt
  181. grep -q '^result=OK' lv2scan.txt
  182. # Round 170c (issue #11): the plugin editors as this platform draws them (macOS = CoreGraphics), one PNG each,
  183. # and the renderer probe (gradient text / empty paths must stay inside their shapes). Kept as an artifact.
  184. - name: Editor pictures
  185. if: always()
  186. shell: bash
  187. run: |
  188. if [[ "$RUNNER_OS" == Linux ]]; then
  189. bin=build/LYNX_artefacts/Release/LYNX; run=(xvfb-run -a)
  190. else
  191. bin=build/LYNX_artefacts/Release/LYNX.app/Contents/MacOS/LYNX; run=()
  192. fi
  193. mkdir -p editor-pictures
  194. "${run[@]}" "$bin" --gfxprobe "$PWD/editor-pictures/gfxprobe.txt" || true
  195. cat editor-pictures/gfxprobe.txt || true
  196. perl -e 'alarm shift; exec @ARGV' 600 "${run[@]}" "$bin" --steppertest "$PWD/editor-pictures/steppertest.txt" || true
  197. tail -3 editor-pictures/steppertest.txt || true
  198. perl -e 'alarm shift; exec @ARGV' 1200 "${run[@]}" "$bin" --plugui "$PWD/editor-pictures" || true
  199. ls editor-pictures | wc -l
  200. - name: Upload the editor pictures
  201. if: always()
  202. uses: actions/upload-artifact@v4
  203. with:
  204. name: editor-pictures-${{ runner.os }}
  205. path: editor-pictures
  206. retention-days: 14
  207. # A plugin that kills the scan's child process is blacklisted, not described again at every start
  208. - name: Crashing plugin
  209. if: runner.os == 'Linux'
  210. shell: bash
  211. run: |
  212. mkdir crash-plugin
  213. echo 'void __attribute__ ((constructor)) crash (void) { __builtin_trap(); }' | cc -shared -fPIC -x c - -o crash-plugin/crash.clap
  214. LYNX_PROFILE_DIR="$PWD/crash-profile" xvfb-run -a build/LYNX_artefacts/Release/LYNX --scantest "$PWD/crash-plugin" "$PWD/crash.txt" || true
  215. cat crash.txt
  216. grep -q 'blacklisted: .*crash.clap' crash.txt
  217. # Issue #359 (round 190th): what a hosted plugin's child processes get from LYNX. Xfer Shrub's JUCE web view hung
  218. # LYNX as its editor closed (JUCE's killChild loop spun once its helper died of SIGTERM). The test plugin starts
  219. # children as its editor closes: their signals and descriptors, SIGTERM and end of input, a forked copy, JUCE's loop.
  220. # (descriptors 3+ of the runner closed first: the probe lists every one a child inherits)
  221. - name: Plugin child processes (CLAP)
  222. if: runner.os == 'Linux'
  223. shell: bash
  224. run: |
  225. mkdir -p child-plugin
  226. cc -shared -fPIC -O2 -Ithird_party/clap/include tools/testplugin/lynx_test_child.c -o "child-plugin/LYNX Test Child.clap"
  227. LYNX_TEST_CHILD_REPORT="$PWD/child.txt" LYNX_PROFILE_DIR="$PWD/child-profile" xvfb-run -a perl -e 'use POSIX (); POSIX::close($_) for 3..1023; alarm 120; exec @ARGV' \
  228. build/LYNX_artefacts/Release/LYNX --editortest "$PWD/child-plugin/LYNX Test Child.clap" "$PWD/child-editor.txt" || true
  229. cat child-editor.txt child.txt || true
  230. grep -q '^result=OK' child-editor.txt && grep -q '^done=1' child.txt && ! grep -q '=FAIL' child.txt
  231. # Issue #155: a VST3 that ignores bus activation (as every nih-plug plugin does) reads its sidechain bus while LYNX
  232. # keeps that bus off; JUCE passed null sample pointers there (nih-plug: memcpy from null, LYNX crashed). The test
  233. # plugin goes silent on a null pointer, so this fails (peak=0) unless the off bus holds silence (cmake fix 24).
  234. - name: Inactive sidechain bus (VST3)
  235. if: runner.os == 'Linux'
  236. shell: bash
  237. run: |
  238. V="$RUNNER_TEMP/juce/modules/juce_audio_processors/format_types/VST3_SDK"
  239. B="sc-plugin/LYNX Test Sidechain.vst3/Contents/x86_64-linux"
  240. mkdir -p "$B"
  241. 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"
  242. 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
  243. cat sc.txt
  244. grep -q '^result=OK' sc.txt && grep -q '^plugin_crashes=0' sc.txt
  245. # Issue #138 (round 190hn): a hosted synth that drops notes while it boots (1.5 s of audio, as a hardware emulator
  246. # booting its firmware) must still play a short note at tick 0 of an export (the plugin warm-up)
  247. - name: Short export of a booting synth (VST3)
  248. if: runner.os == 'Linux'
  249. shell: bash
  250. run: |
  251. V="$RUNNER_TEMP/juce/modules/juce_audio_processors/format_types/VST3_SDK"
  252. B="boot-plugin/LYNX Test Synth.vst3/Contents/x86_64-linux"
  253. mkdir -p "$B"
  254. 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"
  255. 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
  256. grep -E 'hosted|^short_export=|^result=' boot.txt
  257. grep -q '^result=OK' boot.txt
  258. # Round 190jb (FL renders with the plugin instances that play): an export made with the Export window's hold renders
  259. # with the live engine's instance. The test synth's seeded mode gives every instance its own pitches: the export
  260. # must equal playback (a new instance can't), playback after it must equal playback before it, the plugin back at
  261. # its rate in real-time mode (the synth built by the step above)
  262. - name: Export with the live plugin instances (VST3)
  263. if: runner.os == 'Linux'
  264. shell: bash
  265. run: |
  266. 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
  267. cat live.txt
  268. grep -q '^result=OK' live.txt
  269. # Round 190dt: a hosted plugin that crashes in its audio processing (a null write, and a memcpy from null as in
  270. # issue #155) is switched off and LYNX keeps playing, saves and reloads it; a plugin that crashes on its saved state
  271. # is left out as the project opens; LYNX's own faults inside a plugin call still end in the crash handler.
  272. # Linux: CLAP + VST3; macOS: CLAP.
  273. - name: Crashing plugin guard
  274. shell: bash
  275. run: |
  276. if [[ "$RUNNER_OS" == Linux ]]; then
  277. bin=build/LYNX_artefacts/Release/LYNX; run=(xvfb-run -a)
  278. else
  279. bin=build/LYNX_artefacts/Release/LYNX.app/Contents/MacOS/LYNX; run=()
  280. fi
  281. mkdir -p cg-plugins
  282. cc -shared -fPIC -O2 -Ithird_party/clap/include tools/testplugin/lynx_test_crash.c -o "cg-plugins/LYNX Test Crash.clap"
  283. plugins=("LYNX Test Crash.clap" "LYNX Test Crash.clap")
  284. modes=(process memcpy)
  285. if [[ "$RUNNER_OS" == Linux ]]; then
  286. V="$RUNNER_TEMP/juce/modules/juce_audio_processors/format_types/VST3_SDK"
  287. B="cg-plugins/LYNX Test Crash.vst3/Contents/x86_64-linux"
  288. mkdir -p "$B"
  289. 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"
  290. plugins+=("LYNX Test Crash.vst3" "LYNX Test Crash.vst3")
  291. modes+=(process memcpy)
  292. fi
  293. status=0
  294. for i in "${!plugins[@]}"; do
  295. report="$PWD/crashguard-$i.txt"
  296. 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
  297. echo "--- ${plugins[$i]} (${modes[$i]})"; cat "$report" || true
  298. grep -q '^result=OK' "$report" || status=1
  299. done
  300. exit $status