foxygit / Torlinkc Log in
commits tags

/.github/workflows/ci.yml · 2.01 KB

raw
name: CI

on:
  push:
    branches: [main]
  pull_request:

permissions:
  contents: read

# A new push to the same branch supersedes the run in flight.
concurrency:
  group: ci-${{ github.ref }}
  cancel-in-progress: true

jobs:
  build:
    # Linux only for now: the rewrite targets Linux/macOS first and Windows
    # is explicitly deferred (no daemonize/attach equivalent yet). macOS is
    # meant to follow once Phase 0 is proven here, not day one.
    name: build & smoke test (ubuntu)
    runs-on: ubuntu-latest
    timeout-minutes: 15

    steps:
      - uses: actions/checkout@v7

      # libtorrent-rasterbar, ftxui, curl, nlohmann-json, and doctest all ship
      # dev packages (+ CMake config files, where they need one) directly in
      # Debian/Ubuntu, so no vcpkg bootstrap is needed.
      - name: Install toolchain and libraries
        run: |
          sudo apt-get update
          sudo apt-get install -y --no-install-recommends \
            cmake build-essential pkgconf \
            libtorrent-rasterbar-dev libftxui-dev \
            libboost-system-dev libssl-dev \
            libcurl4-openssl-dev nlohmann-json3-dev doctest-dev

      - name: Configure
        run: cmake -S . -B build -DCMAKE_BUILD_TYPE=RelWithDebInfo

      - name: Build
        run: cmake --build build -j"$(nproc)"

      - name: Run test suite
        working-directory: build
        run: ctest --output-on-failure

      # Phase 0 smoke tests: prove the toolchain actually runs, not just links.
      # libtorrent_hello needs no network guarantee to pass (peers may or may
      # not be reachable from a CI runner) — it only has to start, poll
      # alerts, and shut down cleanly within the timeout.
      - name: Smoke test libtorrent hello-world
        run: timeout 20 ./build/phase0/libtorrent_hello

      # No real TTY in CI, so ftxui_hello self-exits via this env var instead
      # of waiting on a keypress.
      - name: Smoke test FTXUI hello-world
        run: TORLINK_PHASE0_AUTOEXIT=1 timeout 10 ./build/phase0/ftxui_hello < /dev/null