haystack/.github/workflows/tutorials.yml
Sara Zan e92ea4fccb
refactor: rename master into main in documentation and links (#3063)
* master->main

* revert master rename

* Revert change to sphinx link and rename master schema
2022-08-24 19:05:12 +02:00

103 lines
3.5 KiB
YAML

name: Tutorials
on:
workflow_dispatch: # Activate this workflow manually
pull_request:
paths:
- 'tutorials/*.*'
env:
# Tutorials that require a GPU to run, so can't be run on CI without self-hosted runners
DONT_RUN: Tutorial2_ Tutorial9_ Tutorial13_ Tutorial18_
jobs:
docs-check:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Setup Python
uses: ./.github/actions/python_cache/
- name: Install Haystack
run: |
pip install --upgrade pip
pip install .[dev]
- name: Docs Check
run: python .github/utils/convert_notebooks_into_webpages.py
- name: Status
run: |
if [[ `git status --porcelain` ]]; then
git status
echo "##################################################################################################"
echo "#"
echo "# CHECK FAILED! You need to update the static version of the tutorials."
echo "#"
echo "# Please run the tutorials documentation update script:"
echo "#"
echo "# python .github/utils/convert_notebooks_into_webpages.py"
echo "#"
echo "# or see https://github.com/deepset-ai/haystack/blob/main/CONTRIBUTING.md for help."
echo "#"
echo "# If you have further problems, please open an issue: https://github.com/deepset-ai/haystack/issues"
echo "#"
echo "##################################################################################################"
exit 1
fi
run:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Setup Python
uses: ./.github/actions/python_cache/
- name: Install pdftotext
run: wget --no-check-certificate https://dl.xpdfreader.com/xpdf-tools-linux-4.04.tar.gz && tar -xvf xpdf-tools-linux-4.04.tar.gz && sudo cp xpdf-tools-linux-4.04/bin64/pdftotext /usr/local/bin
# Some tutorials require these libraries to run
# - Tutorial 17 for the audio libs
# - Tutorial 11, 14, 15, 16 for pygraphviz
- name: Install graphviz and audio libs
run: sudo apt install libgraphviz-dev graphviz libsndfile1 ffmpeg
# Some tutorials require these libraries to run
# - Tutorial 15
- name: Install torch-scatter
run: pip install torch-scatter -f https://data.pyg.org/whl/torch-1.12.0+cpu.html
# Haystack needs to be reinstalled at this stage to make sure the current commit's version is the one getting tested.
# The cache can last way longer than a specific action's run, so older Haystack version could be carried over.
- name: Reinstall Haystack
run: |
pip install --upgrade pip
pip install .[all]
pip install pygraphviz
pip install ipython nbformat
- name: Cache mini GoT dataset
run: |
mkdir -p data/tutorials
cd data/tutorials
wget https://s3.eu-central-1.amazonaws.com/deepset.ai-farm-qa/datasets/documents/wiki_gameofthrones_txt1_mini.zip -q &> /dev/null
unzip wiki_gameofthrones_txt1_mini.zip
rm wiki_gameofthrones_txt1_mini.zip
- uses: jitterbit/get-changed-files@v1
id: diff
continue-on-error: true
with:
format: space-delimited
token: ${{ secrets.GITHUB_TOKEN }}
- name: Run tutorials
run: ./.github/utils/tutorials.sh ${{ env.pythonLocation }} "${{ steps.diff.outputs.added_modified }}" "${{ env.DONT_RUN }}" "EDITABLE" "RESTART"