name: main
on:
  pull_request:
    branches:
      - main
      - feat/nn
  push:
    branches:
      - main
      - feat/nn
jobs:
  build-linux:
    name: Linux
    runs-on: ${{matrix.runner}}
    strategy:
      matrix:
        include:
          - runner: ubuntu-22.04
            arch: amd64
          - runner: ubuntu-latest-arm64
            arch: arm64
    steps:
      - name: Checkout Repo
        uses: actions/checkout@v3
      - name: Dependencies
        id: dependencies
        run: sudo apt-get update && sudo apt-get install build-essential
      - name: Build
        id: build
        run: |
          make dllama
          make nn-cpu-test
          make nn-cpu-ops-test
          make tokenizer-test
      - name: nn-cpu-test
        run: ./nn-cpu-test
      - name: nn-cpu-ops-test
        run: ./nn-cpu-ops-test
      - name: tokenizer-test
        run: ./tokenizer-test

  build-windows:
    name: Windows
    runs-on: windows-latest
    steps:
      - name: Checkout Repo
        uses: actions/checkout@v3
      - name: Dependencies
        id: dependencies
        run: choco install make
      - name: Build
        id: build
        run: |
          make dllama
          make nn-cpu-test
          make nn-cpu-ops-test
          make tokenizer-test
      - name: nn-cpu-test
        run: ./nn-cpu-test
      - name: nn-cpu-ops-test
        run: ./nn-cpu-ops-test
      - name: tokenizer-test
        run: ./tokenizer-test
