Skip to content

Commit

Permalink
Enabled golden image validation on GitHub CI (#50)
Browse files Browse the repository at this point in the history
  • Loading branch information
TheMostDiligent committed Aug 11, 2022
1 parent 881e626 commit d83ecc1
Show file tree
Hide file tree
Showing 53 changed files with 54 additions and 39 deletions.
49 changes: 47 additions & 2 deletions .github/workflows/build-windows.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,12 @@ name: Win32/UWP build

on: [push, pull_request]

env:
# 'capture' - generate golden images
# 'compare' - render and compare with the references
# 'compare_update' - first compare with the references and then update them
test_mode: compare_update

jobs:
precheks:
name: Win10 -> Pre-checks
Expand All @@ -23,13 +29,14 @@ jobs:
shell: cmd
working-directory: ${{github.workspace}}/DiligentSamples/BuildTools/FormatValidation
run: validate_format_win.bat


build:
needs: precheks
runs-on: windows-2022

strategy:
fail-fast: false
matrix:
name: ["Win10"]
toolset: ["Win32", "x64"]
Expand Down Expand Up @@ -85,9 +92,15 @@ jobs:
name: Win10 -> ${{ matrix.name }}-${{ matrix.toolset }}, ${{ matrix.build_type }}

steps:
- name: Checkout
- name: Checkout Code Base
uses: DiligentGraphics/github-action/checkout@v1

- name: Checkout Test Data
uses: actions/checkout@v2
with:
repository: DiligentGraphics/DiligentTestData
path: DiligentTestData

- name: Set up build environment
if: success()
uses: DiligentGraphics/github-action/setup-build-env@v1
Expand All @@ -106,5 +119,37 @@ jobs:
cmake-args: ${{ matrix.cmake_args }}

- name: Build
id: build
if: success()
uses: DiligentGraphics/github-action/build@v1

- name: Run Sample Tests D3D11
working-directory: ${{github.workspace}}/DiligentSamples/Tests
if: ${{ matrix.name == 'Win10' || matrix.name == 'Win8.1' }}
shell: cmd
run: |
:: Run Sample Tests D3D11
set golden_images_root_dir=${{github.workspace}}/DiligentTestData/GoldenImages
ProcessGoldenImages.bat ${{env.DILIGENT_BUILD_DIR}} ${{matrix.build_type}} ${{env.test_mode}} "--mode d3d11 --adapter sw"
- name: Run Sample Tests D3D12
working-directory: ${{github.workspace}}/DiligentSamples/Tests
# NB: it is essential to include failure() to override the default status check of success()
# that is automatically applied to if conditions that don't contain a status check function.
if: ${{ (success() || failure() && steps.build.outcome == 'success') && matrix.name == 'Win10' }}
shell: cmd
run: |
:: Run Sample Tests D3D12
set golden_images_root_dir=${{github.workspace}}/DiligentTestData/GoldenImages
ProcessGoldenImages.bat ${{env.DILIGENT_BUILD_DIR}} ${{matrix.build_type}} ${{env.test_mode}} "--mode d3d12 --adapter sw"
- name: Upload Golden Images
uses: actions/upload-artifact@v2
# NB: it is essential to include failure() to override the default status check of success()
# that is automatically applied to if conditions that don't contain a status check function.
if: ${{ (success() || failure() && steps.build.outcome == 'success') && (matrix.name == 'Win10' || matrix.name == 'Win8.1') }}
with:
name: GoldenImages-${{ matrix.name }}-${{ matrix.toolset }}-${{ matrix.build_type }}
path: |
${{github.workspace}}/DiligentTestData/GoldenImages
retention-days: 90
15 changes: 0 additions & 15 deletions BuildTools/Scripts/appveyor/run_tests.bat

This file was deleted.

Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ if "%golden_img_height%" == "" (
set golden_img_height=512
)
if "%golden_images_root_dir%" == "" (
set golden_images_root_dir=../../../Tests/GoldenImages
set golden_images_root_dir=.
)

:: ~ removes surrounding quotes
Expand All @@ -51,7 +51,7 @@ set rest_args=
goto loop1
:end_loop1

cd ../..
cd ..

set Tutorials=Tutorial01_HelloTriangle^
Tutorial02_Cube^
Expand Down Expand Up @@ -93,7 +93,7 @@ for %%X in (%Samples%) do (
set /a APP_ID=!APP_ID!*2
)

cd Tests/GoldenImages
cd Tests

EXIT /B %ERROR%

Expand Down Expand Up @@ -155,7 +155,7 @@ EXIT /B %ERROR%
)
)
set capture_name=%app_name%_gi_!backend_name!


rem !!! ERRORLEVEL doesn't get updated inside control blocks like IF statements unless !!!
rem !!! !ERRORLEVEL! is used instead of %ERRORLEVEL% and delayed expansion is enabled as below: !!!
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -510,7 +510,9 @@ void Tutorial16_BindlessResources::PopulateInstanceBuffer()
// Random scale
float scale = BaseScale * scale_distr(gen);
// Random rotation
float4x4 rotation = float4x4::RotationX(rot_distr(gen)) * float4x4::RotationY(rot_distr(gen)) * float4x4::RotationZ(rot_distr(gen));
float4x4 rotation = float4x4::RotationX(rot_distr(gen));
rotation *= float4x4::RotationY(rot_distr(gen));
rotation *= float4x4::RotationZ(rot_distr(gen));
// Combine rotation, scale and translation
float4x4 matrix = rotation * float4x4::Scale(scale, scale, scale) * float4x4::Translation(xOffset, yOffset, zOffset);
auto& CurrInst = m_InstanceData[instId];
Expand Down
17 changes: 0 additions & 17 deletions appveyor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,6 @@ image:
- Visual Studio 2019

environment:
# use 'capture' to generate golden images and upload them as build artifacts
# use 'compare' to render and compare with the golden references
# use 'compare_update' to first compare with the references and then update them
test_mode: compare_update

matrix:
- platform: x64
configuration: Debug
Expand Down Expand Up @@ -52,15 +47,3 @@ build:
project: c:\projects\build\DiligentSamples_Test.sln
verbosity: minimal
parallel: true

test_script:
- 'cd %APPVEYOR_BUILD_FOLDER%\Tests\GoldenImages'
- '%APPVEYOR_BUILD_FOLDER%\BuildTools\Scripts\appveyor\run_tests.bat c:\projects\build %test_mode%'

after_test:
- 'cd %APPVEYOR_BUILD_FOLDER%'
- 7z a golden_images-"%CONFIGURATION%".zip .\Tests\GoldenImages\*\*

artifacts:
- path: \golden_images-*.zip
name: golden_images-zip

0 comments on commit d83ecc1

Please sign in to comment.