name: Test FP8 Runner

on:
  workflow_dispatch:

env:
  GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
jobs:
  set-prev-day:
    runs-on: ubuntu-latest
    outputs:
      prev-day: ${{ steps.set-prev-day.outputs.prev-day }}
    steps:
      - name: Set PREV_DAY
        id: set-prev-day
        run: |
          PREV_DAY=$(date -d "yesterday" '+%Y-%m-%d')
          echo "prev-day=$PREV_DAY" >> $GITHUB_OUTPUT
  run-fp8-tests:
    needs: set-prev-day
    runs-on:
      group: aws-g6e-12xlarge
    container:
      image: huggingface/accelerate:gpu-fp8-transformerengine-nightly-${{ needs.set-prev-day.outputs.prev-day }}
      options: --gpus all --shm-size "16gb"
    steps:
      - uses: actions/checkout@v3
      - name: Install the library
        run: |
            pip install -e .[test_prod,test_fp8]
      - name: Show installed libraries
        run: |
          pip freeze
      - name: Run TE FP8 tests
        run: |
          python -m pytest -s -v ./tests/test_fp8.py

