diff --git a/.github/workflows/ci-debug-macos-arm64.yml b/.github/workflows/ci-debug-macos-arm64.yml new file mode 100644 index 0000000000..932438b93b --- /dev/null +++ b/.github/workflows/ci-debug-macos-arm64.yml @@ -0,0 +1,147 @@ +name: Build and Test moebius on macOS arm64 + +on: + workflow_dispatch: + inputs: + commit: + description: 'Commit SHA to build/test' + required: true + type: string + + push: + branches: [ main ] + paths: + - 'src/**' + - '!src/Plugins/Windows/**' + - 'tests/**' + - 'xmake.lua' + - 'xmake/packages.lua' + - 'xmake/research.lua' + - 'xmake/options.lua' + - 'xmake/requires.lua' + - 'xmake/targets/**' + - 'xmake/packages/**' + - 'xmake-requires.lock' + - 'lolly/Data/**' + - 'lolly/Kernel/**' + - 'lolly/Plugins/**' + - 'lolly/System/**' + - 'lolly/lolly/**' + - 'lolly/tests/**' + - 'lolly/xmake.lua' + - 'moebius/Data/**' + - 'moebius/Kernel/**' + - 'moebius/Scheme/**' + - 'moebius/moebius/**' + - 'moebius/tests/**' + - 'moebius/xmake.lua' + - '.github/workflows/ci-debug-macos-arm64.yml' + - 'TeXmacs/tests/*.scm' + - 'TeXmacs/progs/**' + - 'TeXmacs/plugins/**' + - '3rdparty/**' + pull_request: + branches: [ main ] + paths: + - 'src/**' + - '!src/Plugins/Windows/**' + - 'tests/**' + - 'xmake.lua' + - 'xmake/packages.lua' + - 'xmake/research.lua' + - 'xmake/options.lua' + - 'xmake/requires.lua' + - 'xmake/targets/**' + - 'xmake/packages/**' + - 'xmake-requires.lock' + - 'lolly/Data/**' + - 'lolly/Kernel/**' + - 'lolly/Plugins/**' + - 'lolly/System/**' + - 'lolly/lolly/**' + - 'lolly/tests/**' + - 'lolly/xmake.lua' + - 'moebius/Data/**' + - 'moebius/Kernel/**' + - 'moebius/Scheme/**' + - 'moebius/moebius/**' + - 'moebius/tests/**' + - 'moebius/xmake.lua' + - '.github/workflows/ci-debug-macos-arm64.yml' + - 'TeXmacs/tests/*.scm' + - 'TeXmacs/progs/**' + - 'TeXmacs/plugins/**' + - '3rdparty/**' + +jobs: + macosbuild: + strategy: + matrix: + os: [macos-14] + arch: [arm64] + runs-on: ${{ matrix.os }} + timeout-minutes: 45 + if: always() + steps: + - uses: actions/checkout@v4 + with: + ref: ${{ inputs.commit || github.sha }} + fetch-depth: 1 + + - name: debug checkout + run: | + echo "PWD:" + pwd + + echo "Workspace:" + echo "${{ github.workspace }}" + + echo "TeXmacs:" + ls -la TeXmacs || true + + echo "TeXmacs/tests:" + ls -la TeXmacs/tests || true + + echo "tmu:" + ls -la TeXmacs/tests/tmu || true + + echo "git tracked tmu files:" + git ls-files 'TeXmacs/tests/tmu/**' | head -20 + + - name: cache xmake + uses: actions/cache@v4 + with: + path: | + ${{github.workspace}}/build/.build_cache + /Users/runner/.xmake + key: xmake-${{ runner.os }}-${{ matrix.arch }}-${{ hashFiles('xmake/vars.lua', 'lolly/xmake.lua', 'moebius/xmake.lua') }} + + - name: set XMAKE_GLOBALDIR + run: echo "XMAKE_GLOBALDIR=${{ runner.workspace }}/xmake-global" >> $GITHUB_ENV + + - uses: xmake-io/github-action-setup-xmake@v1 + with: + xmake-version: v3.0.4 + actions-cache-folder: '.xmake-cache' + + - name: xmake repo --update + run: xmake repo --update + + - name: cache packages from xrepo + uses: actions/cache@v4 + with: + path: | + ${{ env.XMAKE_GLOBALDIR }}/.xmake/packages + key: xrepo-${{ runner.os }}-${{ matrix.arch }}-${{ hashFiles('xmake/vars.lua', 'lolly/xmake.lua', 'moebius/xmake.lua') }} + + - name: config + run: xmake config --policies=build.ccache -o ${{ runner.workspace }}/build -m releasedbg --loro=yes --qt_frontend=no --cli_frontend=yes --pdfhummus=no --yes + - name: build moebius + run: xmake build --yes -vD libmoebius + - name: test moebius + run: xmake test-with-log + + # - name: integration test + # run: xmake run --yes -vD --group=integration_tests + # env: + # QT_QPA_PLATFORM: offscreen diff --git a/moebius/tests/Data/loro_tmu_test.cpp b/moebius/tests/Data/loro_tmu_test.cpp index 37914cdad4..00fc2f5168 100644 --- a/moebius/tests/Data/loro_tmu_test.cpp +++ b/moebius/tests/Data/loro_tmu_test.cpp @@ -34,13 +34,39 @@ ensure_labels () { static string resolve_fixture_dir () { const char* cands[]= { + "TeXmacs/tests/tmu/", + "../TeXmacs/tests/tmu/", + "../../TeXmacs/tests/tmu/", + "../../../TeXmacs/tests/tmu/", "../../../../TeXmacs/tests/tmu/", + "../../../../../TeXmacs/tests/tmu/", + "../../../../../../TeXmacs/tests/tmu/", + "../../../../../../../TeXmacs/tests/tmu/", }; + + cout << "========== resolve_fixture_dir ==========" << LF; + int n= sizeof (cands) / sizeof (cands[0]); + for (int i= 0; i < n; i++) { string c= cands[i]; - if (is_directory (c)) return c; + + cout << "candidate[" << i << "]: " << c << LF; + + bool exists= is_directory (c); + + cout << " is_directory: " << (exists ? "true" : "false") << LF; + + if (exists) { + cout << " >>> FOUND: " << c << LF; + cout << "=========================================" << LF; + return c; + } } + + cout << " >>> NO FIXTURE DIRECTORY FOUND" << LF; + cout << "=========================================" << LF; + return string (); } diff --git a/moebius/xmake.lua b/moebius/xmake.lua index add29714a1..483776dea1 100644 --- a/moebius/xmake.lua +++ b/moebius/xmake.lua @@ -142,3 +142,66 @@ cpp_bench_on_all_plat = os.files("bench/**_bench.cpp") for _, filepath in ipairs(cpp_bench_on_all_plat) do add_bench_target (filepath) end + +task("test-with-log") + set_menu { + usage = "xmake test-with-log", + description = "Run tests and print stdout/stderr on failure" + } + + on_run(function () + local failed = false + + try + { + function () + os.execv("xmake", { + "test", + "-vD", + "moebius_tests/*" + }) + end, + + catch + { + function () + failed = true + end + } + } + + if not failed then + return + end + + print("") + print("========================================") + print("TEST FAILED - DUMPING TEST LOGS") + print("========================================") + + local stdout_log = + path.absolute("../build/.gens/moebius_tests_loro_tmu_test/macosx/arm64/releasedbg/tests/moebius_tests/loro_tmu_test.stdout.log") + + local stderr_log = + path.absolute("../build/.gens/moebius_tests_loro_tmu_test/macosx/arm64/releasedbg/tests/moebius_tests/loro_tmu_test.errors.log") + + print("") + print("========== stdout: " .. stdout_log .. " ==========") + + if os.isfile(stdout_log) then + print(io.readfile(stdout_log)) + else + print("stdout log not found") + end + + print("") + print("========== stderr: " .. stderr_log .. " ==========") + + if os.isfile(stderr_log) then + print(io.readfile(stderr_log)) + else + print("stderr log not found") + end + + os.raise("tests failed") + end) \ No newline at end of file