Skip to content

renderdiff: refactor json schema #18445

renderdiff: refactor json schema

renderdiff: refactor json schema #18445

Workflow file for this run

name: 'Presubmit CI'
on:
push:
branches:
- main
pull_request:
branches:
- main
# This will cancel in-flight runs when there is an update to a PR
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
# The conditional 'if' on each job is meant to skip presubmit jobs when a commit is pushed to main
# and that commit is cryptographically "verified". Typically, a verified commit (like a GitHub UI
# squash-and-merge) has already passed through presubmit during the Pull Request phase.
# The conditional explicitly checks:
# 1. always() && !cancelled(): Ensures the job runs even if 'check-verification' is skipped
# (which happens normally on PRs), but aborts if the workflow was manually cancelled.
# 2. !needs.check-verification.outputs.skip: Evaluates to true when the 'skip' output is empty.
# The 'skip' output is only set to 'true' if it's a push to main AND the commit is verified.
# In all other cases (including PRs where the job is skipped), it defaults to empty.
jobs:
check-verification:
if: github.event_name == 'push'
runs-on: ubuntu-latest
outputs:
skip: ${{ steps.check.outputs.skip }}
steps:
- name: Check commit verification
id: check
uses: actions/github-script@f28e40c7f34bde8b3046d885e986cb6290c5673b # v7.1.0
with:
script: |
const { data } = await github.rest.repos.getCommit({
owner: context.repo.owner,
repo: context.repo.repo,
ref: context.sha
});
if (data.commit.verification.verified) {
core.setOutput('skip', 'true');
}
build-desktop-mac:
name: build-mac
runs-on: 'macos-14-xlarge'
timeout-minutes: 45
needs: [check-verification]
if: always() && !cancelled() && !needs.check-verification.outputs.skip
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7
with:
fetch-depth: 0
- uses: ./.github/actions/mac-prereq
- name: Run build script
run: |
cd build/mac && printf "y" | ./build.sh presubmit
build-desktop-linux:
name: build-linux
runs-on: 'arm-ubuntu-24.04-16core'
timeout-minutes: 45
needs: [check-verification]
if: always() && !cancelled() && !needs.check-verification.outputs.skip
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7
with:
fetch-depth: 0
- uses: ./.github/actions/linux-prereq
- name: Run build script
run: |
cd build/linux && printf "y" | ./build.sh presubmit
- name: Test - material parser
run: |
out/cmake-release/filament/test/test_material_parser
build-windows:
name: build-windows
runs-on: 'windows-2022'
needs: [check-verification]
if: always() && !cancelled() && !needs.check-verification.outputs.skip
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7
with:
fetch-depth: 0
- name: Run build script
run: |
build\windows\build-github.bat presubmit
shell: cmd
build-android:
name: build-android
runs-on: 'ubuntu-24.04-8core'
timeout-minutes: 45
needs: [check-verification]
if: always() && !cancelled() && !needs.check-verification.outputs.skip
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7
with:
fetch-depth: 0
- uses: ./.github/actions/linux-prereq
- uses: actions/setup-java@b6effb05e454b25005698d916606bdc6ffcbf961 # v5.7.0
with:
distribution: 'temurin'
java-version: '21'
- name: Run build script
# Only build 1 64 bit target during presubmit to cut down build times during presubmit
# Continuous builds will build everything
run: |
pushd .
cd build/android && printf "y" | ./build.sh presubmit-with-archive arm64-v8a
popd
- id: get_commit_msg
uses: ./.github/actions/get-commit-msg
- name: Check artifact sizes
env:
OUTPUTS_HASHES: ${{ steps.get_commit_msg.outputs.hashes }}
run: |
python3 test/sizeguard/dump_artifact_size.py out/*.aar > current_size.json
BYPASS_ARG=""
if python3 test/sizeguard/check_bypass.py ${OUTPUTS_HASHES}; then
BYPASS_ARG="--bypass"
fi
python3 test/sizeguard/check_size.py current_size.json \
--target-branch origin/main \
--threshold 20480 \
--artifacts filament-android-release.aar/jni/arm64-v8a/libfilament-jni.so \
$BYPASS_ARG || { echo "To bypass this failure, please add SIZEGUARD_BYPASS to your *commit* message on a line by itself."; exit 1; }
build-ios:
name: build-iOS
runs-on: 'macos-14-xlarge'
timeout-minutes: 45
needs: [check-verification]
if: always() && !cancelled() && !needs.check-verification.outputs.skip
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7
with:
fetch-depth: 0
- uses: ./.github/actions/mac-prereq
- name: Select Xcode 16.2
run: sudo xcode-select -s /Applications/Xcode_16.2.app/Contents/Developer
- name: Run build script
run: |
cd build/ios && printf "y" | ./build.sh presubmit
- name: Build iOS samples
run: |
cd build/ios && ./build-samples.sh presubmit
build-web:
name: build-web
runs-on: 'arm-ubuntu-24.04-16core'
timeout-minutes: 45
needs: [check-verification]
if: always() && !cancelled() && !needs.check-verification.outputs.skip
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7
with:
fetch-depth: 0
- uses: ./.github/actions/linux-prereq
- uses: ./.github/actions/web-prereq
- name: Run build script
run: |
cd build/web && printf "y" | ./build.sh presubmit
validate-docs:
name: validate-docs
runs-on: 'ubuntu-24.04'
needs: [check-verification]
if: always() && !cancelled() && !needs.check-verification.outputs.skip
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7
with:
fetch-depth: 0
- id: get_commit_msg
uses: ./.github/actions/get-commit-msg
- name: Check for manual edits to /docs
env:
OUTPUTS_HASHES: ${{ steps.get_commit_msg.outputs.hashes }}
run: |
bash docs_src/build/presubmit_check.sh $OUTPUTS_HASHES
test-renderdiff:
name: test-renderdiff
runs-on: 'macos-14-xlarge'
timeout-minutes: 45
needs: [check-verification]
if: always() && !cancelled() && !needs.check-verification.outputs.skip
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7
with:
fetch-depth: 0
- id: get_commit_msg
uses: ./.github/actions/get-commit-msg
- name: Check if accepting new goldens
id: check_accept
env:
COMMIT_MESSAGE: ${{ steps.get_commit_msg.outputs.msg }}
run: |
if echo "${COMMIT_MESSAGE}" | python3 test/renderdiff/src/commit_msg.py --mode=accept_new_goldens; then
echo "accept=true" >> "$GITHUB_OUTPUT"
else
echo "accept=false" >> "$GITHUB_OUTPUT"
fi
- uses: ./.github/actions/get-gltf-assets
- name: Validate renderdiff test schemas
run: |
python3 test/renderdiff/src/test_schema.py \
test/renderdiff/tests/presubmit.json \
test/renderdiff/tests/sample.json \
android/samples/sample-render-validation/src/main/assets/default_test.json
shell: bash
- name: Renderdiff generate
if: steps.check_accept.outputs.accept != 'true'
uses: ./.github/actions/renderdiff-generate
- name: Compare rendered images
if: steps.check_accept.outputs.accept != 'true'
id: render_compare
env:
COMMIT_MESSAGE: ${{ steps.get_commit_msg.outputs.msg }}
run: |
TEST_DIR=test/renderdiff
source ${TEST_DIR}/src/preamble.sh
set -eux
GOLDEN_BRANCH=$(echo "${COMMIT_MESSAGE}" | python3 ${TEST_DIR}/src/commit_msg.py)
python3 ${TEST_DIR}/src/golden_manager.py \
--branch=${GOLDEN_BRANCH} \
--output=${GOLDEN_OUTPUT_DIR}
# Note that we need to upload the output even if comparison fails, so we undo `set -eux`
set +eux
python3 ${TEST_DIR}/src/compare.py \
--src=${GOLDEN_OUTPUT_DIR} \
--dest=${RENDER_OUTPUT_DIR} \
--out=${DIFF_OUTPUT_DIR} \
--diffimg="$(pwd)/out/cmake-release/tools/diffimg/diffimg" \
--test="${TEST_DIR}/tests/presubmit.json" 2>&1 | tee compare_output.txt
if grep "Failed" compare_output.txt > /dev/null; then
DELIMITER="EOF_FILE_CONTENT_$(date +%s)" # Using timestamp to make it more unique
echo "err<<$DELIMITER" >> "$GITHUB_OUTPUT"
cat compare_output.txt >> "$GITHUB_OUTPUT"
echo "$DELIMITER" >> "$GITHUB_OUTPUT"
fi
shell: bash
- name: Upload artifacts
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
if: steps.check_accept.outputs.accept != 'true'
with:
name: presubmit-renderdiff-result
path: ./out/renderdiff
- name: Check results
if: steps.check_accept.outputs.accept != 'true'
env:
ERROR_STR: ${{ steps.render_compare.outputs.err }}
run: |
if [ -n "${ERROR_STR}" ]; then
echo "${ERROR_STR}"
exit 1
fi
build-wgsl-webgpu:
name: build-wgsl-webgpu
runs-on: 'arm-ubuntu-24.04-16core'
timeout-minutes: 45
needs: [check-verification]
if: always() && !cancelled() && !needs.check-verification.outputs.skip
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7
with:
fetch-depth: 0
- uses: ./.github/actions/linux-prereq
- name: Run build script
run: ./build.sh -W debug test_filamat filament gltf_viewer
- name: Run test
run: ./out/cmake-debug/libs/filamat/test_filamat --gtest_filter=MaterialCompiler.Wgsl*
test-code-correctness:
name: test-code-correctness
runs-on: 'arm-ubuntu-24.04-16core'
timeout-minutes: 60
needs: [check-verification]
if: always() && !cancelled() && !needs.check-verification.outputs.skip
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7
with:
fetch-depth: 0
- uses: ./.github/actions/linux-prereq
- name: Get commit message
id: get_commit_msg
uses: ./.github/actions/get-commit-msg
- name: Check - header organization
env:
COMMIT_MESSAGE: ${{ steps.get_commit_msg.outputs.msg }}
GIHUB_SHA: ${{ github.sha }}
run: |
if [ "${{ github.event_name }}" = "pull_request" ]; then
FILES=()
while IFS= read -r -d '' file; do
FILES+=("$file")
done < <(git diff -z --name-only --diff-filter=d ${{ github.event.pull_request.base.sha }} ${{ github.event.pull_request.head.sha }})
if [ ${#FILES[@]} -gt 0 ]; then
bash test/code-correctness/check-headers.sh "${FILES[@]}"
else
echo "No files to check."
fi
else
bash test/code-correctness/check-headers.sh ${GITHUB_SHA}
fi
- name: Run build script
# We need to build before clang-tidy can run analysis
run: |
# -b enables ASAN and UBSAN (Address and Undefined Behavior Sanitizers) for the debug build
./build.sh -b -p desktop debug
# This will build and install the release build
./build.sh -p desktop release && ninja -C out/cmake-release install
- name: Check - clang-tidy (exception escape)
run: bash test/code-correctness/clang-tidy-proxy.sh
- name: Check - public header inclusion
run: bash test/code-correctness/headers-inclusion.sh out/release/filament/include
- name: Check - Filament unit tests
run: bash test/filament-unit-test/test.sh
test-backend:
name: test-backend
runs-on: 'arm-ubuntu-24.04-16core'
timeout-minutes: 45
needs: [check-verification]
if: always() && !cancelled() && !needs.check-verification.outputs.skip
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7
with:
fetch-depth: 0
- uses: ./.github/actions/linux-prereq
- uses: ./.github/actions/get-mesa
- uses: ./.github/actions/get-vulkan-sdk
- name: Run backend tests
shell: bash
run: |
bash test/backend/test.sh