Skip to content

Instantly share code, notes, and snippets.

@marpe
Created February 4, 2021 10:29
Show Gist options
  • Save marpe/db2c711edfd70f718dd9aaedae9598cc to your computer and use it in GitHub Desktop.
Save marpe/db2c711edfd70f718dd9aaedae9598cc to your computer and use it in GitHub Desktop.
gameci workflow file for unity testing with coverage and building
name: Actions 😎
on:
push:
branches:
- master
env:
UNITY_LICENSE: ${{ secrets.UNITY_LICENSE }}
jobs:
test:
name: Test
runs-on: ubuntu-latest
steps:
# Checkout
- name: Checkout repository
uses: actions/checkout@v2
with:
lfs: true
# Cache
- uses: actions/cache@v2
with:
path: TW.Unity/Library
key: TW.Unity-Library
# Test
- name: Run tests
uses: webbertakken/unity-test-runner@v2.0-alpha-2
with:
unityVersion: 2020.2.2f1
projectPath: TW.Unity
customParameters: -enableCodeCoverage -coverageResultsPath /github/workspace/artifacts/coverage -coverageHistoryPath /github/workspace/artifacts/coverage-history -coverageOptions generateHtmlReport;generateHtmlReportHistory;generateBadgeReport;generateAdditionalMetrics;assemblyFilters:+UTW.*;pathFilters:-*/Tests/*,-*/BuiltInPackages/* -debugCodeOptimization
# Publish test results
- name: Publish test results
uses: rainbow-duck-games/unity-test-publisher@0.1.4
if: always()
with:
reportPaths: artifacts/*.xml
githubToken: ${{ secrets.GITHUB_TOKEN }}
workdirPrefix: /github/workspace/TW.Unity
# Upload test results
- uses: actions/upload-artifact@v2
if: always()
with:
name: Test results
path: artifacts
build:
needs: test
name: Build
runs-on: ubuntu-latest
steps:
# Checkout
- name: Checkout repository
uses: actions/checkout@v2
with:
lfs: true
# Cache
- uses: actions/cache@v2
with:
path: TW.Unity/Library
key: TW.Unity-Library
# Build
- name: Build project
uses: webbertakken/unity-builder@v2.0-alpha-6
with:
unityVersion: 2020.2.2f1
targetPlatform: Android
versioning: Semantic
projectPath: TW.Unity
allowDirtyBuild: true
# Output
- uses: actions/upload-artifact@v2
with:
name: Build
path: build
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment