tests.yml 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305
  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. cmake --build build --target LYNX lynx_remote_project_tests perfbench -- -k 0
  127. ccache --show-stats || true
  128. - name: Remote project document regressions
  129. run: ctest --test-dir build --output-on-failure -R '^lynx_remote_project_tests$'
  130. - uses: actions/cache/save@v4
  131. if: always() && github.ref == 'refs/heads/main'
  132. with:
  133. path: .ccache
  134. key: ccache-app-${{ matrix.os }}-${{ github.sha }}
  135. - name: Self-test
  136. shell: bash
  137. run: |
  138. if [[ "$RUNNER_OS" == Linux ]]; then
  139. bin=build/LYNX_artefacts/Release/LYNX; run=(xvfb-run -a)
  140. else
  141. bin=build/LYNX_artefacts/Release/LYNX.app/Contents/MacOS/LYNX; run=()
  142. fi
  143. "${run[@]}" "$bin" --selftest "$PWD/selftest.txt" "$PWD/selftest-demo.lynx" || true
  144. cat selftest.txt
  145. grep -q '^result=OK' selftest.txt
  146. # Round perfgate190id (community slice B12): the big-project performance gate on the synthetic projects
  147. # (core/PerfProjects.h): audio CPU per block size, load / rebuild time, memory, .lynx save / load, open time and
  148. # paint per frame of every view, against tests/perf/baseline-ci-ubuntu.json (scripts/perf-gate.sh; times are
  149. # divided by a fixed calibration run, failing cells are measured again before the gate fails).
  150. - name: Performance gate (big projects)
  151. if: runner.os == 'Linux'
  152. shell: bash
  153. run: |
  154. python3 -m unittest discover -s tests/perf -p 'test_*.py'
  155. sudo sysctl -w kernel.perf_event_paranoid=1 > /dev/null 2>&1 || true # (the CPU's instruction counter, where the VM has one)
  156. PROFILE=ci-ubuntu PERFBENCH=build/perfbench LYNX_APP=build/LYNX_artefacts/Release/LYNX \
  157. scripts/perf-gate.sh compare "$PWD/perfgate"
  158. - name: Upload the performance gate results
  159. if: always() && runner.os == 'Linux'
  160. uses: actions/upload-artifact@v4
  161. with:
  162. name: perfgate-results
  163. path: |
  164. perfgate/*.txt
  165. perfgate/*.json
  166. perfgate/*.md
  167. retention-days: 30
  168. if-no-files-found: ignore
  169. # Issue #85: no LV2 child while nothing changed, one when something did; a child that fails changes nothing
  170. - name: LV2 scan
  171. if: runner.os == 'Linux'
  172. shell: bash
  173. run: |
  174. LYNX_PROFILE_DIR="$PWD/lv2-profile" xvfb-run -a build/LYNX_artefacts/Release/LYNX --lv2scantest "$PWD/lv2scan.txt" || true
  175. cat lv2scan.txt
  176. grep -q '^result=OK' lv2scan.txt
  177. # Round 170c (issue #11): the plugin editors as this platform draws them (macOS = CoreGraphics), one PNG each,
  178. # and the renderer probe (gradient text / empty paths must stay inside their shapes). Kept as an artifact.
  179. - name: Editor pictures
  180. if: always()
  181. shell: bash
  182. run: |
  183. if [[ "$RUNNER_OS" == Linux ]]; then
  184. bin=build/LYNX_artefacts/Release/LYNX; run=(xvfb-run -a)
  185. else
  186. bin=build/LYNX_artefacts/Release/LYNX.app/Contents/MacOS/LYNX; run=()
  187. fi
  188. mkdir -p editor-pictures
  189. "${run[@]}" "$bin" --gfxprobe "$PWD/editor-pictures/gfxprobe.txt" || true
  190. cat editor-pictures/gfxprobe.txt || true
  191. perl -e 'alarm shift; exec @ARGV' 600 "${run[@]}" "$bin" --steppertest "$PWD/editor-pictures/steppertest.txt" || true
  192. tail -3 editor-pictures/steppertest.txt || true
  193. perl -e 'alarm shift; exec @ARGV' 1200 "${run[@]}" "$bin" --plugui "$PWD/editor-pictures" || true
  194. ls editor-pictures | wc -l
  195. - name: Upload the editor pictures
  196. if: always()
  197. uses: actions/upload-artifact@v4
  198. with:
  199. name: editor-pictures-${{ runner.os }}
  200. path: editor-pictures
  201. retention-days: 14
  202. # A plugin that kills the scan's child process is blacklisted, not described again at every start
  203. - name: Crashing plugin
  204. if: runner.os == 'Linux'
  205. shell: bash
  206. run: |
  207. mkdir crash-plugin
  208. echo 'void __attribute__ ((constructor)) crash (void) { __builtin_trap(); }' | cc -shared -fPIC -x c - -o crash-plugin/crash.clap
  209. LYNX_PROFILE_DIR="$PWD/crash-profile" xvfb-run -a build/LYNX_artefacts/Release/LYNX --scantest "$PWD/crash-plugin" "$PWD/crash.txt" || true
  210. cat crash.txt
  211. grep -q 'blacklisted: .*crash.clap' crash.txt
  212. # Issue #155: a VST3 that ignores bus activation (as every nih-plug plugin does) reads its sidechain bus while LYNX
  213. # keeps that bus off; JUCE passed null sample pointers there (nih-plug: memcpy from null, LYNX crashed). The test
  214. # plugin goes silent on a null pointer, so this fails (peak=0) unless the off bus holds silence (cmake fix 24).
  215. - name: Inactive sidechain bus (VST3)
  216. if: runner.os == 'Linux'
  217. shell: bash
  218. run: |
  219. V="$RUNNER_TEMP/juce/modules/juce_audio_processors/format_types/VST3_SDK"
  220. B="sc-plugin/LYNX Test Sidechain.vst3/Contents/x86_64-linux"
  221. mkdir -p "$B"
  222. 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"
  223. 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
  224. cat sc.txt
  225. grep -q '^result=OK' sc.txt && grep -q '^plugin_crashes=0' sc.txt
  226. # Issue #138 (round 190hn): a hosted synth that drops notes while it boots (1.5 s of audio, as a hardware emulator
  227. # booting its firmware) must still play a short note at tick 0 of an export (the plugin warm-up)
  228. - name: Short export of a booting synth (VST3)
  229. if: runner.os == 'Linux'
  230. shell: bash
  231. run: |
  232. V="$RUNNER_TEMP/juce/modules/juce_audio_processors/format_types/VST3_SDK"
  233. B="boot-plugin/LYNX Test Synth.vst3/Contents/x86_64-linux"
  234. mkdir -p "$B"
  235. 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"
  236. 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
  237. grep -E 'hosted|^short_export=|^result=' boot.txt
  238. grep -q '^result=OK' boot.txt
  239. # Round 190jb (FL renders with the plugin instances that play): an export made with the Export window's hold renders
  240. # with the live engine's instance. The test synth's seeded mode gives every instance its own pitches: the export
  241. # must equal playback (a new instance can't), playback after it must equal playback before it, the plugin back at
  242. # its rate in real-time mode (the synth built by the step above)
  243. - name: Export with the live plugin instances (VST3)
  244. if: runner.os == 'Linux'
  245. shell: bash
  246. run: |
  247. 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
  248. cat live.txt
  249. grep -q '^result=OK' live.txt
  250. # Round 190dt: a hosted plugin that crashes in its audio processing (a null write, and a memcpy from null as in
  251. # issue #155) is switched off and LYNX keeps playing, saves and reloads it; a plugin that crashes on its saved state
  252. # is left out as the project opens; LYNX's own faults inside a plugin call still end in the crash handler.
  253. # Linux: CLAP + VST3; macOS: CLAP.
  254. - name: Crashing plugin guard
  255. shell: bash
  256. run: |
  257. if [[ "$RUNNER_OS" == Linux ]]; then
  258. bin=build/LYNX_artefacts/Release/LYNX; run=(xvfb-run -a)
  259. else
  260. bin=build/LYNX_artefacts/Release/LYNX.app/Contents/MacOS/LYNX; run=()
  261. fi
  262. mkdir -p cg-plugins
  263. cc -shared -fPIC -O2 -Ithird_party/clap/include tools/testplugin/lynx_test_crash.c -o "cg-plugins/LYNX Test Crash.clap"
  264. plugins=("LYNX Test Crash.clap" "LYNX Test Crash.clap")
  265. modes=(process memcpy)
  266. if [[ "$RUNNER_OS" == Linux ]]; then
  267. V="$RUNNER_TEMP/juce/modules/juce_audio_processors/format_types/VST3_SDK"
  268. B="cg-plugins/LYNX Test Crash.vst3/Contents/x86_64-linux"
  269. mkdir -p "$B"
  270. 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"
  271. plugins+=("LYNX Test Crash.vst3" "LYNX Test Crash.vst3")
  272. modes+=(process memcpy)
  273. fi
  274. status=0
  275. for i in "${!plugins[@]}"; do
  276. report="$PWD/crashguard-$i.txt"
  277. 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
  278. echo "--- ${plugins[$i]} (${modes[$i]})"; cat "$report" || true
  279. grep -q '^result=OK' "$report" || status=1
  280. done
  281. exit $status