Skip to content

Commit

Permalink
chore: update test workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
mob-sakai committed Dec 18, 2024
1 parent 95235a9 commit 072aac5
Showing 1 changed file with 44 additions and 24 deletions.
68 changes: 44 additions & 24 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,34 +3,36 @@
# UNITY_EMAIL: Unity user email to login
# UNITY_PASSWORD: Unity user password to login
name: 🧪 Test
run-name: 🧪 Test (${{ github.ref_name }})
run-name: 🧪 Test (${{ github.event.pull_request.title || github.ref_name }})

env:
# MINIMUM_VERSION: The minimum version of Unity.
MINIMUM_VERSION: 2019.4
# EXCLUDE_FILTER: The excluded versions of Unity.
EXCLUDE_FILTER: '(2020.2.0|2021.1|2023.3)'
EXCLUDE_FILTER: "(2020.2.0|2021.1|2023.3)"

on:
workflow_dispatch:
inputs:
usePeriodVersions:
description: 'Use the period versions (.0f1, .10f1, 20f1, ...).'
description: "Use the period versions (.0f1, .10f1, 20f1, ...)."
required: false
default: 'true'
default: "true"
push:
branches:
- develop
- develop-preview
- develop-4.x
tags:
- "!*"
paths-ignore:
- "*.md"
pull_request:
- "**.md"
pull_request_target:
types:
- opened
- reopened
- synchronize
paths-ignore:
- "**.md"

jobs:
setup:
Expand All @@ -43,7 +45,7 @@ jobs:
id: setup
run: |
echo "==== Target Unity Versions ===="
LATEST_VERSIONS=`npx unity-changeset@2.2.3 list --versions --latest-patch --min ${MINIMUM_VERSION} --json --all`
LATEST_VERSIONS=`npx unity-changeset@latest list --versions --latest-patch --min ${MINIMUM_VERSION} --json --all`
if [ "${{ inputs.usePeriodVersions }}" = "true" ]; then
ADDITIONAL_VERSIONS=`npx unity-changeset list --versions --grep '0f' --min ${MINIMUM_VERSION} --json`
else
Expand All @@ -57,10 +59,6 @@ jobs:
test:
name: 🧪 Run tests
runs-on: ubuntu-latest
env:
UNITY_EMAIL: ${{ secrets.UNITY_EMAIL }}
UNITY_PASSWORD: ${{ secrets.UNITY_PASSWORD }}
UNITY_LICENSE: ${{ secrets.UNITY_LICENSE }}
permissions:
checks: write
contents: read
Expand All @@ -71,14 +69,29 @@ jobs:
matrix:
unityVersion: ${{ fromJson(needs.setup.outputs.unityVersions) }}
steps:
- name: 🚚 Checkout
- name: 🚚 Checkout ($${{ github.ref }})
if: github.event_name == 'push'
uses: actions/checkout@v4

- name: 🚚 Checkout pull request (pull_request_target)
if: github.event_name == 'pull_request_target'
uses: actions/checkout@v4
with:
ref: ${{ github.event.pull_request.head.sha }}
fetch-depth: 0

- name: 🚚 Marge pull request (pull_request_target)
if: github.event_name == 'pull_request_target'
run: |
git config user.name "GitHub Actions"
git config user.email "[email protected]"
git merge origin/${{ github.event.pull_request.base.ref }} --no-edit
- name: 📥 Cache library
uses: actions/cache@v4
with:
path: Library
key: Library-${{ matrix.unityVersion }}-${{ github.sha }}
key: Library-${{ matrix.unityVersion }}-${{ github.event.pull_request.head.sha || github.sha }}
restore-keys: |
Library-${{ matrix.unityVersion }}-
Library-
Expand All @@ -91,14 +104,21 @@ jobs:
targetPlatform: StandaloneLinux64
allowDirtyBuild: true
customParameters: -nographics
env:
UNITY_EMAIL: ${{ secrets.UNITY_EMAIL }}
UNITY_PASSWORD: ${{ secrets.UNITY_PASSWORD }}
UNITY_LICENSE: ${{ secrets.UNITY_LICENSE }}

# - name: 🧪 Run tests
# uses: game-ci/unity-test-runner@v4
# timeout-minutes: 45
# with:
# customImage: ghcr.io/mob-sakai/unity3d:${{ matrix.unityVersion }}
# # unityVersion: ${{ matrix.unityVersion }}
# customParameters: -nographics
# checkName: ${{ matrix.unityVersion }} Test Results
# githubToken: ${{ github.token }}
# coverageOptions: "dontClear;generateHtmlReport;generateBadgeReport;pathFilters:+**/Packages/src/**;assemblyFilters:+<packages>,-*.Editor,-*.Test"
- name: 🧪 Run tests
uses: game-ci/unity-test-runner@v4
timeout-minutes: 45
with:
customImage: ghcr.io/mob-sakai/unity3d:${{ matrix.unityVersion }}
# unityVersion: ${{ matrix.unityVersion }}
customParameters: -nographics
checkName: ${{ matrix.unityVersion }} Test Results
githubToken: ${{ github.token }}
env:
UNITY_EMAIL: ${{ secrets.UNITY_EMAIL }}
UNITY_PASSWORD: ${{ secrets.UNITY_PASSWORD }}
UNITY_LICENSE: ${{ secrets.UNITY_LICENSE }}

0 comments on commit 072aac5

Please sign in to comment.