rustwide 0.28.0

Execute your code on the Rust ecosystem.
Documentation
name: CI

on:
  push:
    branches:
      - main
  pull_request:
    branches:
      - "**"

jobs:

  docs-rs:
    name: docs.rs build
    runs-on: ubuntu-latest
    continue-on-error: true
    permissions:
      contents: read
    steps:
      - name: Checkout the source code
        uses: actions/checkout@v7

      - uses: rust-lang/docs.rs/github-actions/build@main
        with:
          strict: true

  lint:
    name: Lint
    runs-on: ubuntu-latest
    steps:
      - name: Checkout the source code
        uses: actions/checkout@v7

      - name: Install Rust stable
        run: |
          rustup toolchain update --no-self-update stable
          rustup default stable
          rustup component add clippy rustfmt

      - name: Run rustfmt
        run: cargo fmt -- --check

      - name: Run clippy
        run: cargo clippy --all --all-features -- -Dwarnings

  msrv:
    name: MSRV (Rust 1.89)
    runs-on: ubuntu-22.04
    steps:
      - name: Checkout the source code
        uses: actions/checkout@v7

      - name: Install Rust 1.89
        run: rustup toolchain install --profile minimal 1.89

      - name: Check with MSRV
        run: cargo +1.89 check --workspace --all-targets --all-features

  test:
    name: Test
    runs-on: ${{ matrix.os }}
    strategy:
      matrix:
        os: [ubuntu-22.04, windows-latest]
        cargo_flags:
          - ""
          - "--no-default-features --features tls-native"
          - "--no-default-features --features tls-rustls"
          - "--features tracing"
          - "--all-features"
        docker_runtime:
          - ""
        include:
          # Integration tests are disabled on Windows as they take *way* too
          # long to pull the Docker image
          - os: windows-latest
            test_flags: --skip buildtest --skip integration --skip run_binary_with_same_name_as_file
          # run gvisor simple tests on old ubuntu for docs.rs server
          - os: ubuntu-22.04
            cargo_flags: ""
            docker_runtime: runsc
    steps:
      - name: Checkout the source code
        uses: actions/checkout@v7

      - name: Install Rust stable
        run: |
          rustup toolchain update --no-self-update stable
          rustup default stable

      - name: Build rustwide
        run: cargo build --all ${{ matrix.cargo_flags }}

      - name: Install gVisor
        if: matrix.docker_runtime == 'runsc'
        run: |
          sudo apt-get update
          sudo apt-get install -y apt-transport-https ca-certificates curl gnupg
          curl -fsSL https://gvisor.dev/archive.key | sudo gpg --dearmor -o /usr/share/keyrings/gvisor-archive-keyring.gpg
          echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/gvisor-archive-keyring.gpg] https://storage.googleapis.com/gvisor/releases release main" | sudo tee /etc/apt/sources.list.d/gvisor.list > /dev/null
          sudo apt-get update
          sudo apt-get install -y runsc
          sudo runsc install
          sudo systemctl restart docker
          docker run --rm --runtime=runsc hello-world

      # Having swap enabled causes problems with the OOM detector, so let's
      # disable all swapfiles before running the build.
      - name: Disable swap on Linux
        run: sudo swapoff -a
        if: startsWith(matrix.os, 'ubuntu-')

      - name: Test rustwide
        run: cargo test --all ${{ matrix.cargo_flags }} -- ${{ matrix.test_flags }}
        env:
          RUSTWIDE_DOCKER_RUNTIME: ${{ matrix.docker_runtime }}