mirror of
https://github.com/Earth-Genesis-Games/Carrasco.git
synced 2026-09-11 09:52:19 +00:00
Mirrors pr-conflict-check.yml's pattern on the default branch so it's active immediately instead of waiting for refactor-2026 to merge. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
103 lines
3.1 KiB
YAML
103 lines
3.1 KiB
YAML
name: Automated Tests
|
|
|
|
on:
|
|
push:
|
|
branches: [main]
|
|
pull_request:
|
|
branches: [main]
|
|
|
|
permissions:
|
|
contents: read
|
|
issues: write
|
|
|
|
jobs:
|
|
test:
|
|
name: Run Unity Tests
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@v4
|
|
with:
|
|
lfs: true
|
|
|
|
- name: Run Edit Mode Tests
|
|
uses: game-ci/unity-test-runner@v4
|
|
env:
|
|
UNITY_LICENSE: ${{ secrets.UNITY_LICENSE }}
|
|
with:
|
|
testMode: editmode
|
|
artifactsPath: test-results/editmode
|
|
|
|
- name: Run Play Mode Tests
|
|
uses: game-ci/unity-test-runner@v4
|
|
env:
|
|
UNITY_LICENSE: ${{ secrets.UNITY_LICENSE }}
|
|
with:
|
|
testMode: playmode
|
|
artifactsPath: test-results/playmode
|
|
|
|
- name: Upload Test Results
|
|
if: always()
|
|
uses: actions/upload-artifact@v4
|
|
with:
|
|
name: test-results
|
|
path: test-results/
|
|
|
|
report-failure:
|
|
name: Open issue on test failure
|
|
needs: test
|
|
if: failure()
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: Create or update tracking issue
|
|
uses: actions/github-script@v7
|
|
with:
|
|
script: |
|
|
const runUrl = `${context.serverUrl}/${context.repo.owner}/${context.repo.repo}/actions/runs/${context.runId}`;
|
|
const isPR = context.eventName === 'pull_request';
|
|
|
|
const subject = isPR
|
|
? `PR #${context.payload.pull_request.number} ("${context.payload.pull_request.title}")`
|
|
: `commit ${context.sha.substring(0, 7)} on \`${context.ref.replace('refs/heads/', '')}\``;
|
|
|
|
const title = isPR
|
|
? `Unity tests failing: PR #${context.payload.pull_request.number}`
|
|
: `Unity tests failing on ${context.ref.replace('refs/heads/', '')}`;
|
|
|
|
const body = [
|
|
`The **Automated Tests** workflow failed for ${subject}.`,
|
|
'',
|
|
`**Workflow run**: ${runUrl}`,
|
|
'',
|
|
'Check the Edit Mode / Play Mode test results artifact attached to the run',
|
|
'above for the specific failing test(s). This issue will stay open until a',
|
|
'follow-up run passes — close it manually once resolved.',
|
|
].join('\n');
|
|
|
|
const { data: existing } = await github.rest.issues.listForRepo({
|
|
owner: context.repo.owner,
|
|
repo: context.repo.repo,
|
|
state: 'open',
|
|
labels: 'ci-failure',
|
|
});
|
|
|
|
const match = existing.find(issue => issue.title === title);
|
|
|
|
if (match) {
|
|
await github.rest.issues.createComment({
|
|
owner: context.repo.owner,
|
|
repo: context.repo.repo,
|
|
issue_number: match.number,
|
|
body: `Still failing as of ${runUrl}.`,
|
|
});
|
|
} else {
|
|
await github.rest.issues.create({
|
|
owner: context.repo.owner,
|
|
repo: context.repo.repo,
|
|
title,
|
|
body,
|
|
labels: ['ci-failure'],
|
|
});
|
|
}
|