Update Git submodules #134
Workflow file for this run
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: Build | |
| permissions: | |
| pull-requests: write | |
| contents: write | |
| on: | |
| push: | |
| branches: [ "main" ] | |
| pull_request: | |
| branches: [ "main" ] | |
| workflow_dispatch: | |
| jobs: | |
| build_native: | |
| name: Build - ${{ matrix.config.os }} ${{ matrix.config.arch }} | |
| runs-on: ${{ matrix.config.runner }} | |
| strategy: | |
| matrix: | |
| config: | |
| - { name: win_x64, runner: windows-latest, os: Windows, arch: x64 } | |
| - { name: win_arm64, runner: windows-latest, os: Windows, arch: arm64 } | |
| - { name: linux_x64, runner: ubuntu-22.04, os: Linux, arch: x64 } | |
| - { name: linux_arm64, runner: ubuntu-22.04-arm, os: Linux, arch: arm64 } | |
| - { name: mac_x64, runner: macos-14, os: MacOS, arch: x64 } | |
| - { name: mac_arm64, runner: macos-14, os: MacOS, arch: arm64 } | |
| steps: | |
| - name: Checkout repository (with submodules) | |
| uses: actions/checkout@v7 | |
| with: | |
| submodules: recursive | |
| token: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Install MSVC ARM64 Tools (Windows ARM64) | |
| if: matrix.config.os == 'Windows' && matrix.config.arch == 'arm64' | |
| uses: ilammy/msvc-dev-cmd@v1 | |
| with: | |
| arch: arm64 | |
| - name: Update Submodules | |
| run: git submodule update --init --recursive | |
| - name: Build (Windows x64) | |
| if: matrix.config.os == 'Windows' && matrix.config.arch == 'x64' | |
| working-directory: ./NativeCode | |
| run: | | |
| mkdir build | |
| cd build | |
| cmake .. -DCMAKE_BUILD_TYPE=Release | |
| cmake --build . --config Release | |
| - name: Build (Windows ARM64) | |
| if: matrix.config.os == 'Windows' && matrix.config.arch == 'arm64' | |
| working-directory: ./NativeCode | |
| run: | | |
| mkdir build | |
| cd build | |
| cmake .. -DCMAKE_BUILD_TYPE=Release -A ARM64 | |
| cmake --build . --config Release | |
| - name: Build (Linux) | |
| if: matrix.config.os == 'Linux' | |
| working-directory: ./NativeCode | |
| run: | | |
| mkdir build | |
| cd build | |
| cmake .. -DCMAKE_BUILD_TYPE=Release | |
| cmake --build . --config Release | |
| - name: Build (macOS x64) | |
| if: matrix.config.os == 'MacOS' && matrix.config.arch == 'x64' | |
| working-directory: ./NativeCode | |
| run: | | |
| mkdir build | |
| cd build | |
| cmake .. \ | |
| -DCMAKE_BUILD_TYPE=Release \ | |
| -DCMAKE_OSX_ARCHITECTURES=x86_64 | |
| cmake --build . --config Release | |
| - name: Build (macOS ARM64) | |
| if: matrix.config.os == 'MacOS' && matrix.config.arch == 'arm64' | |
| working-directory: ./NativeCode | |
| run: | | |
| mkdir build | |
| cd build | |
| cmake .. \ | |
| -DCMAKE_BUILD_TYPE=Release \ | |
| -DCMAKE_OSX_ARCHITECTURES=arm64 | |
| cmake --build . --config Release | |
| - name: List Files | |
| working-directory: ./NativeCode | |
| run: ls -R build | |
| - name: Upload (Windows) | |
| if: matrix.config.os == 'Windows' | |
| uses: actions/upload-artifact@v7 | |
| with: | |
| name: native_${{ matrix.config.name }} | |
| path: NativeCode/build/Release/dxil-spirv-c-shared.dll | |
| if-no-files-found: error | |
| - name: Upload (Linux) | |
| if: matrix.config.os == 'Linux' | |
| uses: actions/upload-artifact@v7 | |
| with: | |
| name: native_${{ matrix.config.name }} | |
| path: NativeCode/build/libdxil-spirv-c-shared.so | |
| if-no-files-found: error | |
| - name: Upload (MacOS) | |
| if: matrix.config.os == 'MacOS' | |
| uses: actions/upload-artifact@v7 | |
| with: | |
| name: native_${{ matrix.config.name }} | |
| path: NativeCode/build/libdxil-spirv-c-shared.dylib | |
| if-no-files-found: error | |
| build_managed: | |
| name: Build - Managed | |
| runs-on: ubuntu-latest | |
| needs: build_native | |
| steps: | |
| - uses: actions/checkout@v7 | |
| - name: Setup .NET | |
| uses: actions/setup-dotnet@v5 | |
| with: | |
| dotnet-version: 10.0.x | |
| - name: Download Native - Windows Arm64 | |
| uses: actions/download-artifact@v8 | |
| with: | |
| name: native_win_arm64 | |
| path: ./AssetRipper.Bindings.DxilSpirV/NativeLibraries/win-arm64/native/ | |
| - name: Download Native - Windows x64 | |
| uses: actions/download-artifact@v8 | |
| with: | |
| name: native_win_x64 | |
| path: ./AssetRipper.Bindings.DxilSpirV/NativeLibraries/win-x64/native/ | |
| - name: Download Native - Linux Arm64 | |
| uses: actions/download-artifact@v8 | |
| with: | |
| name: native_linux_arm64 | |
| path: ./AssetRipper.Bindings.DxilSpirV/NativeLibraries/linux-arm64/native/ | |
| - name: Download Native - Linux x64 | |
| uses: actions/download-artifact@v8 | |
| with: | |
| name: native_linux_x64 | |
| path: ./AssetRipper.Bindings.DxilSpirV/NativeLibraries/linux-x64/native/ | |
| - name: Download Native - Mac Arm64 | |
| uses: actions/download-artifact@v8 | |
| with: | |
| name: native_mac_arm64 | |
| path: ./AssetRipper.Bindings.DxilSpirV/NativeLibraries/osx-arm64/native/ | |
| - name: Download Native - Mac x64 | |
| uses: actions/download-artifact@v8 | |
| with: | |
| name: native_mac_x64 | |
| path: ./AssetRipper.Bindings.DxilSpirV/NativeLibraries/osx-x64/native/ | |
| - name: Build | |
| working-directory: ./AssetRipper.Bindings.DxilSpirV | |
| run: dotnet build -c Release /p:VersionSuffix=nightly.${{ github.run_number }} | |
| - name: Upload NuGet Package | |
| uses: actions/upload-artifact@v7 | |
| with: | |
| name: NuGet Package | |
| path: ./AssetRipper.Bindings.DxilSpirV/bin/Release/*.nupkg | |
| if-no-files-found: error | |
| - name: Calculate conditions | |
| id: conditions | |
| run: | | |
| NUGET_PUSH_CONDITION=false | |
| AUTO_MERGE_CONDITION=false | |
| # Check normal push-to-NuGet condition | |
| if [[ ("${{ github.event_name }}" == "push" || "${{ github.event_name }}" == "workflow_dispatch") && \ | |
| "${{ github.ref }}" == "refs/heads/main" && \ | |
| "${{ github.repository }}" == "AssetRipper/AssetRipper.Bindings.DxilSpirV" ]]; then | |
| NUGET_PUSH_CONDITION=true | |
| fi | |
| if [[ "${{ github.actor }}" == "ds5678" && \ | |
| "${{ github.event_name }}" == "pull_request" && \ | |
| "${{ github.repository }}" == "AssetRipper/AssetRipper.Bindings.DxilSpirV" ]]; then | |
| NUGET_PUSH_CONDITION=true | |
| fi | |
| # Check auto-merge condition | |
| if [[ ("${{ github.actor }}" == "github-actions[bot]" || \ | |
| "${{ github.actor }}" == "dependabot[bot]" || \ | |
| "${{ github.actor }}" == "ds5678") && \ | |
| "${{ github.event_name }}" == "pull_request" && \ | |
| "${{ github.repository }}" == "AssetRipper/AssetRipper.Bindings.DxilSpirV" ]]; then | |
| AUTO_MERGE_CONDITION=true | |
| fi | |
| echo "nuget_push_condition=$NUGET_PUSH_CONDITION" >> $GITHUB_OUTPUT | |
| echo "auto_merge_condition=$AUTO_MERGE_CONDITION" >> $GITHUB_OUTPUT | |
| - name: Push to NuGet.org | |
| if: steps.conditions.outputs.nuget_push_condition == 'true' | |
| run: | | |
| dotnet nuget push ./AssetRipper.Bindings.DxilSpirV/bin/Release/*.nupkg --source https://api.nuget.org/v3/index.json --api-key ${{ secrets.NUGET_API_KEY }} --skip-duplicate | |
| - name: Automatically Merge | |
| if: steps.conditions.outputs.auto_merge_condition == 'true' | |
| run: gh pr merge --squash --auto "${{ github.event.pull_request.number }}" | |
| env: | |
| GH_TOKEN: ${{ github.token }} |