Add ability system #110
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Build project | |
on: | |
pull_request: | |
branches: [master] | |
paths: | |
- "Assets/**" | |
- "Packages/**" | |
- "ProjectSettings/**" | |
- "react/**" | |
push: | |
branches: | |
- master | |
paths: | |
- "Assets/**" | |
- "Packages/**" | |
- "ProjectSettings/**" | |
- "react/**" | |
workflow_dispatch: | |
jobs: | |
buildReact: | |
name: Build React UI | |
runs-on: ubuntu-latest | |
steps: | |
# Checkout (without LFS) | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
# Git LFS | |
- name: Create LFS file list | |
run: git lfs ls-files -l | cut -d' ' -f1 | sort > .lfs-assets-id | |
- name: Restore LFS cache | |
uses: actions/cache@v4 | |
id: lfs-cache | |
with: | |
path: .git/lfs | |
key: ${{ runner.os }}-lfs-${{ hashFiles('.lfs-assets-id') }} | |
restore-keys: | | |
${{ runner.os }}-lfs- | |
- name: Git LFS Pull | |
run: | | |
git lfs pull | |
git add . | |
git reset --hard | |
- uses: actions/setup-node@v4 | |
with: | |
node-version-file: "react/.nvmrc" | |
- name: Cache node_modules | |
id: cache-npm | |
uses: actions/cache@v4 | |
env: | |
cache-name: cache-node-modules | |
with: | |
path: ~/.npm | |
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('react/package-lock.json') }} | |
restore-keys: | | |
${{ runner.os }}-build-${{ env.cache-name }}- | |
- if: ${{ steps.cache-npm.outputs.cache-hit != 'true' }} | |
name: List the state of node_modles | |
continue-on-error: true | |
run: npm list | |
working-directory: ./react | |
- name: Install dependencies | |
run: npm install | |
working-directory: ./react | |
- name: Build | |
run: npm run build | |
working-directory: ./react | |
env: | |
BUILD_PATH: ./build | |
- uses: actions/upload-artifact@v4 | |
with: | |
name: Build-React | |
path: react/build | |
retention-days: 14 | |
test: | |
permissions: | |
contents: write | |
checks: write | |
name: Test project 🧪 | |
needs: buildReact | |
runs-on: ubuntu-latest | |
steps: | |
# Checkout (without LFS) | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
# Git LFS | |
- name: Create LFS file list | |
run: git lfs ls-files -l | cut -d' ' -f1 | sort > .lfs-assets-id | |
- name: Restore LFS cache | |
uses: actions/cache@v4 | |
id: lfs-cache | |
with: | |
path: .git/lfs | |
key: ${{ runner.os }}-lfs-${{ hashFiles('.lfs-assets-id') }} | |
restore-keys: | | |
${{ runner.os }}-lfs- | |
- name: Git LFS Pull | |
run: | | |
git lfs pull | |
git add . | |
git reset --hard | |
# Cache | |
- uses: actions/cache@v4 | |
with: | |
path: Library | |
key: Library-${{ hashFiles('Assets/**', 'Packages/**', 'ProjectSettings/**') }} | |
restore-keys: | | |
Library- | |
# Check formating | |
- run: dotnet tool restore | |
- run: dotnet csharpier --check . | |
- name: Free disk space | |
uses: jlumbroso/free-disk-space@main | |
# Test | |
- name: Run tests | |
uses: game-ci/unity-test-runner@v4 | |
env: | |
UNITY_LICENSE: ${{ secrets.UNITY_LICENSE }} | |
UNITY_EMAIL: ${{ secrets.UNITY_EMAIL }} | |
UNITY_PASSWORD: ${{ secrets.UNITY_PASSWORD }} | |
with: | |
githubToken: ${{ secrets.GITHUB_TOKEN }} | |
buildForWebGL: | |
name: Build For WebGL Platform | |
needs: buildReact | |
runs-on: ubuntu-latest | |
steps: | |
# Checkout (without LFS) | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
# Git LFS | |
- name: Create LFS file list | |
run: git lfs ls-files -l | cut -d' ' -f1 | sort > .lfs-assets-id | |
- name: Restore LFS cache | |
uses: actions/cache@v4 | |
id: lfs-cache | |
with: | |
path: .git/lfs | |
key: ${{ runner.os }}-lfs-${{ hashFiles('.lfs-assets-id') }} | |
restore-keys: | | |
${{ runner.os }}-lfs- | |
- name: Git LFS Pull | |
run: | | |
git lfs pull | |
git add . | |
git reset --hard | |
# Cache | |
- uses: actions/cache@v4 | |
with: | |
path: Library | |
key: Library-${{ hashFiles('Assets/**', 'Packages/**', 'ProjectSettings/**') }} | |
restore-keys: | | |
Library- | |
- name: Free disk space | |
uses: jlumbroso/free-disk-space@main | |
- name: Download React UI Build Output | |
uses: actions/download-artifact@v4 | |
with: | |
name: Build-React | |
path: Assets/Resources/react | |
- name: Build WebGL | |
uses: game-ci/unity-builder@v4 | |
env: | |
UNITY_LICENSE: ${{ secrets.UNITY_LICENSE }} | |
UNITY_EMAIL: ${{ secrets.UNITY_EMAIL }} | |
UNITY_PASSWORD: ${{ secrets.UNITY_PASSWORD }} | |
with: | |
targetPlatform: WebGL | |
- uses: actions/upload-artifact@v4 | |
with: | |
name: Build-WebGL | |
path: build/WebGL | |
retention-days: 14 | |
buildForAndroidPlatform: | |
name: Build For Android Platform | |
needs: buildReact | |
runs-on: ubuntu-latest | |
steps: | |
# Checkout (without LFS) | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
# Git LFS | |
- name: Create LFS file list | |
run: git lfs ls-files -l | cut -d' ' -f1 | sort > .lfs-assets-id | |
- name: Restore LFS cache | |
uses: actions/cache@v4 | |
id: lfs-cache | |
with: | |
path: .git/lfs | |
key: ${{ runner.os }}-lfs-${{ hashFiles('.lfs-assets-id') }} | |
restore-keys: | | |
${{ runner.os }}-lfs- | |
- name: Git LFS Pull | |
run: | | |
git lfs pull | |
git add . | |
git reset --hard | |
# Cache | |
- uses: actions/cache@v4 | |
with: | |
path: Library | |
key: Library-${{ hashFiles('Assets/**', 'Packages/**', 'ProjectSettings/**') }} | |
restore-keys: | | |
Library- | |
- name: Free disk space | |
uses: jlumbroso/free-disk-space@main | |
- name: Download React UI Build Output | |
uses: actions/download-artifact@v4 | |
with: | |
name: Build-React | |
path: Assets/Resources/react | |
- name: Build Android APK | |
uses: game-ci/unity-builder@v4 | |
env: | |
UNITY_LICENSE: ${{ secrets.UNITY_LICENSE }} | |
UNITY_EMAIL: ${{ secrets.UNITY_EMAIL }} | |
UNITY_PASSWORD: ${{ secrets.UNITY_PASSWORD }} | |
with: | |
versioning: None | |
targetPlatform: Android | |
androidKeystoreName: user # This file won't exist, but this property needs to exist. | |
androidKeystoreBase64: ${{ secrets.ANDROID_KEYSTORE_BASE64 }} | |
androidKeystorePass: ${{ secrets.ANDROID_KEYSTORE_PASS }} | |
androidKeyaliasName: ${{ secrets.ANDROID_KEYALIAS_NAME }} | |
androidKeyaliasPass: ${{ secrets.ANDROID_KEYALIAS_PASS }} | |
- uses: actions/upload-artifact@v4 | |
with: | |
name: Build-Android | |
path: build/Android | |
retention-days: 14 | |
buildForWindowsPlatform: | |
name: Build For Windows Platform | |
needs: buildReact | |
runs-on: windows-2022 | |
steps: | |
# Checkout (without LFS) | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
# Git LFS | |
- name: Create LFS file list | |
run: git lfs ls-files -l | cut -d' ' -f1 | sort > .lfs-assets-id | |
- name: Restore LFS cache | |
uses: actions/cache@v4 | |
id: lfs-cache | |
with: | |
path: .git/lfs | |
key: ${{ runner.os }}-lfs-${{ hashFiles('.lfs-assets-id') }} | |
restore-keys: | | |
${{ runner.os }}-lfs- | |
- name: Git LFS Pull | |
run: | | |
git lfs pull | |
git add . | |
git reset --hard | |
# Cache | |
- uses: actions/cache@v4 | |
with: | |
path: Library | |
key: Library-${{ hashFiles('Assets/**', 'Packages/**', 'ProjectSettings/**') }} | |
restore-keys: | | |
Library- | |
- name: Download React UI Build Output | |
uses: actions/download-artifact@v4 | |
with: | |
name: Build-React | |
path: Assets/Resources/react | |
- name: Build Windows | |
id: build | |
continue-on-error: true | |
timeout-minutes: 45 | |
uses: game-ci/unity-builder@v4 | |
env: | |
UNITY_LICENSE: ${{ secrets.UNITY_LICENSE }} | |
UNITY_EMAIL: ${{ secrets.UNITY_EMAIL }} | |
UNITY_PASSWORD: ${{ secrets.UNITY_PASSWORD }} | |
with: | |
versioning: None | |
targetPlatform: StandaloneWindows64 | |
- name: Sleep for Retry | |
if: ${{ steps.build.outcome == 'failure' }} | |
run: Start-Sleep -s 120 | |
- name: Build Retry | |
id: build-2 | |
timeout-minutes: 45 | |
if: steps.build.outcome == 'failure' | |
uses: game-ci/unity-builder@v4 | |
env: | |
UNITY_LICENSE: ${{ secrets.UNITY_LICENSE }} | |
UNITY_EMAIL: ${{ secrets.UNITY_EMAIL }} | |
UNITY_PASSWORD: ${{ secrets.UNITY_PASSWORD }} | |
with: | |
versioning: None | |
targetPlatform: StandaloneWindows64 | |
- name: Remove DoNotShip Folders | |
run: | | |
Get-ChildItem -Path build/StandaloneWindows64 -Recurse -Directory -Include *DoNotShip, *ButDontShipItWithYourGame | Remove-Item -Recurse -Force | |
- uses: actions/upload-artifact@v4 | |
with: | |
name: Build-Windows-64bit | |
path: build/StandaloneWindows64 | |
retention-days: 14 | |
uploadWebGL: | |
name: Upload WebGL to MinIO | |
needs: buildForWebGL | |
runs-on: ubuntu-latest | |
env: | |
TARGET_DIR: ${{ secrets.MINIO_DEPLOY_PATH }}/master # Default value | |
steps: | |
- uses: actions/download-artifact@v4 | |
with: | |
name: Build-WebGL | |
path: build | |
- name: Set Target Directory (if PR) | |
if: github.event_name == 'pull_request' && github.ref_name != 'master' | |
run: echo "TARGET_DIR=${{ secrets.MINIO_DEPLOY_PATH }}/pr-${{ github.head_ref }}" >> $GITHUB_ENV | |
- name: MinIO Deploy | |
uses: hkdobrev/minio-deploy-action@v1 | |
with: | |
endpoint: ${{ secrets.MINIO_ENDPOINT }} | |
access_key: ${{ secrets.MINIO_ACCESS_KEY }} | |
secret_key: ${{ secrets.MINIO_SECRET_KEY }} | |
bucket: ${{ secrets.MINIO_DEPLOY_BUCKET }} | |
source_dir: build/WebGL | |
target_dir: ${{ env.TARGET_DIR }} |