rtic-syntax 1.0.3

The Real-Time Interrupt-driven Concurrency (RTIC) meta language
Documentation
name: Build
on:
  pull_request:
  push:
    branches:
      - master
      - staging
      - trying
      - bors/staging
      - bors/trying

env:
  CARGO_TERM_COLOR: always

jobs:
  # Run cargo fmt --check
  style:
    name: style
    runs-on: ubuntu-22.04
    steps:
      - name: Checkout
        uses: actions/checkout@v3

      - name: Fail on warnings
        run: sed -i 's,//deny_warnings_placeholder_for_ci,#![deny(warnings)],' src/lib.rs

      - name: cargo fmt --check
        run:  cargo fmt --all -- --check

  # Compilation check
  check:
    name: check
    runs-on: ubuntu-22.04
    strategy:
      matrix:
        target:
          - x86_64-unknown-linux-gnu
        toolchain:
          - stable
    steps:
      - name: Checkout
        uses: actions/checkout@v3

      - name: Install Rust ${{ matrix.toolchain }}
        run: |
          rustup set profile minimal
          rustup override set ${{ matrix.toolchain }}

      - name: Configure Rust target (${{ matrix.target }})
        run: rustup target add ${{ matrix.target }}

      - name: Fail on warnings
        run: sed -i 's,//deny_warnings_placeholder_for_ci,#![deny(warnings)],' src/lib.rs

      - name: Cache Dependencies
        uses: Swatinem/rust-cache@v2

      - name: cargo check
        run: cargo check --target=${{ matrix.target }}

  # Clippy
  clippy:
    name: Cargo clippy
    runs-on: ubuntu-22.04
    steps:
      - name: Checkout
        uses: actions/checkout@v3

      - name: Fail on warnings
        run: sed -i 's,//deny_warnings_placeholder_for_ci,#![deny(warnings)],' src/lib.rs

      - name: Add Rust component clippy
        run: rustup component add clippy

      - name: Cache Dependencies
        uses: Swatinem/rust-cache@v2

      - name: cargo clippy
        run: cargo clippy

  # Verify all examples
  testexamples:
    name: testexamples
    runs-on: ubuntu-22.04
    strategy:
      matrix:
        target:
          - x86_64-unknown-linux-gnu
        toolchain:
          - stable
    steps:
      - name: Checkout
        uses: actions/checkout@v3

      - name: Install Rust ${{ matrix.toolchain }}
        run: |
          rustup set profile minimal
          rustup override set ${{ matrix.toolchain }}

      - name: Configure Rust target (${{ matrix.target }})
        run: rustup target add ${{ matrix.target }}

      - name: Cache Dependencies
        uses: Swatinem/rust-cache@v2

      - name: Fail on warnings
        run: sed -i 's,//deny_warnings_placeholder_for_ci,#![deny(warnings)],' src/lib.rs

      - name: cargo test --test ui
        run: cargo test --examples

  # Run test suite for UI
  testui:
    name: testui
    runs-on: ubuntu-22.04
    strategy:
      matrix:
        target:
          - x86_64-unknown-linux-gnu
        toolchain:
          - stable
    steps:
      - name: Checkout
        uses: actions/checkout@v3

      - name: Install Rust ${{ matrix.toolchain }}
        run: |
          rustup set profile minimal
          rustup override set ${{ matrix.toolchain }}

      - name: Configure Rust target (${{ matrix.target }})
        run: rustup target add ${{ matrix.target }}

      - name: Cache Dependencies
        uses: Swatinem/rust-cache@v2

      - name: Fail on warnings
        run: sed -i 's,//deny_warnings_placeholder_for_ci,#![deny(warnings)],' src/lib.rs

      - name: cargo test --test ui
        run: cargo test --test ui

  # Run test suite
  test:
    name: test
    runs-on: ubuntu-22.04
    strategy:
      matrix:
        target:
          - thumbv7m-none-eabi
        toolchain:
          - stable

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

      - name: Install Rust ${{ matrix.toolchain }}
        run: |
          rustup set profile minimal
          rustup override set ${{ matrix.toolchain }}

      - name: Cache Dependencies
        uses: Swatinem/rust-cache@v2

      - name: Fail on warnings
        run: sed -i 's,//deny_warnings_placeholder_for_ci,#![deny(warnings)],' src/lib.rs

      - name: cargo test --test ui
        run: cargo test --lib

  # Refs: https://github.com/rust-lang/crater/blob/9ab6f9697c901c4a44025cf0a39b73ad5b37d198/.github/workflows/bors.yml#L125-L149
  #
  # ALL THE PREVIOUS JOBS NEEDS TO BE ADDED TO THE `needs` SECTION OF THIS JOB!

  ci-success:
    name: ci
    if: github.event_name == 'push' && success()
    needs:
      - style
      - check
      - clippy
      - testexamples
      - test
      - testui
    runs-on: ubuntu-22.04
    steps:
      - name: Mark the job as a success
        run: exit 0