tests.yml 15 KB

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