ci(macos): fold interop scripts into shell test step without --leaks #583
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: CI | |
| on: | |
| push: | |
| branches: ["**"] | |
| pull_request: | |
| branches: ["**"] | |
| jobs: | |
| build-and-test: | |
| name: Build, lint, and test | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: Set up Go | |
| uses: actions/setup-go@v5 | |
| with: | |
| go-version-file: go.mod | |
| cache: true | |
| - name: Install clang + LLVM tools (opt + lld) required by tin codegen | |
| run: | | |
| sudo apt-get update -qq | |
| sudo apt-get install -y clang lld llvm valgrind libunwind-dev libdw-dev | |
| clang --version | |
| opt --version | head -2 | |
| ld.lld --version | |
| - name: Build compiler | |
| run: go build -o tin . | |
| - name: Verify inline channel fast path is generated | |
| run: | | |
| ir=$(./tin ir examples/bench/channel_latency.tin 2>/dev/null) | |
| echo "$ir" | grep -q 'call i32 @_tin_channel_recv_direct' || { echo "FAIL: _tin_channel_recv_direct not found in IR (fast recv path regressed)"; exit 1; } | |
| echo "$ir" | grep -q 'call i32 @_tin_channel_send_blocking' || { echo "FAIL: _tin_channel_send_blocking not found in IR (fast send path regressed)"; exit 1; } | |
| echo "ok: inline channel fast path verified" | |
| - name: golangci-lint | |
| uses: golangci/golangci-lint-action@v7 | |
| with: | |
| version: v2.5.0 | |
| args: --timeout=5m | |
| - name: Run example tests | |
| run: ./tin test examples/... -lm | |
| - name: Run fiber example tests | |
| run: | | |
| for f in examples/fibers/*.tin; do | |
| name=$(basename "$f" .tin) | |
| echo "=== $name ===" | |
| ./tin build "$f" -o "/tmp/tin_fiber_${name}" -lm | |
| "/tmp/tin_fiber_${name}" | |
| done | |
| - name: Run fiber examples under valgrind | |
| run: | | |
| # stress_10k spawns 10,000 OS threads which exhausts valgrind's memory. | |
| # stress_100 covers the same logic with a valgrind-safe thread count. | |
| # Use build-test so files with `test "..."` blocks run their test runner; | |
| # files with fn{#async} main() build identically to `build`. | |
| for f in \ | |
| examples/fibers/auto_yield.tin \ | |
| examples/fibers/basic_spawn.tin \ | |
| examples/fibers/channel_correctness.tin \ | |
| examples/fibers/channel_mpmc.tin \ | |
| examples/fibers/channel_pingpong.tin \ | |
| examples/fibers/fiber_syntax_edge_cases.tin \ | |
| examples/fibers/panic_propagation.tin \ | |
| examples/fibers/stress_100.tin \ | |
| examples/fibers/sync_mutex.tin \ | |
| examples/fibers/yield_cpu.tin; do | |
| name=$(basename "$f" .tin) | |
| echo "=== valgrind: $name ===" | |
| ./tin build-test "$f" -o "/tmp/tin_fiber_vg_${name}" -lm | |
| valgrind --error-exitcode=1 --leak-check=full "/tmp/tin_fiber_vg_${name}" | |
| done | |
| - name: Run ARC stress tests (non-fiber) under valgrind | |
| run: | | |
| for f in examples/arc_stress/*.tin; do | |
| [[ "$(basename "$f")" == fiber_* ]] && continue | |
| name=$(basename "$f" .tin) | |
| echo "=== valgrind: $name ===" | |
| ./tin build "$f" -o "/tmp/tin_arc_${name}" -lm | |
| valgrind --error-exitcode=1 --leak-check=no "/tmp/tin_arc_${name}" | |
| done | |
| - name: Run ARC stress tests (fiber) without valgrind | |
| # Fiber tests spawn many OS threads; valgrind over multi-threaded | |
| # programs is too slow and causes spurious use-after-free reports | |
| # due to thread scheduling races that do not occur in practice. | |
| # Run natively instead (same approach used for stress_10k above). | |
| run: | | |
| for f in examples/arc_stress/fiber_*.tin; do | |
| name=$(basename "$f" .tin) | |
| echo "=== $name ===" | |
| ./tin build "$f" -o "/tmp/tin_arc_${name}" -lm | |
| "/tmp/tin_arc_${name}" | |
| done | |
| - name: Run echo server stress test | |
| run: | | |
| ./tin build examples/echo_server/echo_server_bad.tin -o /tmp/echo_server_bad | |
| python3 examples/echo_server/stress_test.py | |
| - name: Run UDP echo server stress test | |
| run: | | |
| ./tin build examples/udp_echo_server/udp_echo_server.tin -o /tmp/udp_echo_server -lm | |
| TIN_UDP_SERVER=/tmp/udp_echo_server python3 examples/udp_echo_server/stress_test.py | |
| - name: Run Unix socket echo server stress test | |
| run: | | |
| ./tin build examples/unix_echo_server/unix_echo_server.tin -o /tmp/unix_echo_server -lm | |
| TIN_UNIX_SERVER=/tmp/unix_echo_server python3 examples/unix_echo_server/stress_test.py | |
| - name: Run I/O stress tests under valgrind | |
| # Uses build-test so the same binary that runs under `tin test` is | |
| # checked for memory errors. --leak-check=no matches the policy used | |
| # for all other fiber tests (fibers use OS threads; leak accounting | |
| # across thread stacks produces false positives). | |
| run: | | |
| for f in examples/io_stress/*.tin; do | |
| name=$(basename "$f" .tin) | |
| echo "=== valgrind: $name ===" | |
| ./tin build-test "$f" -o "/tmp/tin_io_${name}.test" -lm | |
| valgrind --error-exitcode=1 --leak-check=no "/tmp/tin_io_${name}.test" | |
| done | |
| build-and-test-arm64: | |
| name: Build and test (arm64) | |
| runs-on: ubuntu-24.04-arm | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: Set up Go | |
| uses: actions/setup-go@v5 | |
| with: | |
| go-version-file: go.mod | |
| cache: true | |
| - name: Install clang + LLVM tools (opt + lld) + valgrind | |
| run: | | |
| sudo apt-get update -qq | |
| sudo apt-get install -y clang lld llvm valgrind libunwind-dev libdw-dev | |
| clang --version | |
| opt --version | head -2 | |
| ld.lld --version | |
| - name: Build compiler | |
| run: go build -o tin . | |
| - name: Verify inline channel fast path is generated | |
| run: | | |
| ir=$(./tin ir examples/bench/channel_latency.tin 2>/dev/null) | |
| echo "$ir" | grep -q 'call i32 @_tin_channel_recv_direct' || { echo "FAIL: _tin_channel_recv_direct not found in IR (fast recv path regressed)"; exit 1; } | |
| echo "$ir" | grep -q 'call i32 @_tin_channel_send_blocking' || { echo "FAIL: _tin_channel_send_blocking not found in IR (fast send path regressed)"; exit 1; } | |
| echo "ok: inline channel fast path verified" | |
| - name: Run example tests | |
| run: ./tin test examples/... -lm | |
| - name: Run fiber example tests | |
| run: | | |
| for f in examples/fibers/*.tin; do | |
| name=$(basename "$f" .tin) | |
| echo "=== $name ===" | |
| ./tin build "$f" -o "/tmp/tin_fiber_${name}" -lm | |
| "/tmp/tin_fiber_${name}" | |
| done | |
| - name: Run fiber examples under valgrind | |
| run: | | |
| for f in \ | |
| examples/fibers/auto_yield.tin \ | |
| examples/fibers/basic_spawn.tin \ | |
| examples/fibers/channel_correctness.tin \ | |
| examples/fibers/channel_mpmc.tin \ | |
| examples/fibers/channel_pingpong.tin \ | |
| examples/fibers/fiber_syntax_edge_cases.tin \ | |
| examples/fibers/panic_propagation.tin \ | |
| examples/fibers/stress_100.tin \ | |
| examples/fibers/sync_mutex.tin \ | |
| examples/fibers/yield_cpu.tin; do | |
| name=$(basename "$f" .tin) | |
| echo "=== valgrind: $name ===" | |
| ./tin build-test "$f" -o "/tmp/tin_fiber_vg_${name}" -lm | |
| valgrind --error-exitcode=1 --leak-check=full "/tmp/tin_fiber_vg_${name}" | |
| done | |
| - name: Run ARC stress tests (non-fiber) under valgrind | |
| run: | | |
| for f in examples/arc_stress/*.tin; do | |
| [[ "$(basename "$f")" == fiber_* ]] && continue | |
| name=$(basename "$f" .tin) | |
| echo "=== valgrind: $name ===" | |
| ./tin build "$f" -o "/tmp/tin_arc_${name}" -lm | |
| valgrind --error-exitcode=1 --leak-check=no "/tmp/tin_arc_${name}" | |
| done | |
| - name: Run ARC stress tests (fiber) without valgrind | |
| run: | | |
| for f in examples/arc_stress/fiber_*.tin; do | |
| name=$(basename "$f" .tin) | |
| echo "=== $name ===" | |
| ./tin build "$f" -o "/tmp/tin_arc_${name}" -lm | |
| "/tmp/tin_arc_${name}" | |
| done | |
| - name: Run echo server stress test | |
| run: | | |
| ./tin build examples/echo_server/echo_server_bad.tin -o /tmp/echo_server_bad | |
| python3 examples/echo_server/stress_test.py | |
| - name: Run UDP echo server stress test | |
| run: | | |
| ./tin build examples/udp_echo_server/udp_echo_server.tin -o /tmp/udp_echo_server -lm | |
| TIN_UDP_SERVER=/tmp/udp_echo_server python3 examples/udp_echo_server/stress_test.py | |
| - name: Run Unix socket echo server stress test | |
| run: | | |
| ./tin build examples/unix_echo_server/unix_echo_server.tin -o /tmp/unix_echo_server -lm | |
| TIN_UNIX_SERVER=/tmp/unix_echo_server python3 examples/unix_echo_server/stress_test.py | |
| - name: Run I/O stress tests under valgrind | |
| run: | | |
| for f in examples/io_stress/*.tin; do | |
| name=$(basename "$f" .tin) | |
| echo "=== valgrind: $name ===" | |
| ./tin build-test "$f" -o "/tmp/tin_io_${name}.test" -lm | |
| valgrind --error-exitcode=1 --leak-check=no "/tmp/tin_io_${name}.test" | |
| done | |
| build-and-test-macos: | |
| name: Build and test (macOS arm64) | |
| runs-on: macos-latest | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: Set up Go | |
| uses: actions/setup-go@v5 | |
| with: | |
| go-version-file: go.mod | |
| cache: true | |
| - name: Install LLVM (opt, llc, ld64.lld) | |
| run: | | |
| brew install llvm | |
| echo "$(brew --prefix llvm)/bin" >> $GITHUB_PATH | |
| - name: Build compiler | |
| run: go build -o tin . | |
| - name: Run example tests | |
| run: ./tin test examples/... | |
| - name: Run stdlib tests | |
| run: ./tin test stdlib/... | |
| - name: Run shell test scripts | |
| run: | | |
| for f in \ | |
| examples/compiler_errors/test_errors.sh \ | |
| examples/const_fields_errors.sh \ | |
| examples/ctfe_stress_dispatch.sh \ | |
| examples/ctfe_stress_ir_checks.sh \ | |
| examples/escape_promotion.sh \ | |
| examples/incremental_cache_verify.sh \ | |
| examples/interop_errors.sh \ | |
| examples/maranget_exhaustive.sh \ | |
| examples/method_where_errors.sh \ | |
| examples/operator_errors.sh \ | |
| examples/operator_overload_phase0.sh \ | |
| examples/pattern_where_errors.sh \ | |
| examples/pure_fold_ir_checks.sh \ | |
| examples/pure_soundness_errors.sh \ | |
| examples/scoped_struct_tags_errors.sh \ | |
| examples/trait_coercion_errors.sh \ | |
| examples/unreachable_arm_warnings.sh \ | |
| examples/interop_closure_returns/run.sh \ | |
| examples/interop_stacktrace/run.sh; do | |
| echo "=== $f ===" | |
| bash "$f" | |
| done |