Skip to content

Commit

Permalink
ci: try to test on standalone configuration
Browse files Browse the repository at this point in the history
  • Loading branch information
bdunderscore committed Oct 6, 2023
1 parent b7c88bf commit 83291e7
Showing 1 changed file with 91 additions and 10 deletions.
101 changes: 91 additions & 10 deletions .github/workflows/gameci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,41 +42,94 @@ permissions: {}

jobs:
build-and-test:
name: Unit tests
strategy:
matrix:
#unity_version: [ auto, 2022.3.5f1 ]
unity_version: [ auto ]
unity_version: [ auto, 2022.3.5f1 ]
sdk: [ vrcsdk, standalone ]
runs-on: ubuntu-latest
permissions:
checks: write
contents: read
steps:
- id: setup
name: Setup
env:
unity_version: ${{ matrix.unity_version }}
sdk: ${{ matrix.sdk }}
run: |
set -x
should_test=true
if [ $sdk == vrcsdk ] && [ $unity_version != auto ]; then
should_test=false
fi
echo should_test=$should_test >> $GITHUB_OUTPUT
can_fail=false
if [ $sdk == standalone ] || [ $unity_version != auto ]; then
can_fail=$should_test
fi
echo can_fail=$can_fail >> $GITHUB_OUTPUT
check_name="Unsupported platform result ($unity_version, $sdk)"
echo check_name=$check_name >> $GITHUB_OUTPUT
- uses: LouisBrunner/checks-action@v1.6.2
id: create_check
name: Create check
if: ${{ github.event_name == 'pull_request_target' && steps.setup.outputs.can_fail == 'true' }}
with:
token: ${{ github.token }}
name: ${{ steps.setup.outputs.check_name }}
status: in_progress


- uses: LouisBrunner/checks-action@v1.6.2
id: create_skipped_check
name: Create check
if: ${{ github.event_name == 'pull_request_target' && steps.setup.outputs.should_test == 'false' }}
with:
token: ${{ github.token }}
name: ${{ steps.setup.outputs.check_name }}
conclusion: skipped
output: '{ "summary": "Skipped" }'

- uses: actions/checkout@v3
if: ${{ steps.setup.outputs.should_test == 'true' }}
with:
ref: ${{ github.event.pull_request.head.sha }}

- run: |
- id: prepare-project
if: ${{ steps.setup.outputs.should_test == 'true' }}
name: Prepare project
run: |
mkdir .github/ProjectRoot/Packages/nadena.dev.ndmf -p
mv [^P]* .github/ProjectRoot/Packages/nadena.dev.ndmf
mv .github/ProjectRoot/* .
mv 'Packages/nadena.dev.ndmf/UnitTests~' 'Packages/nadena.dev.ndmf/UnitTests'
- uses: anatawa12/sh-actions/resolve-vpm-packages@master
name: Resolve VPM packages
if: ${{ matrix.sdk == 'vrcsdk' && steps.setup.outputs.should_test == 'true' }}

- run: |
- if: ${{ steps.setup.outputs.should_test == 'true' }}
name: "Debug: List project contents"
run: |
ls -lR
- run: |
ls -lR Packages/nadena*
- uses: actions/cache@v3
if: ${{ steps.setup.outputs.should_test == 'true' }}
with:
path: Library
key: Library-${{ matrix.unity_version }}
key: Library-${{ matrix.unity_version }}-${{ matrix.sdk }}
restore-keys: Library-

- uses: game-ci/unity-test-runner@v3
id: gameci
continue-on-error: ${{ matrix.unity_version != 'auto' }}
continue-on-error: ${{ steps.setup.outputs.can_fail != 'true' }}
if: ${{ steps.setup.outputs.should_test == 'true' }}
env:
# meh, just a personal license...
UNITY_LICENSE: ${{ secrets.UNITY_LICENSE }}
Expand All @@ -87,14 +140,42 @@ jobs:
coverageOptions: generateAdditionalMetrics;generateHtmlReport;generateBadgeReport;assemblyFilters:+nadena.dev.*
customParameters: -nographics -assemblyNames nadena.dev.ndmf.UnitTests

# For our main "supported" platforms, we report the conclusion of gameci as-is. However, for standalone, we report
# neutral if it failed.
- id: determine_conclusion
name: Determine conclusion
if: ${{ steps.setup.outputs.should_test == 'true' }}
env:
unity_version: ${{ matrix.unity_version }}
sdk_platform: ${{ matrix.sdk }}
gameci_outcome: ${{ steps.gameci.outcome }}
can_fail: ${{ steps.setup.outputs.can_fail }}
run: |
outcome=$gameci_outcome
output="{ \"summary\": \"Result: $outcome\" }"
if [ "$gameci_outcome" == "failure" ] && $can_fail; then
outcome=neutral
fi
echo matrix_outcome=$outcome >> $GITHUB_OUTPUT
echo matrix_output=$output >> $GITHUB_OUTPUT
- uses: LouisBrunner/checks-action@v1.6.2
name: Set check conclusion
if: ${{ github.event_name == 'pull_request_target' && steps.setup.outputs.can_fail == 'true' }}
with:
token: ${{ github.token }}
check_id: ${{ steps.create_check.outputs.check_id }}
conclusion: ${{ steps.determine_conclusion.outputs.matrix_outcome }}
output: ${{ steps.determine_conclusion.outputs.matrix_output }}

- uses: actions/upload-artifact@v3
if: always()
if: ${{ steps.setup.outputs.should_test == 'true' }}
with:
name: Test results
name: Test results ${{ matrix.unity_version }} ${{ matrix.sdk }}
path: ${{ steps.gameci.outputs.artifactsPath }}

- uses: actions/upload-artifact@v3
if: always()
if: ${{ steps.setup.outputs.should_test == 'true' }}
with:
name: Coverage results
name: Coverage results ${{ matrix.unity_version }} ${{ matrix.sdk }}
path: ${{ steps.gameci.outputs.coveragePath }}

0 comments on commit 83291e7

Please sign in to comment.