CI #2253
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: CI | |
on: | |
schedule: | |
- cron: '30 13 * * 1' | |
push: | |
branches: | |
- main | |
pull_request: | |
env: | |
CI: true | |
BLENDER_MAJOR: 4 | |
BLENDER_MINOR: 4 | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
timeout-minutes: 20 | |
steps: | |
- uses: actions/checkout@v3 | |
# Finds latest Blender build, and outputs the hosted build's download URL. | |
- name: Find latest Blender build | |
id: blender_version | |
run: | | |
echo "Looking for Blender $BLENDER_MAJOR.$BLENDER_MINOR" | |
BLENDER_URL="$(curl -s https://builder.blender.org/download/daily/ | \ | |
grep -oe 'http[^\"]*blender-'$BLENDER_MAJOR'\.'$BLENDER_MINOR'[^\"]*linux[^\"]*\.tar\.xz' | \ | |
tail -n1)" | |
if [ -z "$BLENDER_URL" ]; then | |
echo "Not found! Download URL may have changed; CI may need update." | |
exit 1 | |
fi | |
echo "Found: $BLENDER_URL" | |
echo "blender-url=$BLENDER_URL" >> $GITHUB_OUTPUT | |
# Loads a cached build of Blender if available. If not available, this step | |
# enqueues the /opt/blender directory to be cached after tests pass. | |
- id: blender_cache | |
uses: actions/cache@v3 | |
env: | |
cache-name: cache-blender | |
with: | |
path: /opt/blender | |
key: ${{ steps.blender_version.outputs.blender-url }} | |
# Downloads a build from blender.org, if a cached version was not available. | |
- name: Download Blender | |
if: ${{ !steps.blender_cache.outputs.cache-hit }} | |
run: | | |
mkdir /opt/blender | |
echo "Downloading: ${{ steps.blender_version.outputs.blender-url }}" | |
curl -SL "${{ steps.blender_version.outputs.blender-url }}" | \ | |
tar -Jx -C /opt/blender --strip-components=1 | |
- name: Set up workspace | |
run: | | |
sudo ln -s /opt/blender/blender /usr/local/bin/blender | |
blender --version | |
ADDON_DIR=/opt/blender/$BLENDER_MAJOR.$BLENDER_MINOR/scripts/addons_core | |
rm -rf $ADDON_DIR/io_scene_gltf2 | |
cp -r addons/io_scene_gltf2 $ADDON_DIR | |
cd tests | |
yarn install | |
mkdir -p out | |
- name: Run tests | |
run: | | |
cd tests | |
OUT_PREFIX=$GITHUB_WORKSPACE/tests/out yarn test-bail --reporter-options reportDir=out/mochawesome | |
- name: Upload artifacts | |
uses: actions/upload-artifact@v3 | |
with: | |
name: test-output | |
path: tests/out/mochawesome | |
if-no-files-found: error |