Skip to content

Use CompositeOperation only in Unity 2022_1 or newer #440

Use CompositeOperation only in Unity 2022_1 or newer

Use CompositeOperation only in Unity 2022_1 or newer #440

Workflow file for this run

name: Build (multiple jobs)
on:
push:
jobs:
params:
name: Params
runs-on: ubuntu-latest
outputs:
jobs: ${{ steps.params.outputs.jobs }}
steps:
- name: Parameters
id: params
shell: python
run: |
import os
is_pro_master = os.environ['GITHUB_REF_NAME'] == 'pro-master'
is_pro = os.environ['GITHUB_REPOSITORY'] == "OndrejNepozitek/Edgar-UnityPRO"
unity_versions = ['2019.4.40f1', '2020.3.48f1', '2021.3.35f1', '2022.3.19f1', '2023.2.9f1']
if os.environ['GITHUB_REF_NAME'] == '2019/pro-dev-grid-3d':
unity_versions = ['2019.4.36f1']
render_pipelines = ['builtin', 'URP']
structure_branch = 'pro' if is_pro else 'master'
jobs = [
{
'unityVersion': unity_version,
'renderPipeline': render_pipeline,
'structureBranch': structure_branch if render_pipeline == 'builtin' else 'urp'
}
for unity_version in unity_versions
for render_pipeline in render_pipelines
if render_pipeline == 'builtin' or is_pro_master or (unity_version.startswith('2019') and is_pro)
]
print(f'::set-output name=jobs::{jobs!s}')
print("Jobs:")
print(jobs)
build:
name: Test & build
needs: [params]
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
include: ${{ fromJson(needs.params.outputs.jobs) }}
steps:
# Disabled for now
- name: Free Disk Space (Ubuntu)
uses: jlumbroso/free-disk-space@main
if: ${{ false }}
with:
# this might remove tools that are actually needed,
# if set to "true" but frees about 6 GB
tool-cache: false
# Checkout Unity project structure
- name: Checkout Unity project structure
uses: actions/checkout@v4
with:
repository: OndrejNepozitek/Edgar-UnityProjectStructure
ref: ${{ matrix.structureBranch }}
# Checkout this repository
- name: Checkout this repository
uses: actions/checkout@v4
with:
path: Assets/Edgar
# Test
- name: Run tests
uses: game-ci/unity-test-runner@v4
env:
UNITY_LICENSE: ${{ secrets.UNITY_LICENSE_NEW }}
UNITY_EMAIL: ${{ secrets.UNITY_EMAIL }}
UNITY_PASSWORD: ${{ secrets.UNITY_PASSWORD }}
with:
unityVersion: ${{ matrix.unityVersion }}
githubToken: ${{ secrets.GITHUB_TOKEN }}
# Build
- name: Run build
uses: game-ci/unity-builder@v4
env:
UNITY_LICENSE: ${{ secrets.UNITY_LICENSE }}
UNITY_EMAIL: ${{ secrets.UNITY_EMAIL }}
UNITY_PASSWORD: ${{ secrets.UNITY_PASSWORD }}
with:
unityVersion: ${{ matrix.unityVersion }}
targetPlatform: StandaloneLinux64
versioning: None
package:
name: Package
runs-on: ubuntu-latest
steps:
# Checkout Unity project structure
- name: Checkout Unity project structure
uses: actions/checkout@v4
with:
repository: OndrejNepozitek/ProceduralLevelGenerator-UnityProjectStructure
# Checkout this repository
- name: Checkout this repository
uses: actions/checkout@v4
with:
path: Assets/Edgar
# Prepare unitypackage file list
- name: Prepare unitypackage file list
run: |
echo "Assets/Edgar.meta" > unitypackageFiles
find ./Assets/Edgar/ -name \*.meta ! -path "./Assets/Edgar/Tests*" ! -path "./Assets/Edgar/Examples/Grid2D/Platformer3*" ! -path "./Assets/Edgar/Examples/Grid3D/Docs*" ! -path "./Assets/Edgar/Examples/Grid2D/Resources/Docs*" ! -path "./Assets/Edgar/*.md.meta" ! -path "./Assets/Edgar/Edgar-Unity.sln.DotSettings.meta" >> unitypackageFiles
# Package files
- name: Package files
uses: pCYSl5EDgo/create-unitypackage@master
with:
package-path: 'Edgar.unitypackage'
include-files: unitypackageFiles
# Upload unitypackage
- name: Upload unitypackage
uses: actions/upload-artifact@v4
with:
path: Edgar.unitypackage
name: Edgar_CI_build.unitypackage
release:
name: Release
runs-on: ubuntu-latest
needs: [package, build]
if: startsWith(github.ref, 'refs/tags/')
steps:
# Download package
- name: Download package
uses: actions/download-artifact@v3
with:
name: Edgar_CI_build.unitypackage
# Prepare release package name
- name: Prepare release package name
shell: python
run: |
import os
ref = os.environ["GITHUB_REF_NAME"]
ref = ref.replace('v', '', 1)
ref = ref.replace('.', '_')
ref = ref.replace('-', '_')
package_name = f"Edgar_{ref}.unitypackage"
print(f"::set-output name=PACKAGE_NAME::{package_name}")
import shutil
shutil.copyfile('Edgar.unitypackage', package_name)
env:
GITHUB_REF_NAME: ${{ github.ref_name }}
id: get_package_name
# Upload unitypackage
- name: Upload unitypackage
uses: actions/upload-artifact@v3
with:
path: ${{ steps.get_package_name.outputs.PACKAGE_NAME }}
name: ${{ steps.get_package_name.outputs.PACKAGE_NAME }}
# Release
- name: Release
uses: softprops/action-gh-release@v1
with:
files: ${{ steps.get_package_name.outputs.PACKAGE_NAME }}
draft: true
fail_on_unmatched_files: true
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
api-docs:
name: Rebuild API docs
runs-on: ubuntu-latest
if: github.ref_name == 'pro-dev'
steps:
# Trigger api docs build
- name: Trigger api docs build
run: |
curl -XPOST -u "${{secrets.GH_PAT_USERNAME}}:${{secrets.GH_PAT}}" -H "Accept: application/vnd.github.everest-preview+json" -H "Content-Type: application/json" https://api.github.com/repos/OndrejNepozitek/ProceduralLevelGenerator-UnityApiDocs/dispatches --data '{"event_type": "build_application"}'