Bump Microsoft.CodeAnalysis.CSharp and Microsoft.CodeAnalysis.CSharp.… #229
This file contains hidden or 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: BitMono.Build | |
| on: | |
| create: | |
| tags: | |
| - "*" | |
| push: | |
| branches: [ main ] | |
| paths: | |
| - '.github/workflows/BitMono.Build.yaml' | |
| - '.github/actions/project-build/**' | |
| - 'props/SharedPackages.props' | |
| - 'props/SharedProjectProps.props' | |
| - 'props/SharedTestProps.props' | |
| - 'src/**' | |
| - 'test/**' | |
| pull_request: | |
| paths: | |
| - '.github/workflows/BitMono.Build.yaml' | |
| - '.github/actions/project-build/**' | |
| - 'props/SharedPackages.props' | |
| - 'props/SharedProjectProps.props' | |
| - 'props/SharedTestProps.props' | |
| - 'src/**' | |
| - 'test/**' | |
| permissions: | |
| contents: read | |
| jobs: | |
| Build: | |
| runs-on: ubuntu-latest | |
| strategy: | |
| matrix: | |
| target-framework: [net10.0, net9.0, net8.0, net7.0, net6.0, net462, netstandard2.1, netstandard2.0] | |
| runtime: [linux-x64, win-x64, linux-arm64, win-arm64, osx-x64, osx-arm64, win-x86] | |
| exclude: | |
| # Exclude win-x86 builds for .NET Standard as they're architecture-independent | |
| - runtime: win-x86 | |
| target-framework: netstandard2.0 | |
| - runtime: win-x86 | |
| target-framework: netstandard2.1 | |
| outputs: | |
| version: ${{ steps.project-build.outputs.version }} | |
| is_prerelease: ${{ steps.project-build.outputs.is_prerelease }} | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v7 | |
| with: | |
| fetch-depth: 0 | |
| - name: Setup .NET | |
| uses: actions/setup-dotnet@v6 | |
| env: | |
| DOTNET_NOLOGO: true | |
| DOTNET_SKIP_FIRST_TIME_EXPERIENCE: true | |
| DOTNET_CLI_TELEMETRY_OPTOUT: true | |
| with: | |
| dotnet-version: 10.x | |
| - name: Build Project | |
| uses: ./.github/actions/project-build | |
| id: project-build | |
| with: | |
| project_path: src/BitMono.CLI/BitMono.CLI.csproj | |
| nuget_push: false | |
| target_framework: ${{ matrix.target-framework }} | |
| runtime_version: ${{ matrix.runtime }} | |
| github_token: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Install zip (for Linux/macOS) | |
| run: | | |
| if [[ "${{ matrix.runtime }}" =~ ^linux ]]; then | |
| sudo apt-get install -y zip | |
| elif [[ "${{ matrix.runtime }}" =~ ^osx ]]; then | |
| if ! command -v zip &> /dev/null; then | |
| echo "zip is not available on this macOS runner, and it should be pre-installed." | |
| exit 1 | |
| fi | |
| fi | |
| - name: Zip artifacts | |
| run: | | |
| cd ./src/BitMono.CLI/bin/Release/${{ matrix.target-framework }}/${{ matrix.runtime }} && \ | |
| zip -qq -r ./BitMono-v${{ steps.project-build.outputs.version }}-CLI-${{ matrix.target-framework }}-${{ matrix.runtime }}.zip * | |
| - name: Upload build | |
| uses: actions/upload-artifact@v7 | |
| with: | |
| name: BitMono-v${{ steps.project-build.outputs.version }}-CLI-${{ matrix.target-framework }}-${{ matrix.runtime }} | |
| path: "./src/BitMono.CLI/bin/Release/${{ matrix.target-framework }}/${{ matrix.runtime }}/BitMono-v${{ steps.project-build.outputs.version }}-CLI-${{ matrix.target-framework }}-${{ matrix.runtime }}.zip" | |
| if-no-files-found: error | |
| Test: | |
| name: Test | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v7 | |
| with: | |
| fetch-depth: 0 | |
| - name: Setup .NET | |
| uses: actions/setup-dotnet@v6 | |
| env: | |
| DOTNET_NOLOGO: true | |
| DOTNET_SKIP_FIRST_TIME_EXPERIENCE: true | |
| DOTNET_CLI_TELEMETRY_OPTOUT: true | |
| with: | |
| dotnet-version: 10.x | |
| # Test projects are net10.0-only (props/SharedTestProps.props), so they run once here rather than | |
| # riding the per-TFM/per-RID build matrix above (where forcing -p:TargetFramework=net462 etc. can't work). | |
| - name: Test | |
| run: | | |
| set -e | |
| for proj in test/BitMono.*.Tests/BitMono.*.Tests.csproj; do | |
| echo "::group::$proj" | |
| dotnet test "$proj" -c Release | |
| echo "::endgroup::" | |
| done | |
| shell: bash | |
| UnityPackage: | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 30 # old Linux editors can hang on the Bee script-compile; fail fast, don't sit 60min | |
| if: (github.event_name == 'push' && github.ref == 'refs/heads/main') || (github.event_name == 'create' && github.event.ref_type == 'tag') | |
| strategy: | |
| fail-fast: false # one Unity version failing must NOT cancel the others (was the cascade red) | |
| max-parallel: 2 # throttle Unity license activation — avoid concurrent-activation flakiness (game-ci #597) | |
| matrix: | |
| # One CI job per Unity LTS line; each produces a per-version download artifact. | |
| # Version needs a published unityci/editor image (GameCI auto-publishes within hours of a Unity release). | |
| unity-version: [ | |
| 2019.4.40f1, # Unity 2019 LTS | |
| 2020.3.48f1, # Unity 2020 LTS | |
| 2021.3.45f1, # Unity 2021 LTS | |
| 2022.3.29f1, # Unity 2022 LTS | |
| 6000.0.2f1, # Unity 6.0 LTS | |
| 6000.3.19f1 # Unity 6.3 LTS | |
| ] | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v7 | |
| with: | |
| fetch-depth: 0 | |
| - name: Cache Unity Library | |
| uses: actions/cache@v6 | |
| with: | |
| path: test/BitMono.Unity.TestProject/Library | |
| key: Library-BitMono-Unity-${{ matrix.unity-version }} | |
| restore-keys: | | |
| Library-BitMono-Unity- | |
| Library- | |
| - name: Setup .NET | |
| uses: actions/setup-dotnet@v6 | |
| env: | |
| DOTNET_NOLOGO: true | |
| DOTNET_SKIP_FIRST_TIME_EXPERIENCE: true | |
| DOTNET_CLI_TELEMETRY_OPTOUT: true | |
| with: | |
| dotnet-version: 10.x | |
| - name: Build BitMono.CLI for Unity Package | |
| uses: ./.github/actions/project-build | |
| id: cli-build | |
| with: | |
| project_path: src/BitMono.CLI/BitMono.CLI.csproj | |
| nuget_push: false | |
| target_framework: net462 | |
| runtime_version: win-x64 | |
| github_token: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Copy Unity files to test project | |
| run: | | |
| mkdir -p test/BitMono.Unity.TestProject/Assets/BitMono.Unity | |
| cp -R src/BitMono.Unity/* test/BitMono.Unity.TestProject/Assets/BitMono.Unity/ | |
| # BitMono.CLI ships as ONE self-contained net462 exe: Costura embeds every dependency, including the | |
| # BitMono.* assemblies, so there are no loose DLLs to drop on export (AssetDatabase.ExportPackage | |
| # silently drops assets whose .meta has an invalid GUID) and none to wedge IL2CPP. The .exe imports | |
| # as an inert DefaultAsset, so the old per-DLL PluginImporter/meta hack is gone (#302). | |
| mkdir -p test/BitMono.Unity.TestProject/Assets/BitMono.Unity/BitMono.CLI | |
| CLI_OUT="src/BitMono.CLI/bin/Release/net462/win-x64" | |
| CLI_DST="test/BitMono.Unity.TestProject/Assets/BitMono.Unity/BitMono.CLI" | |
| cp "$CLI_OUT/BitMono.CLI.exe" "$CLI_DST/" | |
| cp "$CLI_OUT/BitMono.CLI.exe.config" "$CLI_DST/" 2>/dev/null || true | |
| cp "$CLI_OUT"/*.json "$CLI_DST/" 2>/dev/null || true | |
| - name: Setup Unity for Package Export | |
| uses: game-ci/unity-builder@v5 | |
| env: | |
| PACKAGE_VERSION: ${{ steps.cli-build.outputs.version }} | |
| VERSION: ${{ steps.cli-build.outputs.version }} | |
| UNITY_VERSION: ${{ matrix.unity-version }} | |
| UNITY_LICENSE: ${{ secrets.UNITY_LICENSE }} | |
| UNITY_EMAIL: ${{ secrets.UNITY_EMAIL }} | |
| UNITY_PASSWORD: ${{ secrets.UNITY_PASSWORD }} | |
| with: | |
| unityVersion: ${{ matrix.unity-version }} | |
| targetPlatform: StandaloneLinux64 | |
| buildMethod: BitMono.Editor.PackageExporter.ExportPackage | |
| projectPath: test/BitMono.Unity.TestProject | |
| buildName: BitMono-Unity-Package | |
| allowDirtyBuild: true | |
| - name: Verify .unitypackage was created | |
| run: | | |
| set -e | |
| VERSION_NO_HASH='${{ steps.cli-build.outputs.version }}' | |
| # Strip any SemVer build metadata (e.g., +<commit-hash>) for filenames | |
| VERSION_NO_HASH="${VERSION_NO_HASH%%+*}" | |
| UNITY_VER='${{ matrix.unity-version }}' | |
| FILE="BitMono-Unity-v${VERSION_NO_HASH}-Unity${UNITY_VER}.unitypackage" | |
| if [ ! -f "$FILE" ]; then | |
| echo "Unity package not found at expected path: ./$FILE" >&2 | |
| echo "Available unitypackages:" >&2 | |
| find . -name "*.unitypackage" -print | |
| exit 1 | |
| fi | |
| echo "Unity package created: $FILE" | |
| size_bytes=$(stat -c%s -- "$FILE") | |
| size_mb=$(awk -v s="$size_bytes" 'BEGIN {printf "%.2f", s/1024/1024}') | |
| echo "File size: ${size_mb} MB" | |
| - name: Rename .unitypackage to include build metadata (if present) | |
| run: | | |
| VERSION_FULL='${{ steps.cli-build.outputs.version }}' | |
| UNITY_VER='${{ matrix.unity-version }}' | |
| BASE="BitMono-Unity-v${VERSION_FULL%%+*}-Unity${UNITY_VER}.unitypackage" | |
| if [[ "$VERSION_FULL" == *+* ]]; then | |
| TARGET="BitMono-Unity-v${VERSION_FULL}-Unity${UNITY_VER}.unitypackage" | |
| if [ -f "$BASE" ]; then | |
| echo "Renaming $BASE -> $TARGET" | |
| mv -f "$BASE" "$TARGET" | |
| else | |
| echo "Expected base package not found for rename: $BASE" >&2 | |
| fi | |
| else | |
| echo "No build metadata in version; keeping filename: $BASE" | |
| fi | |
| - name: Create Unity Package Directory | |
| run: | | |
| mkdir -p unity-package-temp/Editor | |
| - name: Copy Unity Package Files | |
| run: | | |
| cp src/BitMono.Unity/Editor/*.cs unity-package-temp/Editor/ | |
| cp src/BitMono.Unity/Editor/*.asmdef unity-package-temp/Editor/ || echo "No .asmdef files found" | |
| cp src/BitMono.Unity/package.json unity-package-temp/ | |
| # Ensure BitMonoConfig.asset is included in package content | |
| if [ -f src/BitMono.Unity/BitMonoConfig.asset ]; then | |
| cp src/BitMono.Unity/BitMonoConfig.asset unity-package-temp/ | |
| else | |
| echo "BitMonoConfig.asset not found in src/BitMono.Unity" >&2 | |
| fi | |
| # Single self-contained net462 exe - see the export step above (#302). | |
| mkdir -p unity-package-temp/BitMono.CLI | |
| cp src/BitMono.CLI/bin/Release/net462/win-x64/BitMono.CLI.exe unity-package-temp/BitMono.CLI/ | |
| cp src/BitMono.CLI/bin/Release/net462/win-x64/BitMono.CLI.exe.config unity-package-temp/BitMono.CLI/ 2>/dev/null || true | |
| cp src/BitMono.CLI/bin/Release/net462/win-x64/*.json unity-package-temp/BitMono.CLI/ 2>/dev/null || true | |
| - name: Update Package Version and Unity Version | |
| run: | | |
| sudo apt-get update && sudo apt-get install -y jq | |
| unityVersion='${{ matrix.unity-version }}' | |
| unityShort=$(echo "$unityVersion" | sed -E 's/^(\d+\.\d+)\..*/\1/') | |
| tmp=$(mktemp) | |
| jq \ | |
| --arg ver '${{ steps.cli-build.outputs.version }}' \ | |
| --arg unity "$unityShort" \ | |
| '.version=$ver | .unity=$unity' \ | |
| unity-package-temp/package.json > "$tmp" && mv "$tmp" unity-package-temp/package.json | |
| echo "Updated package.json:" | |
| echo " Version: ${{ steps.cli-build.outputs.version }}" | |
| echo " Unity: $unityShort" | |
| - name: Test Unity Package Compatibility | |
| run: | | |
| echo "Testing Unity version compatibility..." | |
| pkgUnity=$(jq -r '.unity' unity-package-temp/package.json) | |
| pkgUnityRelease=$(jq -r '.unityRelease // ""' unity-package-temp/package.json) | |
| echo "Package Unity version: $pkgUnity" | |
| echo "Package Unity release: $pkgUnityRelease" | |
| echo "Target Unity version: ${{ matrix.unity-version }}" | |
| - name: Create UPM Package (Modern Unity Package Manager) | |
| run: | | |
| # Create a proper UPM package structure (POSIX for Ubuntu runners) | |
| mkdir -p upm-package/Editor | |
| # Copy files to UPM structure | |
| cp unity-package-temp/Editor/*.cs upm-package/Editor/ 2>/dev/null || true | |
| cp unity-package-temp/Editor/*.asmdef upm-package/Editor/ 2>/dev/null || echo "No .asmdef files found" | |
| cp unity-package-temp/package.json upm-package/ | |
| # Prefer copying BitMonoConfig.asset from source; fallback to temp if needed | |
| if [ -f src/BitMono.Unity/BitMonoConfig.asset ]; then | |
| cp src/BitMono.Unity/BitMonoConfig.asset upm-package/ | |
| else | |
| cp unity-package-temp/BitMonoConfig.asset upm-package/ 2>/dev/null || echo "No BitMonoConfig.asset found" | |
| fi | |
| mkdir -p upm-package/BitMono.CLI | |
| cp -R unity-package-temp/BitMono.CLI/* upm-package/BitMono.CLI/ 2>/dev/null || true | |
| # Create UPM tarball using tar (better compatibility than .zip) | |
| cd upm-package | |
| tar -czf ../BitMono-Unity-UPM-v${{ steps.cli-build.outputs.version }}-Unity${{ matrix.unity-version }}.tgz * | |
| cd .. | |
| - name: Upload Unity Packages | |
| uses: actions/upload-artifact@v7 | |
| with: | |
| name: BitMono-Unity-v${{ steps.cli-build.outputs.version }}-Unity${{ matrix.unity-version }} | |
| path: | | |
| BitMono-Unity-v*-Unity${{ matrix.unity-version }}.unitypackage | |
| BitMono-Unity-UPM-v*-Unity${{ matrix.unity-version }}.tgz | |
| if-no-files-found: error | |
| Release: | |
| if: github.event_name == 'create' && github.event.ref_type == 'tag' | |
| needs: [Build, Test, UnityPackage] | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: write # create/update the GitHub release | |
| steps: | |
| - name: Download all artifacts | |
| uses: actions/download-artifact@v8 | |
| with: | |
| path: ./artifacts | |
| - name: List downloaded artifacts | |
| run: | | |
| echo "Downloaded artifacts:" | |
| find ./artifacts -type f -name "*.zip" -o -name "*.unitypackage" | |
| echo "" | |
| echo "Unity packages by version:" | |
| find ./artifacts -name "*Unity*.unitypackage" | sort | |
| - name: Create Release | |
| uses: ncipollo/release-action@v1 | |
| with: | |
| name: BitMono Release v${{ needs.Build.outputs.version }} | |
| tag: ${{ needs.Build.outputs.version }} | |
| artifacts: "./artifacts/**/*.zip,./artifacts/**/*.unitypackage,./artifacts/**/*.tgz" | |
| token: ${{ secrets.GITHUB_TOKEN }} | |
| prerelease: ${{ needs.Build.outputs.is_prerelease }} | |
| allowUpdates: true | |
| draft: true | |