svd2rust 0.25.1

Generate Rust register maps (`struct`s) from SVD files
Documentation
on:
  push:
    branches: [ staging, trying, master ]
  pull_request:

name: Continuous integration

jobs:
  ci:
    name: CI
    runs-on: ubuntu-latest
    needs: [check, ci-linux, ci-clippy, ci-serde]
    steps:
      - name: Done
        run: exit 0

  check:
    name: Cargo check
    runs-on: ubuntu-latest
    strategy:
      matrix:
        TARGET: [x86_64-unknown-linux-gnu, x86_64-apple-darwin, x86_64-pc-windows-msvc]

    steps:
      - uses: actions/checkout@v3

      - uses: actions-rs/toolchain@v1
        with:
          profile: minimal
          toolchain: stable
          override: true
          target: ${{ matrix.TARGET }}

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

      - uses: actions-rs/cargo@v1
        with:
          command: check
          args: --target ${{ matrix.TARGET }}

  ci-linux:
    runs-on: ubuntu-latest
    needs: [check]
    strategy:
      matrix:
        # All generated code should be running on stable now
        rust: [stable]

        # All vendor files we want to test on stable
        vendor: [Atmel, Freescale, Fujitsu, GD32, Holtek, Microchip, Nordic, Nuvoton, NXP, RISC-V, SiliconLabs, Spansion, STMicro, Toshiba]

        # Options are all, none, strict and const
        options: [all, none]
        exclude:
          - vendor: Fujitsu
            options: all
          - vendor: Spansion
            options: all
          - vendor: STMicro
            options: all
          - vendor: Nuvoton
            options: all
          - vendor: Microchip
            options: all
          - vendor: RISC-V
            options: all
        include:
          # Test MSRV
          - rust: 1.60.0
            vendor: Nordic

          # Use nightly for architectures which don't support stable
          - rust: nightly
            vendor: OTHER

          # Use nightly for architectures which don't support stable
          - rust: nightly
            vendor: Espressif

    steps:
      - uses: actions/checkout@v3

      - uses: actions-rs/toolchain@v1
        with:
          profile: minimal
          toolchain: ${{ matrix.rust }}
          override: true

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

      - name: Self install
        run: |
          cargo install svd2rust --path .

      - name: Run CI script for `${{ matrix.vendor }}` under rust `${{ matrix.rust }}` with options=`${{ matrix.options }}`
        env:
          VENDOR: ${{ matrix.vendor }}
          OPTIONS: ${{ matrix.options }}
          COMMAND: check
        run: bash ci/script.sh

  ci-clippy:
    runs-on: ubuntu-latest
    needs: [check]
    steps:
      - uses: actions/checkout@v3

      - uses: actions-rs/toolchain@v1
        with:
          profile: minimal
          toolchain: stable
          override: true

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

      - name: Self install
        run: |
          cargo install svd2rust --path .

      - name: Run CI script
        env:
          VENDOR: RISC-V
          OPTIONS: all
          COMMAND: clippy
        run: bash ci/script.sh

  ci-serde:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v3

      - uses: actions-rs/toolchain@v1
        with:
          profile: minimal
          toolchain: stable
          override: true

      - name: Cache
        uses: Swatinem/rust-cache@v2
        with:
          key: svdtools-0.2.3

      - name: Install svdtools
        run: |
          cargo install svdtools --version 0.2.3 --target-dir target

      - name: Run CI script
        run: |
          wget https://stm32-rs.github.io/stm32-rs/stm32f411.svd.patched
          svdtools convert --input-format xml stm32f411.svd.patched stm32f411.yaml
          cargo run --release -- -i stm32f411.yaml

  fmt:
    name: Rustfmt
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v3

      - uses: actions-rs/toolchain@v1
        with:
          profile: minimal
          toolchain: stable
          override: true
          components: rustfmt

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

      - uses: actions-rs/cargo@v1
        with:
          command: fmt
          args: --all -- --check