name: no_std

on:
  push:
    branches: [ '**' ]
  pull_request:
    branches: [ '**' ]

env:
  CARGO_TERM_COLOR: always
  RUSTFLAGS: '-D warnings'

jobs:

  build-nostd:
    name: Build on no_std target (thumbv7em-none-eabi)
    runs-on: ubuntu-latest
    strategy:
      matrix:
        include:
          - crate: curve25519-dalek
          - crate: ed25519-dalek
          - crate: x25519-dalek
    steps:
      - uses: actions/checkout@v3
      - uses: dtolnay/rust-toolchain@master
        with:
          toolchain: stable
          targets: thumbv7em-none-eabi
      - uses: taiki-e/install-action@cargo-hack
      # No default features build
      - name: no_std / no feat ${{ matrix.crate }}
        run: cargo build -p ${{ matrix.crate }} --target thumbv7em-none-eabi --release --no-default-features
      - name: no_std / cargo hack ${{ matrix.crate }}
        run: cargo hack build -p ${{ matrix.crate }} --target thumbv7em-none-eabi --release --each-feature --exclude-features default,std,getrandom