oscall 0.0.0

Low-level cross-platform interface to operating system services: files, memory mapping, networking and more, with no libc on Linux
Documentation
name: CI

on:
  push:
    branches: [master]
  pull_request:

# A newer push to the same branch (or PR) supersedes this run: cancel the
# older one instead of queueing every intermediate commit.
concurrency:
  group: ${{ github.workflow }}-${{ github.event_name }}-${{ github.ref }}
  cancel-in-progress: true

permissions:
  contents: read

env:
  CARGO_TERM_COLOR: always

jobs:
  test:
    # Every operating system on the runners' own architecture.
    name: Test & lint (${{ matrix.os }})
    runs-on: ${{ matrix.os }}
    strategy:
      fail-fast: false
      matrix:
        os:
          - ubuntu-latest # Linux x86_64
          - ubuntu-24.04-arm # Linux aarch64
          - macos-latest # macOS aarch64
          - macos-15-intel # macOS x86_64
          - windows-latest # Windows x86_64
          - windows-11-arm # Windows aarch64
    steps:
      - uses: actions/checkout@v7

      - name: Install Rust
        uses: dtolnay/rust-toolchain@stable
        with:
          components: rustfmt, clippy

      - name: Cache
        uses: Swatinem/rust-cache@v2
        with:
          key: ${{ matrix.os }}

      - name: Format
        if: matrix.os == 'ubuntu-latest' # formatting is platform-independent
        run: cargo fmt --all --check

      - name: Clippy (all features, warnings denied)
        run: cargo clippy --all-targets --all-features -- -D warnings

      - name: Clippy (no_std, warnings denied)
        run: cargo clippy --all-targets --no-default-features -- -D warnings

      - name: Test (all features)
        run: cargo test --all-features

      - name: Test (no_std)
        run: cargo test --no-default-features

  cross:
    # The architectures the runners don't have natively. Linux tests are
    # static musl binaries linked with rust-lld (no cross toolchain needed);
    # foreign ones run under qemu-user through binfmt_misc.
    name: Test (${{ matrix.target }})
    runs-on: ${{ matrix.os }}
    strategy:
      fail-fast: false
      matrix:
        include:
          - { os: ubuntu-latest, target: x86_64-unknown-linux-musl }
          # 32-bit x86 runs natively on x86_64, on Linux and on Windows.
          - { os: ubuntu-latest, target: i686-unknown-linux-musl }
          - { os: windows-latest, target: i686-pc-windows-msvc }
          - { os: ubuntu-24.04-arm, target: aarch64-unknown-linux-musl }
          # The arm64 runners can't execute 32-bit ARM code: emulate it.
          - { os: ubuntu-latest, target: armv7-unknown-linux-musleabihf, qemu: arm }
          - { os: ubuntu-latest, target: riscv64gc-unknown-linux-musl, qemu: riscv64 }
    steps:
      - uses: actions/checkout@v7

      - name: Install Rust
        uses: dtolnay/rust-toolchain@stable
        with:
          targets: ${{ matrix.target }}

      - name: Cache
        uses: Swatinem/rust-cache@v2
        with:
          key: ${{ matrix.target }}

      - name: Set up qemu-user
        if: matrix.qemu
        uses: docker/setup-qemu-action@v3
        with:
          platforms: ${{ matrix.qemu }}

      - name: Link static musl binaries with rust-lld
        if: runner.os == 'Linux'
        run: |
          target_env=$(tr 'a-z-' 'A-Z_' <<<"${{ matrix.target }}")
          echo "CARGO_TARGET_${target_env}_LINKER=rust-lld" >> "$GITHUB_ENV"
          # Not every musl target is static and self-contained by default.
          echo "CARGO_TARGET_${target_env}_RUSTFLAGS=-C target-feature=+crt-static -C link-self-contained=yes" >> "$GITHUB_ENV"

      - name: Test (all features)
        run: cargo test --all-features --target ${{ matrix.target }}

      - name: Test (no_std)
        run: cargo test --no-default-features --target ${{ matrix.target }}

  fullrust:
    # Libc-free static binaries built with fullrust
    # (https://github.com/KarpelesLab/fullrust), where target_os = "fullrust"
    # and cfg(unix) is false. aarch64 and armv7 run under the image's qemu-user.
    name: fullrust (${{ matrix.target }})
    runs-on: ubuntu-latest
    strategy:
      fail-fast: false
      matrix:
        target:
          - x86_64-unknown-linux-fullrust
          - aarch64-unknown-linux-fullrust
          - i686-unknown-linux-fullrust
          - armv7-unknown-linux-fullrusteabihf
    steps:
      - uses: actions/checkout@v7

      # Doc-tests are skipped: the fullrust toolchain ships no rustdoc.
      - name: Test (all features)
        uses: KarpelesLab/fullrust@master
        with:
          command: test
          target: ${{ matrix.target }}
          args: --lib --tests --all-features

      - name: Test (no_std)
        uses: KarpelesLab/fullrust@master
        with:
          command: test
          target: ${{ matrix.target }}
          args: --lib --tests --no-default-features

  check:
    # Targets with no runner and no emulator here: type-check and lint only.
    name: Check (${{ matrix.target }})
    runs-on: ubuntu-latest
    strategy:
      fail-fast: false
      matrix:
        target:
          - riscv64gc-unknown-linux-gnu
          - armv7-unknown-linux-gnueabihf
          - arm-unknown-linux-gnueabihf
          - i686-unknown-linux-gnu
          - x86_64-pc-windows-gnu
          - aarch64-pc-windows-gnullvm
    steps:
      - uses: actions/checkout@v7

      - name: Install Rust
        uses: dtolnay/rust-toolchain@stable
        with:
          components: clippy
          targets: ${{ matrix.target }}

      - name: Clippy (all features, warnings denied)
        run: cargo clippy --all-targets --all-features --target ${{ matrix.target }} -- -D warnings

  msrv:
    name: MSRV (1.95)
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v7

      - name: Install Rust 1.95
        uses: dtolnay/rust-toolchain@1.95

      - name: Check
        run: cargo check --all-targets --all-features