name: tests on transformers main

on:
  push:
    branches: [main]
    paths-ignore:
        - 'docs/**'

jobs:
  tests:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v3
      - name: Set up Python 3.11
        uses: actions/setup-python@v4
        with:
          python-version: 3.11
          cache: "pip"
          cache-dependency-path: "setup.py"
      - name: Install dependencies
        run: |
          python -m pip install --upgrade pip
          # cpu version of pytorch
          pip install -U git+https://github.com/huggingface/transformers.git
          pip install -e .[test]
      - name: Test with pytest
        run: |
          make test
      - name: Post to Slack
        if: always()
        uses: huggingface/hf-workflows/.github/actions/post-slack@main
        with:
          slack_channel: ${{ secrets.SLACK_CHANNEL_ID }}
          title: 🤗 Results of transformers main tests
          status: ${{ job.status }}
          slack_token: ${{ secrets.SLACK_CIFEEDBACK_BOT_TOKEN }}
