flip-link 0.1.7

Flips the memory layout of embedded programs to protect against stack overflows
name: CI

on:
  pull_request:
    branches: [main]
  schedule:
    # runs 1 min after 2 or 1 AM (summer/winter) berlin time
    - cron: "1 0 * * *"
  merge_group:

env:
  CARGO_TERM_COLOR: always
  CORE_TARGET: thumbv7m-none-eabi # needed by `core`

jobs:
  test:
    strategy:
      matrix:
        os:
          - ubuntu-latest
          - macOS-latest
          - windows-latest
    runs-on: ${{ matrix.os }}
    timeout-minutes: 20
    steps:
      - uses: actions/checkout@v3

      # install Rust
      - name: Use the latest stable release
        run: rustup update stable && rustup default stable
      - name: Install Rust target for cross-compilation
        run: rustup target add ${{ env.CORE_TARGET }}

      # caching
      - name: make rustc version available to cache keys
        id: rustc
        run: echo "::set-output name=version::$(rustc -V)"
      - name: cache Cargo registry
        uses: actions/cache@v3
        with:
          path: |
            ~/.cargo/registry/cache
            ~/.cargo/registry/index
          key: cargo-registry-${{ hashFiles('**/Cargo.lock') }}
          restore-keys: |
            cargo-registry-
      - name: cache Cargo build artifacts
        uses: actions/cache@v3
        with:
          path: target
          key: cargo-target-${{ runner.os }}-${{ steps.rustc.outputs.version }}-${{ hashFiles('**/Cargo.lock') }}
          restore-keys: |
            cargo-target-${{ runner.os }}-${{ steps.rustc.outputs.version }}-

      # run tests
      - name: Run testsuite
        run: cargo xtest

  static-checks:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v3

      # install Rust
      - name: Use the latest stable release
        run: rustup update stable && rustup default stable

      # run tests
      - run: cargo fmt -- --check
      - run: cargo fmt -- --check
        working-directory: test-flip-link-app/
      - run: cargo clippy -- --deny warnings
      - run: cargo clippy -- --deny warnings
        working-directory: test-flip-link-app/