From ffc777231f34530f82832b4a8a0ae8c060bae600 Mon Sep 17 00:00:00 2001 From: Nasr Date: Wed, 1 Jan 2025 12:45:11 +0700 Subject: [PATCH 01/11] enable linting --- .github/workflows/ci.yml | 60 ++++++++++++++++++++-------------------- 1 file changed, 30 insertions(+), 30 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 0f7313a0..1d8ea51f 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -101,33 +101,33 @@ jobs: - name: Cleanup temporary files run: rm -rf _temp - # lint: - # name: Run Code Linting - # runs-on: ubuntu-latest - # steps: - # - uses: actions/checkout@v3 - - # # Download Unity editor to get the required assemblies - # - name: Request Unity activation file - # id: getManualLicenseFile - # uses: game-ci/unity-request-activation-file@v2 - - # - name: Download Unity - # uses: game-ci/unity-builder@v4 - # env: - # UNITY_LICENSE: ${{ secrets.UNITY_LICENSE }} - # UNITY_EMAIL: ${{ secrets.UNITY_EMAIL }} - # UNITY_PASSWORD: ${{ secrets.UNITY_PASSWORD }} - # with: - # targetPlatform: StandaloneLinux64 - - # - name: Install dotnet tools - # run: | - # dotnet new tool-manifest - # dotnet tool install JetBrains.ReSharper.GlobalTools - - # - name: Run ReSharper CLI inspection - # run: | - # jb inspectcode . --output=inspect-results.xml --severity=WARNING \ - # --include="Assets/**/*.cs" \ - # --exclude="**/Library/**/*.cs;**/Temp/**/*.cs;**/obj/**/*.cs" \ No newline at end of file + lint: + name: Run Code Linting + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + + # Download Unity editor to get the required assemblies + - name: Request Unity activation file + id: getManualLicenseFile + uses: game-ci/unity-request-activation-file@v2 + + - name: Download Unity + uses: game-ci/unity-builder@v4 + env: + UNITY_LICENSE: ${{ secrets.UNITY_LICENSE }} + UNITY_EMAIL: ${{ secrets.UNITY_EMAIL }} + UNITY_PASSWORD: ${{ secrets.UNITY_PASSWORD }} + with: + targetPlatform: StandaloneLinux64 + + - name: Install dotnet tools + run: | + dotnet new tool-manifest + dotnet tool install JetBrains.ReSharper.GlobalTools + + - name: Run ReSharper CLI inspection + run: | + jb inspectcode . --output=inspect-results.xml --severity=WARNING \ + --include="Assets/**/*.cs" \ + --exclude="**/Library/**/*.cs;**/Temp/**/*.cs;**/obj/**/*.cs" \ No newline at end of file From aa2d6acb10b2e86da81d079aabb5d2849c7c3dc6 Mon Sep 17 00:00:00 2001 From: Nasr Date: Wed, 1 Jan 2025 12:50:52 +0700 Subject: [PATCH 02/11] testing --- .github/workflows/ci.yml | 121 +++++++++++++++------------------------ 1 file changed, 45 insertions(+), 76 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 1d8ea51f..d2fe2980 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -7,55 +7,55 @@ on: branches: [ main ] jobs: -# test: -# name: Run Tests -# runs-on: ubuntu-latest -# steps: -# - uses: actions/checkout@v3 - -# # Git LFS -# - name: Create LFS file list -# run: git lfs ls-files -l | cut -d' ' -f1 | sort > .lfs-assets-id + test: + name: Run Tests + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 -# - name: Restore LFS cache -# uses: actions/cache@v3 -# id: lfs-cache -# with: -# path: .git/lfs -# key: ${{ runner.os }}-lfs-${{ hashFiles('.lfs-assets-id') }} + # Git LFS + - name: Create LFS file list + run: git lfs ls-files -l | cut -d' ' -f1 | sort > .lfs-assets-id -# - name: Git LFS Pull -# run: | -# git lfs pull -# git add . -# git reset --hard + - name: Restore LFS cache + uses: actions/cache@v3 + id: lfs-cache + with: + path: .git/lfs + key: ${{ runner.os }}-lfs-${{ hashFiles('.lfs-assets-id') }} -# # Cache -# - uses: actions/cache@v3 -# with: -# path: Library -# key: Library-${{ hashFiles('Assets/**', 'Packages/**', 'ProjectSettings/**') }} -# restore-keys: | -# Library- + - name: Git LFS Pull + run: | + git lfs pull + git add . + git reset --hard -# - name: Run Unity 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: -# projectPath: . -# testMode: all -# artifactsPath: TestResults -# githubToken: ${{ secrets.GITHUB_TOKEN }} + # Cache + - uses: actions/cache@v3 + with: + path: Library + key: Library-${{ hashFiles('Assets/**', 'Packages/**', 'ProjectSettings/**') }} + restore-keys: | + Library- -# - name: Upload Test Results -# uses: actions/upload-artifact@v3 -# if: always() -# with: -# name: Test Results -# path: TestResults + - name: Run Unity 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: + projectPath: . + testMode: all + artifactsPath: TestResults + githubToken: ${{ secrets.GITHUB_TOKEN }} + + - name: Upload Test Results + uses: actions/upload-artifact@v3 + if: always() + with: + name: Test Results + path: TestResults format: name: Check Code Format @@ -99,35 +99,4 @@ jobs: # Cleanup - name: Cleanup temporary files - run: rm -rf _temp - - lint: - name: Run Code Linting - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v3 - - # Download Unity editor to get the required assemblies - - name: Request Unity activation file - id: getManualLicenseFile - uses: game-ci/unity-request-activation-file@v2 - - - name: Download Unity - uses: game-ci/unity-builder@v4 - env: - UNITY_LICENSE: ${{ secrets.UNITY_LICENSE }} - UNITY_EMAIL: ${{ secrets.UNITY_EMAIL }} - UNITY_PASSWORD: ${{ secrets.UNITY_PASSWORD }} - with: - targetPlatform: StandaloneLinux64 - - - name: Install dotnet tools - run: | - dotnet new tool-manifest - dotnet tool install JetBrains.ReSharper.GlobalTools - - - name: Run ReSharper CLI inspection - run: | - jb inspectcode . --output=inspect-results.xml --severity=WARNING \ - --include="Assets/**/*.cs" \ - --exclude="**/Library/**/*.cs;**/Temp/**/*.cs;**/obj/**/*.cs" \ No newline at end of file + run: rm -rf _temp \ No newline at end of file From 1d1703bac20c162e4ff1149404305b1df37fd110 Mon Sep 17 00:00:00 2001 From: Nasr Date: Wed, 1 Jan 2025 14:57:18 +0700 Subject: [PATCH 03/11] try fix lint --- .github/workflows/ci.yml | 116 ++++++++++++++++++++++++--------------- 1 file changed, 71 insertions(+), 45 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index d2fe2980..db62082e 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -7,55 +7,55 @@ on: branches: [ main ] jobs: - test: - name: Run Tests - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v3 +# test: +# name: Run Tests +# runs-on: ubuntu-latest +# steps: +# - uses: actions/checkout@v3 - # Git LFS - - name: Create LFS file list - run: git lfs ls-files -l | cut -d' ' -f1 | sort > .lfs-assets-id +# # 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@v3 - id: lfs-cache - with: - path: .git/lfs - key: ${{ runner.os }}-lfs-${{ hashFiles('.lfs-assets-id') }} +# - name: Restore LFS cache +# uses: actions/cache@v3 +# id: lfs-cache +# with: +# path: .git/lfs +# key: ${{ runner.os }}-lfs-${{ hashFiles('.lfs-assets-id') }} - - name: Git LFS Pull - run: | - git lfs pull - git add . - git reset --hard +# - name: Git LFS Pull +# run: | +# git lfs pull +# git add . +# git reset --hard - # Cache - - uses: actions/cache@v3 - with: - path: Library - key: Library-${{ hashFiles('Assets/**', 'Packages/**', 'ProjectSettings/**') }} - restore-keys: | - Library- +# # Cache +# - uses: actions/cache@v3 +# with: +# path: Library +# key: Library-${{ hashFiles('Assets/**', 'Packages/**', 'ProjectSettings/**') }} +# restore-keys: | +# Library- - - name: Run Unity 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: - projectPath: . - testMode: all - artifactsPath: TestResults - githubToken: ${{ secrets.GITHUB_TOKEN }} - - - name: Upload Test Results - uses: actions/upload-artifact@v3 - if: always() - with: - name: Test Results - path: TestResults +# - name: Run Unity 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: +# projectPath: . +# testMode: all +# artifactsPath: TestResults +# githubToken: ${{ secrets.GITHUB_TOKEN }} + +# - name: Upload Test Results +# uses: actions/upload-artifact@v3 +# if: always() +# with: +# name: Test Results +# path: TestResults format: name: Check Code Format @@ -99,4 +99,30 @@ jobs: # Cleanup - name: Cleanup temporary files - run: rm -rf _temp \ No newline at end of file + run: rm -rf _temp + + lint: + name: Run Code Linting + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + + - name: Download Unity + uses: game-ci/unity-builder@v4 + env: + UNITY_LICENSE: ${{ secrets.UNITY_LICENSE }} + UNITY_EMAIL: ${{ secrets.UNITY_EMAIL }} + UNITY_PASSWORD: ${{ secrets.UNITY_PASSWORD }} + with: + targetPlatform: StandaloneLinux64 + + - name: Install dotnet tools + run: | + dotnet new tool-manifest + dotnet tool install JetBrains.ReSharper.GlobalTools + + - name: Run ReSharper CLI inspection + run: | + jb inspectcode . --output=inspect-results.xml --severity=WARNING \ + --include="Assets/**/*.cs" \ + --exclude="**/Library/**/*.cs;**/Temp/**/*.cs;**/obj/**/*.cs" \ No newline at end of file From 28e02a5f3331bfe011a0ef273ba9130d09bc2424 Mon Sep 17 00:00:00 2001 From: Nasr Date: Wed, 1 Jan 2025 15:05:59 +0700 Subject: [PATCH 04/11] try lint directly --- .github/workflows/ci.yml | 9 --------- 1 file changed, 9 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index db62082e..931bcfa3 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -107,15 +107,6 @@ jobs: steps: - uses: actions/checkout@v3 - - name: Download Unity - uses: game-ci/unity-builder@v4 - env: - UNITY_LICENSE: ${{ secrets.UNITY_LICENSE }} - UNITY_EMAIL: ${{ secrets.UNITY_EMAIL }} - UNITY_PASSWORD: ${{ secrets.UNITY_PASSWORD }} - with: - targetPlatform: StandaloneLinux64 - - name: Install dotnet tools run: | dotnet new tool-manifest From 5389534ddcada0e477b5fd1094b72d9e242f6c22 Mon Sep 17 00:00:00 2001 From: Nasr Date: Wed, 1 Jan 2025 15:10:30 +0700 Subject: [PATCH 05/11] fix path --- .github/workflows/ci.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 931bcfa3..222ee566 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -114,6 +114,7 @@ jobs: - name: Run ReSharper CLI inspection run: | + export PATH="$PATH:$HOME/.dotnet/tools" jb inspectcode . --output=inspect-results.xml --severity=WARNING \ --include="Assets/**/*.cs" \ --exclude="**/Library/**/*.cs;**/Temp/**/*.cs;**/obj/**/*.cs" \ No newline at end of file From 4fa43030e9a82b8a4455c23e6cc45d5099732618 Mon Sep 17 00:00:00 2001 From: Nasr Date: Wed, 1 Jan 2025 15:11:47 +0700 Subject: [PATCH 06/11] c --- .github/workflows/ci.yml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 222ee566..3abd0e34 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -114,7 +114,6 @@ jobs: - name: Run ReSharper CLI inspection run: | - export PATH="$PATH:$HOME/.dotnet/tools" - jb inspectcode . --output=inspect-results.xml --severity=WARNING \ + dotnet jb inspectcode . --output=inspect-results.xml --severity=WARNING \ --include="Assets/**/*.cs" \ --exclude="**/Library/**/*.cs;**/Temp/**/*.cs;**/obj/**/*.cs" \ No newline at end of file From cd13394d3065a05f2bb6d9ff6fe856e0c45a2f6b Mon Sep 17 00:00:00 2001 From: Nasr Date: Wed, 1 Jan 2025 15:13:06 +0700 Subject: [PATCH 07/11] f --- .github/workflows/ci.yml | 26 +++++++++++++++++++++++--- 1 file changed, 23 insertions(+), 3 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 3abd0e34..33bd9a5c 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -112,8 +112,28 @@ jobs: dotnet new tool-manifest dotnet tool install JetBrains.ReSharper.GlobalTools + # Create a temporary solution and add all .cs files + - name: Create temporary solution + run: | + # Create a temporary directory for the solution + mkdir -p _temp + cd _temp + + # Create a new solution + dotnet new sln -n TempSolution + + # Create a temporary project and add all .cs files + dotnet new classlib -n TempProject + rm ./TempProject/Class1.cs + + # Copy all .cs files from Assets to the temp project + find ../Assets -name "*.cs" -exec cp {} ./TempProject/ \; + + # Add project to solution + dotnet sln add ./TempProject/TempProject.csproj + + cd .. + - name: Run ReSharper CLI inspection run: | - dotnet jb inspectcode . --output=inspect-results.xml --severity=WARNING \ - --include="Assets/**/*.cs" \ - --exclude="**/Library/**/*.cs;**/Temp/**/*.cs;**/obj/**/*.cs" \ No newline at end of file + dotnet jb inspectcode ./_temp/TempSolution.sln --output=inspect-results.xml --severity=WARNING \ No newline at end of file From 7d5de70d926d542a9be9ec8f7549ad71822bb66b Mon Sep 17 00:00:00 2001 From: Nasr Date: Wed, 1 Jan 2025 15:19:35 +0700 Subject: [PATCH 08/11] try build --- .github/workflows/ci.yml | 76 +++++++++++++++++++++++++--------------- 1 file changed, 47 insertions(+), 29 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 33bd9a5c..9a1dd699 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -101,39 +101,57 @@ jobs: - name: Cleanup temporary files run: rm -rf _temp - lint: - name: Run Code Linting + build: + name: Build Package runs-on: ubuntu-latest steps: - uses: actions/checkout@v3 + with: + lfs: true - - name: Install dotnet tools - run: | - dotnet new tool-manifest - dotnet tool install JetBrains.ReSharper.GlobalTools + # Git LFS + - name: Create LFS file list + run: git lfs ls-files -l | cut -d' ' -f1 | sort > .lfs-assets-id - # Create a temporary solution and add all .cs files - - name: Create temporary solution - run: | - # Create a temporary directory for the solution - mkdir -p _temp - cd _temp - - # Create a new solution - dotnet new sln -n TempSolution - - # Create a temporary project and add all .cs files - dotnet new classlib -n TempProject - rm ./TempProject/Class1.cs - - # Copy all .cs files from Assets to the temp project - find ../Assets -name "*.cs" -exec cp {} ./TempProject/ \; - - # Add project to solution - dotnet sln add ./TempProject/TempProject.csproj - - cd .. + - name: Restore LFS cache + uses: actions/cache@v3 + id: lfs-cache + with: + path: .git/lfs + key: ${{ runner.os }}-lfs-${{ hashFiles('.lfs-assets-id') }} - - name: Run ReSharper CLI inspection + - name: Git LFS Pull run: | - dotnet jb inspectcode ./_temp/TempSolution.sln --output=inspect-results.xml --severity=WARNING \ No newline at end of file + git lfs pull + git add . + git reset --hard + + # Unity Cache + - uses: actions/cache@v3 + with: + path: Library + key: Library-Build-${{ hashFiles('Assets/**', 'Packages/**', 'ProjectSettings/**') }} + restore-keys: | + Library-Build- + + # Build + - name: Build Unity Package + uses: game-ci/unity-builder@v4 + env: + UNITY_LICENSE: ${{ secrets.UNITY_LICENSE }} + UNITY_EMAIL: ${{ secrets.UNITY_EMAIL }} + UNITY_PASSWORD: ${{ secrets.UNITY_PASSWORD }} + with: + targetPlatform: StandaloneLinux64 + buildMethod: Editor.Builder.BuildPackage + + # Upload package to release + - name: Upload Release Asset + uses: actions/upload-release-asset@v1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + upload_url: ${{ github.event.release.upload_url }} + asset_path: ./Build/dojo.unitypackage + asset_name: dojo.unitypackage + asset_content_type: application/octet-stream \ No newline at end of file From 0771a8b4b0b892c2f75aa6836d5d496466400eee Mon Sep 17 00:00:00 2001 From: Nasr Date: Wed, 1 Jan 2025 15:26:34 +0700 Subject: [PATCH 09/11] d --- Assets/Editor/Builder.cs | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 Assets/Editor/Builder.cs diff --git a/Assets/Editor/Builder.cs b/Assets/Editor/Builder.cs new file mode 100644 index 00000000..30d297ff --- /dev/null +++ b/Assets/Editor/Builder.cs @@ -0,0 +1,25 @@ +using UnityEditor; + +namespace Editor +{ + public static class Builder + { + public static void BuildPackage() + { + // Define which assets to include in the package + string[] assets = new string[] + { + "Assets", + "Packages/manifest.json", + "Packages/packages-lock.json" + }; + + // Build the package + AssetDatabase.ExportPackage( + assets, + "Build/dojo.unitypackage", + ExportPackageOptions.Recurse | ExportPackageOptions.IncludeDependencies + ); + } + } +} \ No newline at end of file From a9903c49082677ff5a9f279a3d5ec319fc19b120 Mon Sep 17 00:00:00 2001 From: Nasr Date: Wed, 1 Jan 2025 15:32:51 +0700 Subject: [PATCH 10/11] test build check --- .github/workflows/ci.yml | 13 +------------ Assets/Editor/Builder.cs | 6 +++--- 2 files changed, 4 insertions(+), 15 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 9a1dd699..2a667869 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -143,15 +143,4 @@ jobs: UNITY_PASSWORD: ${{ secrets.UNITY_PASSWORD }} with: targetPlatform: StandaloneLinux64 - buildMethod: Editor.Builder.BuildPackage - - # Upload package to release - - name: Upload Release Asset - uses: actions/upload-release-asset@v1 - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - with: - upload_url: ${{ github.event.release.upload_url }} - asset_path: ./Build/dojo.unitypackage - asset_name: dojo.unitypackage - asset_content_type: application/octet-stream \ No newline at end of file + buildMethod: Editor.Builder.BuildPackage \ No newline at end of file diff --git a/Assets/Editor/Builder.cs b/Assets/Editor/Builder.cs index 30d297ff..9976e164 100644 --- a/Assets/Editor/Builder.cs +++ b/Assets/Editor/Builder.cs @@ -7,12 +7,12 @@ public static class Builder public static void BuildPackage() { // Define which assets to include in the package - string[] assets = new string[] + string[] assets = new string[] { "Assets", "Packages/manifest.json", "Packages/packages-lock.json" - }; + };das // Build the package AssetDatabase.ExportPackage( @@ -22,4 +22,4 @@ public static void BuildPackage() ); } } -} \ No newline at end of file +} \ No newline at end of file From b90d8b253c3584ca32239a951d479c41f57240b2 Mon Sep 17 00:00:00 2001 From: Nasr Date: Wed, 1 Jan 2025 15:40:43 +0700 Subject: [PATCH 11/11] build works --- Assets/Editor/Builder.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Assets/Editor/Builder.cs b/Assets/Editor/Builder.cs index 9976e164..c992f3f6 100644 --- a/Assets/Editor/Builder.cs +++ b/Assets/Editor/Builder.cs @@ -12,7 +12,7 @@ public static void BuildPackage() "Assets", "Packages/manifest.json", "Packages/packages-lock.json" - };das + }; // Build the package AssetDatabase.ExportPackage(