Skip to content

Cache ffmpeg binaries #47

Cache ffmpeg binaries

Cache ffmpeg binaries #47

Workflow file for this run

# Test the resourcepack generator, then build it to
# produce executables (and a resource pack) for testing (or manual publishing)
name: build_rpg
on: # run on any push to the primary branch
# or force building by opening a PR to anywhere
pull_request:
push:
branches:
- 1.20.5
jobs:
test_and_build_rpg:
strategy:
matrix:
os: [ ubuntu-20.04, windows-2019, macos-11 ]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0 # TODO: try removing this after the initial release
- name: Set up Python 3.10
uses: actions/setup-python@v4
with:
python-version: "3.10"
- name: Attempt to use cached ffmpeg binaries
id: cache-ffmpeg
uses: actions/cache@v3
env:
cache-name: ffmpeg-cache
with:
path: ffmpeg-release/
key: ${{ runner.os }}-${{ env.cache-name }}
- name: Grab ffmpeg binaries (Windows)
if: ${{ runner.os == 'Windows' && steps.cache-ffmpeg.outputs.cache-hit != 'true' }}
run: |
curl -JL https://www.gyan.dev/ffmpeg/builds/ffmpeg-release-full.7z --output ffmpeg-release-full.7z
mkdir ffmpeg-release
- name: Extract ffmpeg (Windows)
if: ${{ runner.os == 'Windows' && steps.cache-ffmpeg.outputs.cache-hit != 'true' }}
uses: DuckSoft/extract-7z-action@v1.0
with:
pathSource: ffmpeg-release-full.7z
pathTarget: ffmpeg-release
- name: Place ffmpeg binaries in correct folder (Windows)
if: ${{ runner.os == 'Windows' }}
run: |
copy ffmpeg-release\*\bin\ffmpeg.exe foxnap_rpg\bin\ffmpeg.exe
copy ffmpeg-release\*\bin\ffprobe.exe foxnap_rpg\bin\ffprobe.exe
- name: Grab FFMPEG Binaries (Mac)
if: ${{ runner.os == 'macOS' && steps.cache-ffmpeg.outputs.cache-hit != 'true' }}
run: |
mkdir ffmpeg-release
wget --trust-server-names https://evermeet.cx/ffmpeg/getrelease/zip -O ffmpeg-release/ffmpeg-release.zip
wget --trust-server-names https://evermeet.cx/ffmpeg/getrelease/ffprobe/zip -O ffmpeg-release/ffprobe-release.zip
- name: Place ffmpeg binaries in correct folder (Mac)
if: ${{ runner.os == 'macOS' }}
run: |
unzip ffmpeg-release.zip -d foxnap_rpg/bin/
unzip ffprobe-release.zip -d foxnap_rpg/bin/
- name: Grab FFMPEG Binaries (Linux)
if: ${{ runner.os == 'Linux' && steps.cache-ffmpeg.outputs.cache-hit != 'true' }}
run: |
wget --trust-server-names https://johnvansickle.com/ffmpeg/releases/ffmpeg-release-amd64-static.tar.xz -O ffmpeg-release.tar.xz
mkdir ffmpeg-release
tar -xJvf ffmpeg-release.tar.xz -C ffmpeg-release
- name: Place ffmpeg binaries in correct folder (Linux)
if: ${{ runner.os == 'Linux' }}
run: |
cp ffmpeg-release/*/ff* foxnap_rpg/bin/
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install .
pip install pytest pyinstaller pyyaml types-PyYAML
- name: Run unit tests
run: |
pytest -vv
- name: Copy launcher into build dir (Windows)
if: ${{ runner.os == 'Windows' }}
run: |
copy launcher.py build\launcher.py
- name: Copy launcher into build dir (*nix)
if: ${{ runner.os != 'Windows' }}
run: |
cp launcher.py build/launcher.py
- name: Build
run: |
pip install .
cd build # to avoid relative importing
pyinstaller launcher.py --console --onefile -n FoxNapRPG --collect-all foxnap_rpg
- name: Download music files
run: |
curl -JL "https://archive.org/compress/gustav-holst-the-planets-op.-32/formats=VBR%20MP3&file=/gustav-holst-the-planets-op.-32.zip" --output holst-the-planets.zip
python -c "from zipfile import ZipFile; zip = ZipFile('holst-the-planets.zip'); zip.extractall('build/dist')"
- name: Run Integration Tests
run: |
python run_integration_tests.py build/dist/FoxNapRPG 7
- name: capture build artifacts
uses: actions/upload-artifact@v2
if: always()
with:
name: ResourcepackGenerator-${{ runner.os }}
path: build/dist/