Skip to content

CodeQL with Game-CI #103

CodeQL with Game-CI

CodeQL with Game-CI #103

Workflow file for this run

name: Unity Cross-Platform Test Workflow
on:
push:
branches: ["main"]
pull_request:
types: [opened, synchronize]
jobs:
buildAndTestForLinuxBasedPlatforms:
name: Test for ${{ matrix.targetPlatform }}
runs-on: ubuntu-latest-32
concurrency:
group: Unity-Test-${{ matrix.targetPlatform }}-${{ github.ref }}
cancel-in-progress: true
strategy:
fail-fast: false
matrix:
projectPath:
- "."
unityVersion:
- 2022.3.17f1
targetPlatform:
- StandaloneLinux64 # Build a Linux 64-bit standalone.
- iOS # Build an iOS player.
- Android # Build an Android player.
- WebGL # WebGL.
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
lfs: false
- uses: actions/cache@v3
with:
path: ${{ matrix.projectPath }}/Library
key:
Library-${{ matrix.projectPath }}-${{ matrix.targetPlatform }}-${{
hashFiles(matrix.projectPath) }}
restore-keys: |
Library-${{ matrix.projectPath }}-${{ matrix.targetPlatform }}-
Library-${{ matrix.projectPath }}-
Library-
- name: Setup Config
env:
CLIENT_ID: ${{ secrets.CLIENT_ID }}
run: |
mkdir -p Assets/Tests/Resources
echo '{"clientId": "${{ secrets.CLIENT_ID }}"}' > Assets/Tests/Resources/config.json
shell: bash
- name: Run Tests
uses: game-ci/unity-test-runner@v4
id: testRunner
env:
UNITY_LICENSE: ${{ secrets.UNITY_LICENSE }}
UNITY_EMAIL: ${{ secrets.UNITY_EMAIL }}
UNITY_PASSWORD: ${{ secrets.UNITY_PASSWORD }}
with:
artifactsPath: Artifacts/${{ matrix.targetPlatform }}
projectPath: ${{ matrix.projectPath }}
unityVersion: ${{ matrix.unityVersion }}
githubToken: ${{ secrets.GITHUB_TOKEN }}
testMode: PlayMode # Run PlayMode tests.
- name: Upload Test Results
uses: actions/upload-artifact@v3
if: always()
with:
name: TestResults-${{ matrix.targetPlatform }}-${{ github.run_number }}
path: ${{ steps.testRunner.outputs.artifactsPath }}
- name: Download Test Results
uses: actions/download-artifact@v3
if: always()
with:
name: TestResults-${{ matrix.targetPlatform }}-${{ github.run_number }}
path: ${{ matrix.projectPath }}/TestResults-${{ matrix.targetPlatform }}
- name: Publish Test Results
uses: EnricoMi/publish-unit-test-result-action@v2
if: always()
with:
files: ${{ matrix.projectPath }}/TestResults-${{ matrix.targetPlatform }}/**/*.xml
check_name: "Test Results for ${{ matrix.targetPlatform }}"
comment_title: "Test Results for ${{ matrix.targetPlatform }}"
# - uses: jlumbroso/[email protected]
- name: Build to Generate Project Files
uses: game-ci/unity-builder@v4
env:
UNITY_LICENSE: ${{ secrets.UNITY_LICENSE }}
UNITY_EMAIL: ${{ secrets.UNITY_EMAIL }}
UNITY_PASSWORD: ${{ secrets.UNITY_PASSWORD }}
with:
projectPath: ${{ matrix.projectPath }}
unityVersion: ${{ matrix.unityVersion }}
targetPlatform: ${{ matrix.targetPlatform }}
allowDirtyBuild: true
- name: Initialize CodeQL
uses: github/codeql-action/init@v3
with:
languages: "csharp"
- name: Autobuild CodeQL
uses: github/codeql-action/autobuild@v3
- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v3