Thanks to visit codestin.com
Credit goes to Github.com

Skip to content

Maintain default asset pipeline. #4151

Maintain default asset pipeline.

Maintain default asset pipeline. #4151

Workflow file for this run

name: Build
on:
push:
branches-ignore:
- 'no-ci-**'
- 'skip-ci-**'
pull_request:
workflow_dispatch:
env:
# common settings
URHO3D_ENABLE_ALL: ON
URHO3D_SAMPLES: ON
URHO3D_TESTING: ON
URHO3D_PROFILING_FALLBACK: ON
URHO3D_PRISTINE_FULL_BUILDS: ON
DOTNET_VERSION: '8.0'
CMAKE_VERSION: 3.25.x
# ccache configuration
ccache_prefix: ${{ secrets.CACHE_VERSION }}-master
CCACHE_DIR: ${{ github.workspace }}/.ccache
CCACHE_COMPRESS: true
CCACHE_COMPRESSLEVEL: 9
CCACHE_DEPEND: true
CCACHE_HARDLINK: true
CCACHE_SLOPPINESS: pch_defines,time_macros,include_file_mtime,include_file_ctime
CCACHE_NOHASHDIR: true
#CCACHE_MAXSIZE: 580M
CCACHE_LIMIT_MULTIPLE: 0.6
#CCACHE_DEBUG: 1
CCACHE_DEBUGDIR: ${{ github.workspace }}/ccache-debug
# paths
ci_workspace_dir: ${{ github.workspace }}
ci_source_dir: ${{ github.workspace }}/source-code
ci_build_script: ./source-code/script/ci_build.sh
ci_build_dir: ${{ github.workspace }}/cmake-build
ci_sdk_dir: ${{ github.workspace }}/SDK
# WebHooks/documentation/itch.io/gh pages
# Note that some of these steps hard-code this condition instead of using ci_publish
# variable, because github does not allow using env variables in that context. Be sure
# to ctrl+c for "ci_publish" if you need to adjust this variable.
ci_publish: ${{ github.repository == 'rbfx/rbfx' && github.ref == 'refs/heads/master' }}
# Push artifacts to latest release.
ci_artifacts: ${{ (github.repository == 'rbfx/rbfx' && github.ref == 'refs/heads/master') || (contains(github.event.head_commit.message, '#ci-artifacts') && github.event_name != 'pull_request') }}
# CI workers have limited capabilities, allow tracy to fall back to less accurate timers.
TRACY_TIMER_FALLBACK: 1
SOURCE_REF: ${{ github.head_ref || github.ref_name }}
defaults:
run:
shell: bash
concurrency:
group: ci-${{ github.ref }}
cancel-in-progress: true
jobs:
WebHooks:
name: Web Hooks
runs-on: ubuntu-latest
continue-on-error: true
# if: env.ci_publish == 'true'
if: ${{ github.repository == 'rbfx/rbfx' && github.ref == 'refs/heads/master' }}
steps:
- name: Discord Commits
uses: rbfx/github_discord_notifier@latest
with:
discord-webhook: ${{ secrets.DISCORD_WEBHOOK_COMMITS }}
github-token: ${{ github.token }}
action-task: discord-commits
discord-username: GitHub
Release-Latest:
name: Release 'latest'
runs-on: ubuntu-latest
# if: env.ci_artifacts == 'true'
if: ${{ (github.repository == 'rbfx/rbfx' && github.ref == 'refs/heads/master') || (contains(github.event.head_commit.message, '#ci-artifacts') && github.event_name != 'pull_request') }}
steps:
- name: Checkout Repository
uses: actions/checkout@v5
- name: Create and Push Tag
run: |
git tag -f latest
git push -f origin latest
Build:
runs-on: ${{ (startsWith(matrix.ci_platform_tag, 'windows-') || startsWith(matrix.ci_platform_tag, 'uwp-')) && 'windows-latest' || ((startsWith(matrix.ci_platform_tag, 'macos-') || startsWith(matrix.ci_platform_tag, 'ios-')) && 'macos-latest' || 'ubuntu-latest') }}
if: ${{ !(github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name == 'rbfx/rbfx') && github.event.pull_request.draft == false }}
strategy:
fail-fast: false
matrix:
include:
# Desktop: Windows builds
- ci_platform_tag: windows-msvc-x64-dll
- ci_platform_tag: windows-msvc-x64-lib
- ci_platform_tag: windows-msvc-x86-dll
- ci_platform_tag: windows-msvc-x86-lib
# Desktop: Linux builds
- ci_platform_tag: linux-gcc-x64-dll
- ci_platform_tag: linux-gcc-x64-lib
- ci_platform_tag: linux-clang-x64-dll
- ci_platform_tag: linux-clang-x64-lib
# Desktop: MacOS builds
- ci_platform_tag: macos-clang-arm64-dll
- ci_platform_tag: macos-clang-arm64-lib
- ci_platform_tag: macos-clang-x64-dll
- ci_platform_tag: macos-clang-x64-lib
# Mobile: UWP builds
- ci_platform_tag: uwp-msvc-x64-dll
- ci_platform_tag: uwp-msvc-x64-lib
# Mobile: Android builds
- ci_platform_tag: android-clang-arm64-dll
- ci_platform_tag: android-clang-arm-dll
- ci_platform_tag: android-clang-x64-dll
# Mobile: iOS builds
- ci_platform_tag: ios-clang-arm-lib
- ci_platform_tag: ios-clang-arm64-lib
# Web builds
- ci_platform_tag: web-emscripten-wasm-lib
env:
ci_platform_tag: ${{ matrix.ci_platform_tag }}
BUTLER_API_KEY: ${{ secrets.BUTLER_API_KEY }}
BINARYEN_CORES: 1
steps:
- uses: actions/checkout@v5
with:
path: ${{ env.ci_source_dir }}
fetch-depth: 1
- name: Setup environment
run: ${{ env.ci_build_script }} setup-environment
# Mobile-specific: Checkout emsdk (Web only)
- name: Checkout emsdk
if: env.ci_platform == 'web'
uses: actions/checkout@v5
with:
repository: emscripten-core/emsdk
path: ${{ github.workspace }}/emsdk
- name: Setup emsdk
if: env.ci_platform == 'web'
run: |
cd ${{ github.workspace }}/emsdk
./emsdk install latest
./emsdk activate latest
echo "PATH=$PATH:${{ github.workspace }}/emsdk:${{ github.workspace }}/emsdk/upstream/emscripten" >> $GITHUB_ENV
echo "EMSDK=${{ github.workspace }}/emsdk" >> $GITHUB_ENV
- name: Set up butler
if: ${{ (env.ci_publish == 'true') && (vars.DISABLE_ITCH != 'true') }}
uses: jdno/setup-butler@v1
- name: Restore Build Cache
uses: actions/cache/restore@v4
with:
path: ${{ env.CCACHE_DIR }}
key: ${{ env.ci_cache_id }}-${{ env.ci_short_sha }}
restore-keys: |
${{ env.ci_cache_id }}
- name: Setup dotnet
uses: actions/setup-dotnet@v4
if: env.ci_lib_type == 'dll' || env.ci_platform == 'android'
with:
dotnet-version: ${{ env.DOTNET_VERSION }}
- name: Setup Gradle
if: env.ci_platform == 'android'
uses: gradle/actions/setup-gradle@v4
with:
gradle-version: '8.14.3'
add-job-summary: 'never'
- name: Setup cmake
if: env.ci_platform != 'android'
uses: jwlawson/actions-setup-cmake@v2
with:
cmake-version: '${{ env.CMAKE_VERSION }}'
- name: Dependencies
run: ${{ env.ci_build_script }} dependencies
- name: Download release SDK
id: cached_sdk
if: ${{ !contains(github.event.head_commit.message, '#full-build') }}
continue-on-error: true
run: |
if ${{ env.ci_build_script }} download-release -- \
"https://github.com/${{ github.repository }}/releases/download/latest/rebelfork-sdk-${{ env.ci_platform_tag }}-latest.7z" \
"${{ github.workspace }}/cached-sdk" \
"rebelfork-sdk-${{ env.ci_platform_tag }}-latest/thirdparty-id.txt" \
"${{ env.ci_hash_thirdparty }}"; then
echo "sdk-cached=true" >> "$GITHUB_OUTPUT"
else
echo "sdk-cached=false" >> "$GITHUB_OUTPUT"
fi
- name: Build swig
if: (env.ci_lib_type == 'dll' && env.ci_platform_group != 'desktop') || (env.ci_platform == 'ios')
run: |
binary_dir='${{ github.workspace }}/swig-build'
cmake -S '${{ env.ci_source_dir }}/Source/ThirdParty/swig' -B "$binary_dir" \
-DCMAKE_RUNTIME_OUTPUT_DIRECTORY="$binary_dir" \
-DCMAKE_BUILD_TYPE=Release -DDESKTOP=ON -DURHO3D_CSHARP=ON
cmake --build "$binary_dir" --config Release --parallel $ci_number_of_processors
exe=$([[ "$ci_platform" == 'uwp' ]] && echo '.exe' || echo '')
swig_exe=$([[ -f "$binary_dir/swig" ]] && echo "$binary_dir/swig$exe" || echo "$binary_dir/Release/swig$exe")
echo "SWIG_EXECUTABLE=$swig_exe" >> $GITHUB_ENV
- name: Setup PackageTool
if: env.ci_platform_group != 'desktop'
run: |
venv='${{ github.workspace }}/venv-PackageTool'
python3 -m venv "$venv"
python_exe=$([[ -f "$venv/bin/python" ]] && echo "$venv/bin/python" || echo "$venv/Scripts/python.exe")
"$python_exe" -m pip install lz4
echo "PACKAGE_TOOL_EXECUTABLE=$python_exe;${{ env.ci_source_dir }}/Source/Tools/PackageTool/PackageTool.py" >> $GITHUB_ENV
- name: Generate
id: generate
if: env.ci_platform != 'android'
run: |
# Try to catch issues with pch disabled at least somewhere.
pch=$([[ "$ci_platform" == 'linux' && "$ci_compiler" == 'clang' ]] && echo 'OFF' || echo 'ON')
${{ env.ci_build_script }} generate -- -DURHO3D_PCH=$pch 2>&1 | tee generate.log
if grep -q "Could NOT find Urho3DThirdParty" generate.log; then
echo "thirdparty-used=false" >> "$GITHUB_OUTPUT"
echo "ThirdParty will be built from source"
else
echo "thirdparty-used=true" >> "$GITHUB_OUTPUT"
echo "Using cached Urho3DThirdParty"
fi
- name: Build Debug
run: ${{ env.ci_build_script }} build --build-type dbg -- --parallel $ci_number_of_processors
- name: Build Release
run: ${{ env.ci_build_script }} build --build-type rel -- --parallel $ci_number_of_processors
- name: Test Debug (Native)
if: (env.ci_compiler == 'msvc' || env.ci_platform == 'linux')
run: ${{ env.ci_build_script }} test --build-type dbg
- name: Test Debug (Managed)
# TODO: Fix C# on x86, issue #733.
if: env.ci_platform == 'windows' && env.ci_compiler == 'msvc' && env.ci_lib_type == 'dll' && env.ci_arch == 'x64'
run: ${{ env.ci_build_script }} cstest --build-type dbg
- name: Test Release (Native)
if: (env.ci_compiler == 'msvc' || env.ci_platform == 'linux')
run: ${{ env.ci_build_script }} test --build-type rel
- name: Test Release (Managed)
# TODO: Fix C# on x86, issue #733.
if: env.ci_platform == 'windows' && env.ci_compiler == 'msvc' && env.ci_lib_type == 'dll' && env.ci_arch == 'x64'
run: ${{ env.ci_build_script }} cstest --build-type rel
- name: Copy cached SDK (ThirdParty component)
if: steps.cached_sdk.outputs.sdk-cached == 'true' && steps.generate.outputs.thirdparty-used == 'true'
run: ${{ env.ci_build_script }} copy-cached-sdk '${{ github.workspace }}/cached-sdk' '${{ env.ci_sdk_dir }}'
- name: Install
run: |
# Prepare ThirdParty file manifests
${{ env.ci_build_script }} install --build-type dbg -- --component ThirdParty --prefix '${{ env.ci_sdk_dir }}'
${{ env.ci_build_script }} install --build-type rel -- --component ThirdParty --prefix '${{ env.ci_sdk_dir }}'
echo "${{ env.ci_hash_thirdparty }}" > '${{ env.ci_sdk_dir }}/thirdparty-id.txt'
(cd '${{ env.ci_sdk_dir }}' && find . -type f | sed 's|^\./||' > thirdparty-files.txt)
# Install rest of files
${{ env.ci_build_script }} install --build-type dbg -- --prefix '${{ env.ci_sdk_dir }}'
${{ env.ci_build_script }} install --build-type rel -- --prefix '${{ env.ci_sdk_dir }}'
- name: Save Build Cache
if: env.ci_artifacts == 'true'
uses: actions/cache/save@v4
with:
path: ${{ env.CCACHE_DIR }}
key: ${{ env.ci_cache_id }}-${{ env.ci_short_sha }}
# Web-specific: Deploy to GitHub Pages
- name: Deploy to GitHub Pages
if: env.ci_platform == 'web' && env.ci_publish == 'true'
uses: peaceiris/actions-gh-pages@v3
with:
personal_token: ${{ secrets.RBFX_DOCS_DEPLOY_TOKEN }}
external_repository: rbfx/rbfx.github.io
destination_dir: samples
cname: rebelfork.io
publish_dir: ${{ env.ci_sdk_dir }}/deploy
publish_branch: master
# Android-specific: Build APK
- name: Build APK
if: env.ci_platform == 'android'
run: ${{ env.ci_build_script }} apk --build-type rel
- name: Release Mobile Artifacts
if: env.ci_platform_group == 'mobile' && env.ci_artifacts == 'true'
env:
GH_TOKEN: ${{ github.token }}
GITHUB_REPOSITORY: ${{ github.repository }}
run: ${{ env.ci_build_script }} release-mobile-artifacts
# Test projects (Desktop/UWP/Web only, excluding Android/iOS)
- uses: actions/checkout@v5
if: env.ci_platform_group != 'mobile'
id: empty_project_checkout
continue-on-error: true
with:
repository: rbfx/empty-project
path: ${{ github.workspace }}/empty-project
ref: ${{ env.SOURCE_REF }}
fetch-depth: 1
submodules: true
- uses: actions/checkout@v5
if: env.ci_platform_group != 'mobile' && steps.empty_project_checkout.outcome != 'success'
with:
repository: rbfx/empty-project
path: ${{ github.workspace }}/empty-project
ref: 'refs/heads/master'
fetch-depth: 1
submodules: true
- uses: actions/checkout@v5
if: env.ci_platform_group != 'mobile'
id: sample_project_checkout
continue-on-error: true
with:
repository: rbfx/sample-project
path: ${{ github.workspace }}/sample-project
ref: ${{ env.SOURCE_REF }}
fetch-depth: 1
submodules: true
- uses: actions/checkout@v5
if: env.ci_platform_group != 'mobile' && steps.sample_project_checkout.outcome != 'success'
with:
repository: rbfx/sample-project
path: ${{ github.workspace }}/sample-project
ref: 'refs/heads/master'
fetch-depth: 1
submodules: true
- name: Test empty-project with SDK
if: env.ci_platform_group != 'mobile'
run: ${{ env.ci_build_script }} test-project empty-project sdk
- name: Test empty-project with engine source
if: env.ci_platform_group != 'mobile'
run: ${{ env.ci_build_script }} test-project empty-project source
- name: Test sample-project with SDK
if: env.ci_platform_group != 'mobile'
run: ${{ env.ci_build_script }} test-project sample-project sdk
- name: Test sample-project with engine source
if: env.ci_platform_group != 'mobile'
run: ${{ env.ci_build_script }} test-project sample-project source
- name: Release SDK
if: ${{ env.ci_artifacts == 'true' }}
env:
GH_TOKEN: ${{ github.token }}
run: |
# Rename SDK to match the release name (without .7z), compress with 7z max compression
archive_name="rebelfork-sdk-${{ env.ci_platform_tag }}-latest"
mv SDK "$archive_name"
7z a -t7z -m0=lzma2 -mx=9 -mfb=64 -md=32m -ms=on "${archive_name}.7z" "$archive_name"
gh release upload latest "${archive_name}.7z" --repo '${{ github.repository }}' --clobber
mv "$archive_name" SDK
- name: Publish to itch.io
if: ${{ (env.ci_publish == 'true') && (vars.DISABLE_ITCH != 'true') }}
run: ${{ env.ci_build_script }} publish-to-itch
- uses: actions/upload-artifact@v4
if: ${{ env.CCACHE_DEBUG == '1' }}
with:
name: 'ccache-debug-build-${{ env.ci_platform_tag }}-${{ github.run_id }}'
path: ${{ env.CCACHE_DEBUGDIR }}
if-no-files-found: ignore
NuGet:
runs-on: ubuntu-latest
if: ${{ startsWith(github.ref, 'refs/tags/nuget/') || startsWith(github.ref, 'refs/heads/nuget/') }}
needs:
- Build
continue-on-error: true
steps:
- uses: actions/checkout@v5
with:
path: source-code
fetch-depth: 1
- name: Get short SHA
id: vars
run: echo "sha_short=$(echo ${GITHUB_SHA} | cut -c1-7)" >> $GITHUB_OUTPUT
- name: Download SDKs from releases
env:
GH_TOKEN: ${{ github.token }}
working-directory: source-code/packaging/nuget/
run: ../../${{ env.ci_build_script }} download-nuget-sdks -- '${{ github.repository }}'
- name: Nuget
working-directory: source-code/packaging/nuget/
run: |
./package.sh
for pkg in out/*.nupkg;
do
dotnet nuget push $pkg --api-key ${{ secrets.NUGET_API_KEY }} --source https://api.nuget.org/v3/index.json
done
Docs:
runs-on: ubuntu-latest
# if: env.ci_publish == 'true'
if: ${{ github.repository == 'rbfx/rbfx' && github.ref == 'refs/heads/master' }}
needs:
- Build
env:
GH_TOKEN: ${{ secrets.RBFX_DOCS_DEPLOY_TOKEN }}
steps:
- name: Trigger
run: gh workflow run --repo rbfx/rbfx-docs Documentation