A community-maintained Python framework for creating mathematical animations.
Use Cacheing in Github Actions (#370)
Naveen M Kcdda787b053f
diff --git a/.github/manimdependency.json b/.github/manimdependency.jsonnew file mode 100644index 000000000..2daf25a28--- /dev/null+++ b/.github/manimdependency.json@@ -0,0 +1,6 @@+{+ "windows": {+ "sox": "sox-14.4.2-win32",+ "ffmpeg": "ffmpeg-4.3.1-win64-static"+ }+}diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.ymlindex 19e425e30..d524cdf4b 100644--- a/.github/workflows/ci.yml+++ b/.github/workflows/ci.yml@@ -47,6 +47,19 @@ jobs:with:python-version: ${{ matrix.python }}+ - name: Get pip cache dir+ shell: bash+ id: pip-cache-and-time+ run: |+ echo "::set-output name=dir::$(pip cache dir)"+ echo "::set-output name=date::$(/bin/date -u "+%m%Y")"++ - name: pip cache+ uses: actions/cache@v2+ with:+ path: ${{ steps.pip-cache-and-time.outputs.dir }}+ key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }}-${{ matrix.python }}-${{ steps.pip-cache-and-time.outputs.date }}+- name: Install system dependencies (Linux)if: runner.os == 'Linux'run: |@@ -64,20 +77,42 @@ jobs:sudo tlmgr install standalone preview doublestroke relsize fundus-calligra wasysym physics dvisvgm.x86_64-darwin dvisvgm rsfs wasy cm-superecho "::set-env name=PATH::$PATH"- - name: Install system dependencies (Windows)+ - name: Cache Windows+ id: cache-windowsif: runner.os == 'Windows'+ uses: actions/cache@v2+ with:+ path: ${{ github.workspace }}\ManimCache+ key: ${{ runner.os }}-dependencies-ffmpeg-sox-tinytex-${{ hashFiles('.github/manimdependency.json') }}-${{ steps.pip-cache-and-time.outputs.date }}++ - name: Download system dependencies (Windows)+ if: runner.os == 'Windows' && steps.cache-windows.outputs.cache-hit != 'true'run: |- Invoke-WebRequest https://ci.appveyor.com/api/projects/yihui/tinytex/artifacts/TinyTeX.zip?job=image:%20Visual%20Studio%202019 -O TinyTex.zip- Expand-Archive -LiteralPath "$PWD\TinyTex.zip" -DestinationPath "$env:APPDATA\LatexWindows"- $env:Path += ";" + "$env:APPDATA\LatexWindows\TinyTeX\bin\win32"+ $soxVersion = python -c "import json;print(json.load(open('.github/manimdependency.json'))['windows']['sox'])"+ $soxVersionNumber = python -c "import json;print(json.load(open('.github/manimdependency.json'))['windows']['sox'].split('-')[1])"+ $ffmpegVersion = python -c "import json;print(json.load(open('.github/manimdependency.json'))['windows']['ffmpeg'])"+ $ffmpegVersionNumber = python -c "import json;print(json.load(open('.github/manimdependency.json'))['windows']['ffmpeg'].split('-')[1])"+ $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 install standalone preview doublestroke ms setspace rsfs relsize ragged2e fundus-calligra microtype wasysym physics dvisvgm jknapltx wasy cm-super babel-english+ $env:PATH=$OriPathecho "Completed Latex Install Sox"- Invoke-WebRequest https://downloads.sourceforge.net/project/sox/sox/14.4.2/sox-14.4.2-win32.zip -SkipCertificateCheck -UserAgent "pwsh" -O SoX.zip- 7z x "$PWD\SoX.zip" -o"$env:APPDATA\SoX"- $env:Path += ";" + "$env:APPDATA\SoX\sox-14.4.2"- Invoke-WebRequest https://ffmpeg.zeranoe.com/builds/win64/static/ffmpeg-4.3.1-win64-static.zip -O ffmpeg-4.3.1-win64-static.zip- 7z x "$PWD\ffmpeg-4.3.1-win64-static.zip" -o"$env:APPDATA\FFmpeg"- $env:Path += ";" + "$env:APPDATA\FFmpeg\ffmpeg-4.3.1-win64-static\bin"+ Invoke-WebRequest "https://downloads.sourceforge.net/project/sox/sox/$($soxVersionNumber)/$($soxVersion).zip" -UserAgent "wget" -O "$($env:TMP)\SoX.zip"+ 7z x "$($env:TMP)\SoX.zip" -o"$($PWD)\ManimCache"+ Move-Item "ManimCache\sox-*" "ManimCache\SoX"+ Invoke-WebRequest https://ffmpeg.zeranoe.com/builds/win64/static/$($ffmpegVersion).zip -O "$($env:TMP)\$($ffmpegVersion).zip"+ 7z x "$($env:TMP)\$($ffmpegVersion).zip" -o"$($PWD)\ManimCache"+ Move-Item "ManimCache\ffmpeg-*" "ManimCache\FFmpeg"++ - name: Add Windows dependecies to path+ if: runner.os == 'Windows'+ run: |+ $env:Path += ";" + "$($PWD)\ManimCache\FFmpeg\bin"+ $env:Path += ";" + "$($PWD)\ManimCache\LatexWindows\TinyTeX\bin\win32"+ $env:Path += ";" + "$($PWD)\ManimCache\SoX"echo "::set-env name=Path::$env:Path"- name: Install Pycairo (Non-Windows)@@ -89,7 +124,9 @@ jobs:run: python ./scripts/pycairoinstall.py- name: Install manim- run: pip install . pytest+ run: |+ pip install wheel+ pip install . pytest- name: Run testsrun: pytest