flip-link 0.1.12

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: thumbv7em-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 --no-self-update
          rustup default stable
      - name: Install Rust target for cross-compilation
        run: rustup target add ${{ env.CORE_TARGET }}

      # 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/

  ci-success:
    name: CI finished successfully
    runs-on: ubuntu-latest
    if: success()
    needs:
        - test
        - static-checks
    steps:
        - name: Mark the build as successful
          run: exit 0