diff --git a/.github/workflows/clear_cache.yml b/.github/workflows/clear_cache.yml deleted file mode 100644 index 490e199dca9..00000000000 --- a/.github/workflows/clear_cache.yml +++ /dev/null @@ -1,138 +0,0 @@ -# Clean up caches created by BinDiff job -name: Dynamo-PostBinDiffProcess -on: - workflow_run: - workflows: [Dynamo-BinDiff] - types: - - completed -jobs: - fetch-PR-Data: - runs-on: ubuntu-latest - steps: - - name: Download PR Data - uses: dawidd6/action-download-artifact@v3 - with: - run_id: ${{github.event.workflow_run.id }} - name: pr - path: pr/ - - name: Check Artifact - run: ls -R - - name: Extract Data to Output - id: extract - run: | - cat pr/NR - echo "PRNumber=`cat pr/NR`" >> "$GITHUB_OUTPUT" - echo "WFNumber=`cat pr/WN`" >> "$GITHUB_OUTPUT" - echo "Diff1=`cat pr/Diff1`" >> "$GITHUB_OUTPUT" - echo "Diff2=`cat pr/Diff2`" >> "$GITHUB_OUTPUT" - echo "TIMESTAMP=`date +%Y-%m-%d-%H:%M:%S`" >> "$GITHUB_OUTPUT" - outputs: - PRNumber: ${{ steps.extract.outputs.PRNumber }} - WFNumber: ${{ steps.extract.outputs.WFNumber }} - Diff1: ${{ steps.extract.outputs.Diff1 }} - Diff2: ${{ steps.extract.outputs.Diff2 }} - TIMESTAMP: ${{ steps.extract.outputs.TIMESTAMP }} - diff-cache-cleanup-pr: - runs-on: ubuntu-latest - needs: [fetch-PR-Data] - if: github.event.workflow_run.event == 'pull_request' - steps: - - name: Cleanup Caches - run: | - gh extension install actions/gh-actions-cache - - PRNUM=${{ needs.fetch-PR-Data.outputs.PRNumber }} - REPO=${{ github.repository }} - BRANCH="refs/pull/$PRNUM/merge" - echo "Fetching list of cache key" - echo $REPO - echo $BRANCH - echo $PRNUM - cacheKeysForPR=$(gh actions-cache list -R $REPO -B $BRANCH | cut -f 1 ) - ## Setting this to not fail the workflow while deleting cache keys. - set +e - echo "Deleting caches..." - for cacheKey in $cacheKeysForPR - do - echo "Deleting: $cacheKey" - gh actions-cache delete $cacheKey -R $REPO -B $BRANCH --confirm - done - env: - GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} - diff-cache-cleanup-push: - runs-on: ubuntu-latest - needs: [fetch-PR-Data] - if: github.event.workflow_run.event == 'push' - steps: - - name: Cleanup Caches - run: | - gh extension install actions/gh-actions-cache - - WNNUM=${{ needs.fetch-PR-Data.outputs.WFNumber }} - echo $WNNUM - REPO=${{ github.repository }} - - ## Setting this to not fail the workflow while deleting cache keys. - set +e - echo "Deleting caches..." - echo "Deleting: $WNNUM-cache-net60Win-current" - gh actions-cache delete $WNNUM-cache-net60Win-current -R $REPO --confirm - echo "Deleting: $WNNUM-cache-net60Win-master" - gh actions-cache delete $WNNUM-cache-net60Win-master -R $REPO --confirm - env: - GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} - - comments-pr-workflow: - runs-on: ubuntu-latest - needs: [fetch-PR-Data] - if: github.event.workflow_run.event == 'pull_request' - steps: - - name: Download PR Data - uses: dawidd6/action-download-artifact@v3 - with: - run_id: ${{github.event.workflow_run.id }} - name: pr - path: pr/ - - name: Check Artifact - run: ls -R - - name: Find Comment - uses: peter-evans/find-comment@v2 - id: fc - with: - issue-number: ${{ needs.fetch-PR-Data.outputs.PRNumber }} - comment-author: 'github-actions[bot]' - body-includes: Files Added/Deleted - direction: last - - name: Create comment - if: | - steps.fc.outputs.comment-id == '' && - (needs.fetch-PR-Data.outputs.Diff1 != '' || needs.fetch-PR-Data.outputs.Diff2 != '') - uses: peter-evans/create-or-update-comment@v3 - with: - issue-number: ${{ needs.fetch-PR-Data.outputs.PRNumber }} - body: | - ${{ needs.fetch-PR-Data.outputs.Diff1 }} - ${{ needs.fetch-PR-Data.outputs.Diff2 }} - - name: Update comment - if: | - steps.fc.outputs.comment-id != '' && - (needs.fetch-PR-Data.outputs.Diff1 != '' || needs.fetch-PR-Data.outputs.Diff2 != '') - uses: peter-evans/create-or-update-comment@v3 - with: - comment-id: ${{ steps.fc.outputs.comment-id }} - edit-mode: replace - body: | - ${{ needs.fetch-PR-Data.outputs.Diff1 }} - ${{ needs.fetch-PR-Data.outputs.Diff2 }} - (Updated: ${{ needs.fetch-PR-Data.outputs.TIMESTAMP }}) - - name: Update comment resolved - if: | - steps.fc.outputs.comment-id != '' && - (needs.fetch-PR-Data.outputs.Diff1 == '' && needs.fetch-PR-Data.outputs.Diff2 == '') - uses: peter-evans/create-or-update-comment@v3 - with: - comment-id: ${{ steps.fc.outputs.comment-id }} - edit-mode: replace - body: | - ":white_check_mark: **Bin-Diff Issue Resolved.**" - (Updated: ${{ needs.fetch-PR-Data.outputs.TIMESTAMP }}) diff --git a/.github/workflows/dynamoBinDiff.yml b/.github/workflows/dynamoBinDiff.yml deleted file mode 100644 index ca408c8bd43..00000000000 --- a/.github/workflows/dynamoBinDiff.yml +++ /dev/null @@ -1,114 +0,0 @@ -# Build Dynamo using latest VS and DotNET and perform a Bin Diff -name: Dynamo-BinDiff - -on: pull_request - -jobs: - build-dotnet-windows-current: - runs-on: windows-latest - steps: - - name: Checkout Dynamo Repo - uses: actions/checkout@v4 - with: - path: net60_Win_Dynamo - repository: DynamoDS/Dynamo - - name: Setup dotnet - uses: actions/setup-dotnet@v4 - with: - dotnet-version: '6.0.x' - - name: Disable problem matcher - run: echo "::remove-matcher owner=csc::" - - name: Install dependencies for windows runtime - run: | - dotnet restore $Env:GITHUB_WORKSPACE\net60_Win_Dynamo\src\Dynamo.All.sln /p:Configuration=Release --runtime=win-x64 - - name: Build Dynamo current branch with MSBuild for NET60-Windows - run: | - echo "***Continue with the build, Good luck developer!***" - cd "C:\Program Files\Microsoft Visual Studio\2022\Enterprise\MSBuild\Current\Bin\" - .\MSBuild.exe $Env:GITHUB_WORKSPACE\net60_Win_Dynamo\src\Dynamo.All.sln /p:Configuration=Release - - name: Navigate to Dynamo DotNet6 Windows Folder - run: | - cd "$Env:GITHUB_WORKSPACE\net60_Win_Dynamo\bin\AnyCPU\Release" - echo "***Locating DynamoCLI for Windows!***" - test ".\DynamoSandbox.exe" && echo "DynamoSandbox exists!" - - name: Cache Current NET6 Windows Build - uses: actions/cache/save@v3 - with: - path: | - ${{ github.workspace }}\net60_Win_Dynamo\bin\AnyCPU\Release - ${{ github.workspace }}\net60_Win_Dynamo\.github\scripts - key: ${{ github.run_id }}-${{ github.run_attempt }}-cache-net60Win-current - build-dotnet-windows-master: - runs-on: windows-latest - steps: - - name: Checkout Dynamo Repo - uses: actions/checkout@v4 - with: - ref: master - path: master_net60_Win_Dynamo - repository: DynamoDS/Dynamo - - name: Setup dotnet - uses: actions/setup-dotnet@v4 - with: - dotnet-version: '6.0.x' - - name: Disable problem matcher - run: echo "::remove-matcher owner=csc::" - - name: Install dependencies for windows runtime - run: | - dotnet restore $Env:GITHUB_WORKSPACE\master_net60_Win_Dynamo\src\Dynamo.All.sln /p:Configuration=Release --runtime=win-x64 - - name: Build Dynamo master branch with MSBuild for NET60-Windows - run: | - echo "***Continue with the build, Good luck developer!***" - cd "C:\Program Files\Microsoft Visual Studio\2022\Enterprise\MSBuild\Current\Bin\" - .\MSBuild.exe $Env:GITHUB_WORKSPACE\master_net60_Win_Dynamo\src\Dynamo.All.sln /p:Configuration=Release - - name: Navigate to Dynamo DotNet6 Windows Folder - run: | - cd "$Env:GITHUB_WORKSPACE\master_net60_Win_Dynamo\bin\AnyCPU\Release" - echo "***Locating DynamoCLI for Windows!***" - test ".\DynamoCLI.exe" && echo "DynamoCLI exists!" - - name: Cache Current NET6 Windows Build - uses: actions/cache/save@v3 - with: - path: ${{ github.workspace }}\master_net60_Win_Dynamo\bin\AnyCPU\Release - key: ${{ github.run_id }}-${{ github.run_attempt }}-cache-net60Win-master - run-bin-diff-net60-windows: - needs: [build-dotnet-windows-current, build-dotnet-windows-master] - runs-on: windows-latest - steps: - - name: Restore Current Net60 Windows Build - uses: actions/cache/restore@v3 - with: - fail-on-cache-miss: true - path: | - ${{ github.workspace }}\net60_Win_Dynamo\bin\AnyCPU\Release - ${{ github.workspace }}\net60_Win_Dynamo\.github\scripts - key: ${{ github.run_id }}-${{ github.run_attempt }}-cache-net60Win-current - - name: Restore Master Net60 Windows Build - uses: actions/cache/restore@v3 - with: - fail-on-cache-miss: true - path: ${{ github.workspace }}\master_net60_Win_Dynamo\bin\AnyCPU\Release - key: ${{ github.run_id }}-${{ github.run_attempt }}-cache-net60Win-master - - name: Run Binary Diff Job - id: Diff2 - run: | - echo "***Running the binary diff job between the current branch and the master branch of NET60-Windows Config!***" - cd "$Env:GITHUB_WORKSPACE\net60_Win_Dynamo\.github\scripts" - .\bin_diff.ps1 $Env:GITHUB_WORKSPACE\master_net60_Win_Dynamo\bin\AnyCPU\Release,$Env:GITHUB_WORKSPACE\net60_Win_Dynamo\bin\AnyCPU\Release -src ${{ github.job }} - echo "Diff2=$(cat ./result.txt)" >> $Env:GITHUB_OUTPUT - outputs: - Diff2: ${{ steps.Diff2.outputs.Diff2 }} - save-PR-Data: - needs: [run-bin-diff-net60-windows] - runs-on: ubuntu-latest - steps: - - name: Save PR Data - run: | - mkdir -p ./pr - echo ${{ github.event.number }} > ./pr/NR - echo ${{ github.run_id }}-${{ github.run_attempt }} > ./pr/WN - echo "${{ needs.run-bin-diff-net60-windows.outputs.Diff2 }}" > ./pr/Diff2 - - uses: actions/upload-artifact@v4 - with: - name: pr - path: pr/ diff --git a/.github/workflows/dynamo_bin_diff.yml b/.github/workflows/dynamo_bin_diff.yml new file mode 100644 index 00000000000..061649842bd --- /dev/null +++ b/.github/workflows/dynamo_bin_diff.yml @@ -0,0 +1,133 @@ +# Runs on every pull request +# +# - Builds Dynamo current branch and master and performs a Bin Diff +# - Triggers Dynamo Post Build Bin Diff job on completion +name: Dynamo Bin Diff + +on: + pull_request: + +jobs: + build_current: + name: Build Current + runs-on: windows-latest + steps: + - name: Checkout Dynamo Repo + uses: actions/checkout@v4 + with: + path: Dynamo + repository: DynamoDS/Dynamo + - name: Setup dotnet + uses: actions/setup-dotnet@v4 + with: + dotnet-version: '8.0.x' + - name: Disable problem matcher + run: Write-Output "::remove-matcher owner=csc::" + - name: Setup msbuild + uses: microsoft/setup-msbuild@v1.3 + - name: Install dependencies for windows runtime + run: | + dotnet restore ${{ github.workspace }}\Dynamo\src\Dynamo.All.sln /p:Configuration=Release --runtime=win-x64 -p:DotNet=net8.0 + - name: Build Dynamo with MSBuild + run: | + Write-Output "***Continue with the build, Good luck developer!***" + msbuild ${{ github.workspace }}\Dynamo\src\Dynamo.All.sln /p:Configuration=Release /p:DotNet=net8.0 + - name: Look for DynamoCLI.exe + run: | + Write-Output "***Locating DynamoCLI.exe!***" + if (Test-Path -Path "${{ github.workspace }}\Dynamo\bin\AnyCPU\Release\DynamoCLI.exe") { + Write-Output "DynamoCLI.exe exists!" + } else { + Write-Error "DynamoCLI.exe was not found!" + } + - name: Cache Current Build + uses: actions/cache/save@v3 + with: + path: | + ${{ github.workspace }}\Dynamo\bin\AnyCPU\Release + ${{ github.workspace }}\Dynamo\.github\scripts + key: ${{ github.run_id }}-${{ github.run_attempt }}-current + build_master: + name: Build Master + runs-on: windows-latest + steps: + - name: Checkout Dynamo Repo + uses: actions/checkout@v4 + with: + path: master + ref: master + repository: DynamoDS/Dynamo + - name: Setup dotnet + uses: actions/setup-dotnet@v4 + with: + dotnet-version: '8.0.x' + - name: Disable problem matcher + run: Write-Output "::remove-matcher owner=csc::" + - name: Setup msbuild + uses: microsoft/setup-msbuild@v1.3 + - name: Install dependencies for windows runtime + run: | + dotnet restore ${{ github.workspace }}\master\src\Dynamo.All.sln /p:Configuration=Release --runtime=win-x64 -p:DotNet=net8.0 + - name: Build Dynamo with MSBuild + run: | + Write-Output "***Continue with the build, Good luck developer!***" + msbuild ${{ github.workspace }}\master\src\Dynamo.All.sln /p:Configuration=Release /p:DotNet=net8.0 + - name: Look for DynamoCLI.exe + run: | + Write-Output "***Locating DynamoCLI.exe!***" + if (Test-Path -Path "${{ github.workspace }}\master\bin\AnyCPU\Release\DynamoCLI.exe") { + Write-Output "DynamoCLI.exe exists!" + } else { + Write-Error "DynamoCLI.exe was not found!" + } + - name: Cache Master Build + uses: actions/cache/save@v3 + with: + path: ${{ github.workspace }}\master\bin\AnyCPU\Release + key: ${{ github.run_id }}-${{ github.run_attempt }}-master + bin_diff: + name: Binary Diff + needs: [build_current, build_master] + runs-on: windows-latest + steps: + - name: Restore Current Build + uses: actions/cache/restore@v3 + with: + fail-on-cache-miss: true + path: | + ${{ github.workspace }}\Dynamo\bin\AnyCPU\Release + ${{ github.workspace }}\Dynamo\.github\scripts + key: ${{ github.run_id }}-${{ github.run_attempt }}-current + - name: Restore Master Build + uses: actions/cache/restore@v3 + with: + fail-on-cache-miss: true + path: ${{ github.workspace }}\master\bin\AnyCPU\Release + key: ${{ github.run_id }}-${{ github.run_attempt }}-master + - name: Run Binary Diff Job + id: diff + run: | + Write-Output "***Running the binary diff job between the current branch and the master branch!***" + Set-Location -Path "${{ github.workspace }}\Dynamo\.github\scripts" + .\bin_diff.ps1 ${{ github.workspace }}\master\bin\AnyCPU\Release, ${{ github.workspace }}\Dynamo\bin\AnyCPU\Release -src ${{ github.job }} + Get-Content -Path result.txt | ? { $_ -ne "" } | Out-File -Path result.txt + - name: Upload Binary Diff Result + uses: actions/upload-artifact@v4 + with: + name: bin_diff_result + path: ${{ github.workspace }}\Dynamo\.github\scripts\result.txt + save_pr_data: + name: Save PR Data + runs-on: ubuntu-latest + steps: + - name: Save PR Data + run: | + mkdir -p ${{ github.workspace }}/pr + echo ${{ github.event.number }} > ${{ github.workspace }}/pr/pr_number.txt + - name: Upload PR Data + uses: actions/upload-artifact@v4 + with: + name: pr_data + path: ${{ github.workspace }}/pr + if-no-files-found: warn + retention-days: 3 diff --git a/.github/workflows/dynamo_post_bin_diff.yml b/.github/workflows/dynamo_post_bin_diff.yml new file mode 100644 index 00000000000..d2fa1a2a31d --- /dev/null +++ b/.github/workflows/dynamo_post_bin_diff.yml @@ -0,0 +1,79 @@ +# Runs on completion of Dynamo Bin Diff workflow +# +# - Adds Bin Diff result as comment to Pull Request +# - Deletes caches created by Bin Diff job +name: Dynamo Post Bin Diff + +on: + workflow_run: + workflows: [Dynamo Bin Diff] + types: + - completed + +jobs: + pr_comment: + name: Pull Request Comment + runs-on: ubuntu-latest + if: github.event.workflow_run.event == 'pull_request' && github.event.workflow_run.conclusion == 'success' + steps: + - name: Download Pull Request Data + uses: dawidd6/action-download-artifact@v3 + with: + name: pr_data + run_id: ${{ github.event.workflow_run.id }} + path: ${{ github.workspace }}/pr + - name: Download Bin Diff Result + uses: dawidd6/action-download-artifact@v3 + with: + name: bin_diff_result + run_id: ${{ github.event.workflow_run.id }} + path: ${{ github.workspace }}/bin_diff_result + - name: Set Details + id: set_details + run: | + echo "PR_NUMBER=$(cat ${{ github.workspace }}/pr/pr_number.txt)" >> $GITHUB_OUTPUT + echo "DIFF=$(cat ${{ github.workspace }}/bin_diff_result/result.txt)" >> $GITHUB_OUTPUT + echo "TIMESTAMP=$(date +%Y-%m-%d-%H:%M:%S)" >> $GITHUB_OUTPUT + - name: Find Comment + uses: peter-evans/find-comment@v2 + id: find_comment + with: + issue-number: ${{ steps.set_details.outputs.PR_NUMBER }} + comment-author: github-actions[bot] + body-includes: Files Added/Deleted + direction: last + - name: Create comment + if: steps.find_comment.outputs.comment-id == '' && steps.set_details.outputs.DIFF != '' + uses: peter-evans/create-or-update-comment@v3 + with: + issue-number: ${{ steps.set_details.outputs.PR_NUMBER }} + body: | + ${{ steps.set_details.outputs.DIFF }} + - name: Update comment + if: steps.find_comment.outputs.comment-id != '' && steps.set_details.outputs.DIFF != '' + uses: peter-evans/create-or-update-comment@v3 + with: + comment-id: ${{ steps.find_comment.outputs.comment-id }} + edit-mode: replace + body: | + ${{ steps.set_details.outputs.DIFF }} + (♻️ Updated: ${{ steps.set_details.outputs.TIMESTAMP }}) + - name: Update comment as resolved + if: steps.find_comment.outputs.comment-id != '' && steps.set_details.outputs.DIFF == '' + uses: peter-evans/create-or-update-comment@v3 + with: + comment-id: ${{ steps.find_comment.outputs.comment-id }} + edit-mode: replace + body: | + :white_check_mark: **Bin Diff Issue Resolved.** + (♻️ Updated: ${{ steps.set_details.outputs.TIMESTAMP }}) + delete_cache: + name: Delete Cache + runs-on: ubuntu-latest + steps: + - name: Delete Cache + env: + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} + run: | + gh cache delete ${{ github.event.workflow_run.id }}-${{ github.event.workflow_run.run_attempt }}-current --repo ${{ github.repository}} || true + gh cache delete ${{ github.event.workflow_run.id }}-${{ github.event.workflow_run.run_attempt }}-master --repo ${{ github.repository}} || true