macro_pub 0.1.0

polyfill proc-macro for visibility scoped macros
Documentation
name: CI
on:
  pull_request:

env:
  CARGO_INCREMENTAL: 0
  CARGO_NET_RETRY: 10
  RUSTUP_MAX_RETRIES: 10
  RUST_BACKTRACE: short

jobs:
  style:
    name: Check lints
    runs-on: ubuntu-latest

    steps:
      - name: Checkout repository
        uses: actions/checkout@v3

      # Pinned version to avoid unrelated breakage in PRs
      - name: Install 1.59 toolchain
        uses: actions-rs/toolchain@v1
        with:
          toolchain: 1.59
          profile: minimal
          components: clippy
          override: true

      - name: Generate lockfile for cache
        uses: actions-rs/cargo@v1
        with:
          command: generate-lockfile

      - name: Setup cache
        uses: Swatinem/rust-cache@v1

      - name: Check style
        uses: actions-rs/cargo@v1
        with:
          command: clippy
          args: --all-features --all-targets -- -Dwarnings

  format:
    name: Check formatting
    runs-on: ubuntu-latest

    steps:
      - name: Checkout repository
        uses: actions/checkout@v3

      # Pinned version to avoid unrelated breakage in PRs
      - name: Install nighly (2022-04-02) toolchain
        uses: actions-rs/toolchain@v1
        with:
          toolchain: nightly-2022-04-02
          profile: minimal
          components: rustfmt
          override: true

      - name: Check formatting
        uses: actions-rs/cargo@v1
        with:
          command: fmt
          args: -- --check

  tests:
    name: Run tests (ubuntu-latest)
    uses: ./.github/workflows/run-tests.yaml
    with:
      os: ubuntu-latest

  tests-win:
    name: Run tests (windows-latest)
    needs: tests
    uses: ./.github/workflows/run-tests.yaml
    with:
      os: windows-latest

  tests-mac:
    name: Run tests (macOS-latest)
    needs: tests
    uses: ./.github/workflows/run-tests.yaml
    with:
      os: macOS-latest

  tests-wasi:
    name: Run tests (wasi)
    runs-on: ubuntu-latest
    needs: tests

    steps:
      - name: Checkout repository
        uses: actions/checkout@v3

      - name: Install stable toolchain
        uses: actions-rs/toolchain@v1
        with:
          target: wasm32-wasi
          toolchain: stable
          profile: minimal
          override: true

      - name: Generate lockfile for cache
        uses: actions-rs/cargo@v1
        with:
          command: generate-lockfile

      - name: Setup cache
        uses: Swatinem/rust-cache@v1

      - name: Install wasmtime
        uses: taiki-e/install-action@wasmtime

      - name: Refresh sh profile
        run: source ~/.profile

      - name: Install cargo-wasi
        uses: actions-rs/cargo@v1
        with:
          command: install
          args: cargo-wasi

      - name: Build tests
        uses: actions-rs/cargo@v1
        with:
          command: wasi
          args: test --all-features --all-targets --no-run

      - name: Run tests
        uses: actions-rs/cargo@v1
        with:
          command: wasi
          args: test --all-features --all-targets -- --nocapture

  msrv:
    name: Check supported versions
    runs-on: ubuntu-latest
    needs: tests

    steps:
      - name: Checkout repository
        uses: actions/checkout@v3

      - name: Install cargo-hack
        uses: taiki-e/install-action@cargo-hack

      - name: Check all versions
        uses: actions-rs/cargo@v1
        with:
          command: hack
          args: --version-range 1.56.. check --lib

  doc:
    name: Check rustdoc works
    runs-on: ubuntu-latest
    needs: tests

    steps:
      - name: Checkout repository
        uses: actions/checkout@v3

      - name: Install stable toolchain
        uses: actions-rs/toolchain@v1
        with:
          toolchain: stable
          profile: minimal

      # Pinned version to avoid unrelated breakage in PRs
      - name: Install nighly (2022-04-02) toolchain
        uses: actions-rs/toolchain@v1
        with:
          toolchain: nightly-2022-04-02
          profile: minimal

      - name: Document examples (stable)
        uses: actions-rs/cargo@v1
        with:
          command: +stable
          args: doc --examples --no-deps

      - name: Document examples (nightly)
        uses: actions-rs/cargo@v1
        with:
          command: +nightly-2022-04-02
          args: doc --examples --no-deps