Skip to content

Bump actions/upload-artifact from 3 to 4 #2448

Bump actions/upload-artifact from 3 to 4

Bump actions/upload-artifact from 3 to 4 #2448

Workflow file for this run

name: Docs validation
on: # Trigger the workflow on push or pull request
# push:
# branches: [main]
pull_request: {}
workflow_dispatch: {}
concurrency:
group: ${{ github.workflow }}-${{ github.head_ref }}
cancel-in-progress: ${{ github.ref != 'refs/heads/main' }}
defaults:
run:
shell: bash
jobs:
make-docs:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
target: ["html", "linkcheck"]
env:
PUB_BRANCH: publication
PATH_DATASETS: ${{ github.workspace }}/.datasets
TORCH_URL: "https://download.pytorch.org/whl/cpu/torch_stable.html"
timeout-minutes: 20
steps:
- name: Checkout 🛎️
uses: actions/checkout@v4
with:
fetch-depth: 0 # fetch all history for all branches and tags
- uses: actions/setup-python@v5
with:
python-version: 3.8
cache: pip
- name: Install Texlive & tree
run: |
sudo apt-get update --fix-missing
sudo apt-get install -y cmake tree pandoc
- name: Install dependencies
run: |
set -ex
pip install -q -r requirements.txt -r _requirements/docs.txt -f ${TORCH_URL}
pip list
- name: Process folders
run: |
mkdir -p ${PATH_DATASETS}
head=$(git rev-parse origin/"${{ github.base_ref }}")
git diff --name-only $head --output=master-diff.txt
python .actions/assistant.py group-folders master-diff.txt
printf "Changed folders:\n----------------\n"
cat changed-folders.txt
- name: Count changed notebooks
run: python -c "lines = open('changed-folders.txt').readlines(); print(f'NB_DIRS={len(lines)}')" >> $GITHUB_ENV
- uses: oleksiyrudenko/[email protected]
with:
token: ${{ secrets.GITHUB_TOKEN }}
global: true
- name: Sync to pub
run: git merge -s resolve origin/$PUB_BRANCH
- name: Generate notebooks
if: ${{ env.NB_DIRS != 0 }}
env:
DRY_RUN: 1
run: |
# second half with || [...] is needed for reading the last line
while read -r line || [ -n "$line" ]; do
python .actions/assistant.py convert-ipynb $line
python .actions/assistant.py bash-render $line
cat .actions/_ipynb-render.sh
bash .actions/_ipynb-render.sh
done <<< $(cat changed-folders.txt)
- name: Copy notebooks
if: ${{ env.NB_DIRS != 0 }}
run: |
# second half with || [...] is needed for reading the last line
while read -r line || [ -n "$line" ]; do
dir=$(dirname $line)
mkdir -p changed-notebooks/${dir}
cp .notebooks/${line}.ipynb changed-notebooks/${dir}/
done <<< $(cat changed-folders.txt)
tree changed-notebooks
- uses: actions/upload-artifact@v4
if: ${{ matrix.target == 'html' && env.NB_DIRS != 0 }}
with:
name: notebooks-${{ github.sha }}
path: changed-notebooks/
- name: Make ${{ matrix.target }}
working-directory: ./_docs
run: make ${{ matrix.target }} --jobs $(nproc) --debug SPHINXOPTS="-W --keep-going"
- name: Upload built docs
if: ${{ matrix.target == 'html' }}
uses: actions/upload-artifact@v4
with:
name: docs-html-${{ github.sha }}
path: _docs/build/html/