mirror of
https://github.com/ManimCommunity/manim.git
synced 2026-06-29 10:02:11 +00:00
170 lines
6.2 KiB
YAML
170 lines
6.2 KiB
YAML
name: CI
|
|
|
|
concurrency:
|
|
group: ${{ github.ref }}
|
|
cancel-in-progress: true
|
|
|
|
on:
|
|
push:
|
|
branches:
|
|
- main
|
|
pull_request:
|
|
branches:
|
|
- main
|
|
|
|
jobs:
|
|
test:
|
|
runs-on: ${{ matrix.os }}
|
|
env:
|
|
DISPLAY: :0
|
|
PYTEST_ADDOPTS: "--color=yes" # colors in pytest
|
|
GLCONTEXT_WIN_LIBGL: C:\msys64\mingw64\bin\opengl32.dll
|
|
strategy:
|
|
fail-fast: false
|
|
matrix:
|
|
os: [ubuntu-latest, macos-latest, windows-latest]
|
|
python: [3.7, 3.8, 3.9]
|
|
|
|
steps:
|
|
- name: Checkout the repository
|
|
uses: actions/checkout@v2
|
|
|
|
- name: Setup Python ${{ matrix.python }}
|
|
uses: actions/setup-python@v2
|
|
with:
|
|
python-version: ${{ matrix.python }}
|
|
|
|
- name: Install Poetry
|
|
run: |
|
|
pip install wheel
|
|
curl -sSL https://raw.githubusercontent.com/python-poetry/poetry/master/get-poetry.py | python
|
|
|
|
- name: Setup cache variables
|
|
shell: bash
|
|
id: cache-vars
|
|
run: |
|
|
export PATH="$HOME/.poetry/bin:$PATH"
|
|
echo "::set-output name=poetry-venv-dir::$(poetry config virtualenvs.path)"
|
|
echo "::set-output name=date::$(/bin/date -u "+%m%w%Y")"
|
|
|
|
- name: Setup Poetry cache
|
|
uses: actions/cache@v2
|
|
with:
|
|
path: ${{ steps.cache-vars.outputs.poetry-venv-dir }}
|
|
key: ${{ runner.os }}-poetry-${{ env.pythonLocation }}-${{ hashFiles('pyproject.toml') }}-${{ hashFiles('poetry.lock') }}
|
|
|
|
- name: Install and cache ffmpeg (all OS)
|
|
uses: FedericoCarboni/setup-ffmpeg@v1
|
|
with:
|
|
token: ${{ secrets.GITHUB_TOKEN }}
|
|
id: setup-ffmpeg
|
|
|
|
- name: Install system dependencies (Linux)
|
|
if: runner.os == 'Linux'
|
|
run: |
|
|
sudo apt update
|
|
sudo apt-get -y install texlive texlive-latex-extra texlive-fonts-extra texlive-latex-recommended texlive-science texlive-fonts-extra tipa python-opengl libpango1.0-dev xvfb
|
|
echo "$HOME/.poetry/bin" >> $GITHUB_PATH
|
|
# start xvfb in the background
|
|
sudo /usr/bin/Xvfb $DISPLAY -screen 0 1280x1024x24 &
|
|
|
|
- name: Setup macOS cache
|
|
id: cache-macos
|
|
if: runner.os == 'macOS'
|
|
uses: actions/cache@v2
|
|
with:
|
|
path: ${{ github.workspace }}/macos-cache
|
|
key: ${{ runner.os }}-dependencies-tinytex-${{ hashFiles('.github/manimdependency.json') }}-${{ steps.cache-vars.outputs.date }}
|
|
|
|
- name: Install system dependencies (MacOS)
|
|
if: runner.os == 'macOS' && steps.cache-macos.outputs.cache-hit != 'true'
|
|
run: |
|
|
tinyTexPackages=$(python -c "import json;print(' '.join(json.load(open('.github/manimdependency.json'))['macos']['tinytex']))")
|
|
IFS=' '
|
|
read -a ttp <<< "$tinyTexPackages"
|
|
oriPath=$PATH
|
|
sudo mkdir -p $PWD/macos-cache
|
|
echo "Install TinyTeX"
|
|
sudo curl -L -o "/tmp/TinyTeX.tgz" "https://ci.appveyor.com/api/projects/yihui/tinytex/artifacts/TinyTeX.tgz?job=image:%20macOS"
|
|
sudo tar zxf "/tmp/TinyTeX.tgz" -C "$PWD/macos-cache"
|
|
export PATH="$PWD/macos-cache/TinyTeX/bin/universal-darwin:$PATH"
|
|
sudo tlmgr update --self
|
|
for i in "${ttp[@]}"; do
|
|
sudo tlmgr install "$i"
|
|
done
|
|
export PATH="$oriPath"
|
|
echo "Completed TinyTeX"
|
|
|
|
- name: Install cairo (MacOS)
|
|
if: runner.os == 'macOS'
|
|
run: brew install cairo
|
|
|
|
- name: Add macOS dependencies to PATH
|
|
if: runner.os == 'macOS'
|
|
shell: bash
|
|
run: |
|
|
echo "/Library/TeX/texbin" >> $GITHUB_PATH
|
|
echo "$HOME/.poetry/bin" >> $GITHUB_PATH
|
|
echo "$PWD/macos-cache/TinyTeX/bin/universal-darwin" >> $GITHUB_PATH
|
|
|
|
- name: Setup Windows cache
|
|
id: cache-windows
|
|
if: runner.os == 'Windows'
|
|
uses: actions/cache@v2
|
|
with:
|
|
path: ${{ github.workspace }}\ManimCache
|
|
key: ${{ runner.os }}-dependencies-tinytex-${{ hashFiles('.github/manimdependency.json') }}-${{ steps.cache-vars.outputs.date }}
|
|
|
|
- name: Setup MSYS2 (Windows)
|
|
if: runner.os == 'Windows'
|
|
uses: msys2/setup-msys2@v2
|
|
with:
|
|
release: false
|
|
msystem: MINGW64
|
|
path-type: inherit
|
|
install: >-
|
|
mingw-w64-x86_64-mesa
|
|
|
|
- name: Install system dependencies (Windows)
|
|
if: runner.os == 'Windows' && steps.cache-windows.outputs.cache-hit != 'true'
|
|
run: |
|
|
$tinyTexPackages = $(python -c "import json;print(' '.join(json.load(open('.github/manimdependency.json'))['windows']['tinytex']))") -Split ' '
|
|
$OriPath = $env:PATH
|
|
echo "Install Tinytex"
|
|
Invoke-WebRequest "https://ci.appveyor.com/api/projects/yihui/tinytex/artifacts/TinyTeX.zip?job=image:%20Visual%20Studio%202019" -O "$($env:TMP)\TinyTex.zip"
|
|
Expand-Archive -LiteralPath "$($env:TMP)\TinyTex.zip" -DestinationPath "$($PWD)\ManimCache\LatexWindows"
|
|
$env:Path = "$($PWD)\ManimCache\LatexWindows\TinyTeX\bin\win32;$($env:PATH)"
|
|
tlmgr update --self
|
|
foreach ($c in $tinyTexPackages){
|
|
$c=$c.Trim()
|
|
tlmgr install $c
|
|
}
|
|
$env:PATH=$OriPath
|
|
echo "Completed Latex"
|
|
|
|
- name: Add Windows dependencies to PATH
|
|
if: runner.os == 'Windows'
|
|
run: |
|
|
Remove-Item C:\msys64\mingw64\bin\python.exe -Force
|
|
Remove-Item C:\msys64\mingw64\bin\python3.exe -Force
|
|
$env:Path += ";" + "$($PWD)\ManimCache\LatexWindows\TinyTeX\bin\win32"
|
|
$env:Path = "$env:USERPROFILE\.poetry\bin;$($env:PATH)"
|
|
$env:PATH = "C:\msys64\mingw64\bin;$($env:PATH)"
|
|
echo "$env:Path" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append
|
|
|
|
- name: Install manim
|
|
run: |
|
|
poetry config experimental.new-installer false
|
|
poetry install -E webgl_renderer
|
|
|
|
- name: Run tests
|
|
run: poetry run pytest
|
|
|
|
- name: Run module doctests
|
|
run: poetry run pytest --cov-append --doctest-modules --ignore-glob="*opengl*" manim
|
|
|
|
- name: Run doctests in rst files
|
|
run: cd docs && pip install -r requirements.txt && poetry run make doctest O=-tskip-manim
|
|
|
|
- name: Upload coverage
|
|
uses: codecov/codecov-action@v1
|