flip-link 0.1.4

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

on:
  push:
    branches: [ main, staging, trying ]
  pull_request:
    branches: [ main ]
  schedule:
    # runs 1 min after 2 or 1 AM (summer/winter) berlin time
    - cron: '1 0 * * *'
env:
  CARGO_TERM_COLOR: always
  APP_NAME: test-flip-link-app
  CORE_TARGET: thumbv7m-none-eabi # needed by `core`

jobs:
  test:
    strategy:
      matrix:
        rust:
          - stable
          - nightly
        os:
          - ubuntu-latest
          - macOS-latest
          - windows-latest
    runs-on: ${{ matrix.os }}
    timeout-minutes: 10
    steps:
      - uses: actions/checkout@v2
      - uses: actions-rs/toolchain@v1
        with:
          profile: minimal
          toolchain: ${{ matrix.rust }}
          override: true
      - name: Build
        run: RUSTFLAGS='--deny warnings' cargo build
        shell: bash

  static-checks:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v2
      - uses: actions-rs/toolchain@v1
        with:
          profile: minimal
          toolchain: stable
          override: true
          components: clippy, rustfmt
      - run: cargo fmt --all -- --check
      - uses: actions-rs/clippy-check@v1
        with:
          token: ${{ secrets.GITHUB_TOKEN }}

  build_app:
    strategy:
      matrix:
        rust:
          - stable
          - nightly
        os:
          - ubuntu-latest
          - macOS-latest
          - windows-latest
    runs-on: ${{ matrix.os }}
    timeout-minutes: 20
    steps:
      - name: Check out flip-link repo
        uses: actions/checkout@v2
      - uses: actions-rs/toolchain@v1
        with:
          profile: minimal
          toolchain: ${{ matrix.rust }}
          override: true
          target: ${{ env.CORE_TARGET }}
      - name: Install dependencies
        run: |
          cargo install --debug --path .
      - name: Build App
        run: |
          cd ${{ env.APP_NAME }}
          cargo build --examples

  # Refs: https://github.com/rust-lang/crater/blob/9ab6f9697c901c4a44025cf0a39b73ad5b37d198/.github/workflows/bors.yml#L125-L149
  # bors.tech integration
  ci-success:
    name: ci
    if: success()
    needs:
      - build_app
      - static-checks
      - test
    runs-on: ubuntu-latest
    steps:
      - name: CI succeeded
        run: exit 0