on: 
  pull_request:
    paths:
      - .github/actions/extism/**
      - .github/workflows/ci-elixir.yml
      - manifest/**
      - runtime/**
      - rust/**
      - elixir/**
  workflow_dispatch:

name: Elixir CI

jobs:
  elixir:
    name: Elixir
    runs-on: ${{ matrix.os }}
    env:
      MIX_ENV: test
    strategy:
      matrix:
        os: [ubuntu-latest, macos-latest]
        rust:
          - stable
    steps:
      - name: Checkout sources
        uses: actions/checkout@v3
      - uses: ./.github/actions/extism
      - name: Setup Elixir Host SDK
        if: ${{ runner.os != 'macOS' }}
        uses: erlef/setup-beam@v1
        with:
          experimental-otp: true
          otp-version: '25.0.4'
          elixir-version: '1.14.0'

      - name: Test Elixir Host SDK
        if: ${{ runner.os != 'macOS' }}
        run: |
         cd elixir
         LD_LIBRARY_PATH=/usr/local/lib mix do deps.get, test
