ui_test 0.30.4

A test framework for testing rustc diagnostics output
Documentation
name: Rust

on:
  push:
    branches: [ "main" ]
  pull_request:
    branches: [ "main" ]

env:
  CARGO_TERM_COLOR: always

jobs:
  fmt:
    name: check rustfmt
    runs-on: ubuntu-latest
    steps:
    - uses: actions/checkout@v4
    - name: install rustfmt
      run: rustup component add rustfmt
    - name: Format
      run: cargo fmt --check

  clippy:
    name: check clippy
    runs-on: ubuntu-latest
    steps:
    - uses: actions/checkout@v4
    - name: install clippy
      run: rustup component add clippy
    - name: Clippy
      run: cargo clippy --locked -- -D warnings

  tests:
    strategy:
      matrix:
        include:
          - os: ubuntu-latest
            host_target: x86_64-unknown-linux-gnu
          - os: macos-latest
            host_target: x86_64-apple-darwin
          - os: windows-latest
            host_target: i686-pc-windows-msvc
    runs-on: ${{ matrix.os }}
    # Run tests under a directory with a space in it to double check the windows path heuristic
    defaults:
      run:
        working-directory: "dir with spaces/ui test"
    steps:
    - uses: actions/checkout@v4
      with:
        path: "dir with spaces/ui test"
    - name: Build
      run: cargo build --verbose
    - name: Run ui tests
      run: cargo test --verbose --test integration -- --check
    - name: Run unit tests
      run: cargo test --verbose
    - name: Test no-rustc mode
      run: cargo test --no-default-features

  build-std:
    strategy:
      matrix:
        include:
          - os: ubuntu-latest
            host_target: x86_64-unknown-linux-gnu
          - os: macos-latest
            host_target: x86_64-apple-darwin
          - os: windows-latest
            host_target: i686-pc-windows-msvc
    runs-on: ${{ matrix.os }}
    # Run tests under a directory with a space in it to double check the windows path heuristic
    defaults:
      run:
        working-directory: "dir with spaces/build std"
    steps:
    - uses: actions/checkout@v4
      with:
        path: "dir with spaces/build std"
    - uses: dtolnay/rust-toolchain@nightly
      with:
        components: rust-src
    - name: Install rustc-src component
      run: rustup toolchain install nightly && rustup +nightly component add rust-src
    - name: Run build-std test
      run: cargo +nightly test --verbose --test build_std