Skip to content

Unify release asset filenames using package ID and version #123

Unify release asset filenames using package ID and version

Unify release asset filenames using package ID and version #123

Workflow file for this run

name: Tests
on:
push:
branches:
- main
pull_request: {}
workflow_dispatch: {}
permissions:
contents: read
jobs:
changes:
name: Determine required checks
runs-on: ubuntu-22.04
permissions:
contents: read
pull-requests: read
outputs:
unity: ${{ github.event_name == 'workflow_dispatch' && 'true' || steps.filter.outputs.unity }}
steps:
- name: Checkout
if: github.event_name == 'push'
uses: actions/checkout@v7
- name: Detect Unity changes
id: filter
if: github.event_name != 'workflow_dispatch'
uses: dorny/paths-filter@v4
with:
filters: |
unity:
- 'Assets/**'
- 'Packages/**'
- 'ProjectSettings/**'
- '.github/actions/setup-unity/**'
- '.github/workflows/tests.yaml'
- '.gitattributes'
test:
name: EditMode on Unity ${{ matrix.unityVersion }}
needs: changes
if: needs.changes.outputs.unity == 'true'
runs-on: ubuntu-22.04
timeout-minutes: 45
strategy:
fail-fast: false
matrix:
unityVersion:
- 2021.3.45f2
- 6000.6.6f1
steps:
- name: Checkout
uses: actions/checkout@v7
with:
lfs: true
- name: Set up Unity
uses: ./.github/actions/setup-unity
with:
editor-version: ${{ matrix.unityVersion }}
email: ${{ secrets.UNITY_EMAIL }}
password: ${{ secrets.UNITY_PASSWORD }}
- name: Cache Library
uses: actions/cache@v6
with:
path: Library
key: Library-${{ runner.os }}-${{ matrix.unityVersion }}-EditMode-${{ hashFiles('Packages/manifest.json', 'Packages/packages-lock.json', 'ProjectSettings/ProjectVersion.txt') }}
restore-keys: Library-${{ runner.os }}-${{ matrix.unityVersion }}-EditMode-
- name: Install window manager for Editor windows
run: |
sudo apt-get update
sudo apt-get install --yes --no-install-recommends openbox x11-utils
- name: Run EditMode tests
env:
LIBGL_ALWAYS_SOFTWARE: '1'
UNITY_EDITOR_VERSION: ${{ matrix.unityVersion }}
run: |
mkdir -p Logs
xvfb-run --auto-servernum --server-args="-screen 0 1280x1024x24" \
bash -euo pipefail <<'DISPLAY_SESSION'
# Xvfb supplies a display, but EditorWindow resize/focus also needs a WM.
openbox --sm-disable > Logs/window-manager.log 2>&1 &
window_manager_pid=$!
trap 'kill "$window_manager_pid" 2>/dev/null || true' EXIT
timeout 15 bash -c 'until xprop -root _NET_SUPPORTING_WM_CHECK | grep -q "window id"; do sleep 0.1; done'
unity --non-interactive test . \
--editor-version "$UNITY_EDITOR_VERSION" \
--mode EditMode \
--output Logs/TestResults/editmode.xml \
--timeout 1200 \
-- -force-glcore -timestamps -logFile Logs/editmode.log
DISPLAY_SESSION
- name: Return Unity license
if: always() && env.UNITY_LICENSE_ACTIVATION_ATTEMPTED == 'true'
timeout-minutes: 5
env:
UNITY_EDITOR_VERSION: ${{ matrix.unityVersion }}
UNITY_EMAIL: ${{ secrets.UNITY_EMAIL }}
UNITY_PASSWORD: ${{ secrets.UNITY_PASSWORD }}
run: bash .github/actions/setup-unity/return-license.sh
- name: Upload test results and logs
if: always()
uses: actions/upload-artifact@v7
with:
name: TestResults-${{ matrix.unityVersion }}-EditMode
path: Logs/
verify:
name: Verification
needs: [changes, test]
if: always()
runs-on: ubuntu-22.04
steps:
- name: Require all applicable checks to pass
env:
CHANGES_RESULT: ${{ needs.changes.result }}
UNITY_REQUIRED: ${{ needs.changes.outputs.unity }}
TEST_RESULT: ${{ needs.test.result }}
run: |
if [[ "$CHANGES_RESULT" != success ]]; then
echo "::error::Could not determine required checks ($CHANGES_RESULT)."
exit 1
fi
case "$UNITY_REQUIRED:$TEST_RESULT" in
true:success)
echo "All required EditMode tests passed."
;;
false:skipped)
echo "No Unity changes require EditMode tests."
;;
*)
echo "::error::EditMode validation did not pass (required=$UNITY_REQUIRED, result=$TEST_RESULT)."
exit 1
;;
esac