From cd95eabcc6756c84eddf6a6b8fd9a8eea2a5b5ab Mon Sep 17 00:00:00 2001 From: Cody Robibero Date: Fri, 6 Sep 2024 07:18:19 -0600 Subject: ABI Diff action - use Github Token (#12594) --- .github/workflows/ci-compat.yml | 147 +++++++++++++++++++++++++++++++++++++++ .github/workflows/compat.yml | 149 ---------------------------------------- 2 files changed, 147 insertions(+), 149 deletions(-) create mode 100644 .github/workflows/ci-compat.yml delete mode 100644 .github/workflows/compat.yml (limited to '.github/workflows') diff --git a/.github/workflows/ci-compat.yml b/.github/workflows/ci-compat.yml new file mode 100644 index 000000000..12532a13b --- /dev/null +++ b/.github/workflows/ci-compat.yml @@ -0,0 +1,147 @@ +name: ABI Compatibility +on: + pull_request_target: + pull_request: + +permissions: {} + +jobs: + abi-head: + name: ABI - HEAD + runs-on: ubuntu-latest + permissions: read-all + steps: + - name: Checkout repository + uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 + with: + ref: ${{ github.event.pull_request.head.sha }} + repository: ${{ github.event.pull_request.head.repo.full_name }} + + - name: Build + run: | + dotnet build Jellyfin.Server -o ./out + + - name: Upload Head + uses: actions/upload-artifact@50769540e7f4bd5e21e526ee35c689e35e0d6874 # v4.4.0 + with: + name: abi-head + retention-days: 14 + if-no-files-found: error + path: out/ + + abi-base: + name: ABI - BASE + if: ${{ github.base_ref != '' }} + runs-on: ubuntu-latest + permissions: read-all + steps: + - name: Checkout repository + uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 + with: + ref: ${{ github.event.pull_request.head.sha }} + repository: ${{ github.event.pull_request.head.repo.full_name }} + fetch-depth: 0 + + - name: Checkout common ancestor + env: + HEAD_REF: ${{ github.head_ref }} + run: | + git remote add upstream https://github.com/${{ github.event.pull_request.base.repo.full_name }} + git -c protocol.version=2 fetch --prune --progress --no-recurse-submodules upstream +refs/heads/*:refs/remotes/upstream/* +refs/tags/*:refs/tags/* + ANCESTOR_REF=$(git merge-base upstream/${{ github.base_ref }} origin/$HEAD_REF) + git checkout --progress --force $ANCESTOR_REF + + - name: Build + run: | + dotnet build Jellyfin.Server -o ./out + + - name: Upload Head + uses: actions/upload-artifact@50769540e7f4bd5e21e526ee35c689e35e0d6874 # v4.4.0 + with: + name: abi-base + retention-days: 14 + if-no-files-found: error + path: out/ + + abi-diff: + permissions: + pull-requests: write # to create or update comment (peter-evans/create-or-update-comment) + + name: ABI - Difference + runs-on: ubuntu-latest + needs: + - abi-head + - abi-base + + steps: + - name: Download abi-head + uses: actions/download-artifact@fa0a91b85d4f404e444e00e005971372dc801d16 # v4.1.8 + with: + name: abi-head + path: abi-head + + - name: Download abi-base + uses: actions/download-artifact@fa0a91b85d4f404e444e00e005971372dc801d16 # v4.1.8 + with: + name: abi-base + path: abi-base + + - name: Setup ApiCompat + run: | + dotnet tool install --global Microsoft.DotNet.ApiCompat.Tool + + - name: Run ApiCompat + id: diff + run: | + { + echo 'body<> $GITHUB_OUTPUT + + - name: Find difference comment + uses: peter-evans/find-comment@3eae4d37986fb5a8592848f6a574fdf654e61f9e # v3.1.0 + id: find-comment + with: + issue-number: ${{ github.event.pull_request.number }} + direction: last + body-includes: abi-diff-workflow-comment + + - name: Reply or edit difference comment (changed) + uses: peter-evans/create-or-update-comment@71345be0265236311c031f5c7866368bd1eff043 # v4.0.0 + if: ${{ steps.diff.outputs.body != '' }} + with: + issue-number: ${{ github.event.pull_request.number }} + comment-id: ${{ steps.find-comment.outputs.comment-id }} + edit-mode: replace + body: | + +
+ ABI Difference + + ``` + ${{ steps.diff.outputs.body }} + ``` + +
+ + - name: Reply or edit difference comment (unchanged) + uses: peter-evans/create-or-update-comment@71345be0265236311c031f5c7866368bd1eff043 # v4.0.0 + if: ${{ steps.diff.outputs.body == '' && steps.find-comment.outputs.comment-id != '' }} + with: + issue-number: ${{ github.event.pull_request.number }} + comment-id: ${{ steps.find-comment.outputs.comment-id }} + edit-mode: replace + body: | + +
+ ABI Difference + + No changes to the ABI found. See history of this comment for previous changes. + +
diff --git a/.github/workflows/compat.yml b/.github/workflows/compat.yml deleted file mode 100644 index fed354236..000000000 --- a/.github/workflows/compat.yml +++ /dev/null @@ -1,149 +0,0 @@ -name: ABI Compatibility -on: - pull_request_target: - pull_request: - -permissions: {} - -jobs: - abi-head: - name: ABI - HEAD - runs-on: ubuntu-latest - permissions: read-all - steps: - - name: Checkout repository - uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 - with: - ref: ${{ github.event.pull_request.head.sha }} - repository: ${{ github.event.pull_request.head.repo.full_name }} - - - name: Build - run: | - dotnet build Jellyfin.Server -o ./out - - - name: Upload Head - uses: actions/upload-artifact@50769540e7f4bd5e21e526ee35c689e35e0d6874 # v4.4.0 - with: - name: abi-head - retention-days: 14 - if-no-files-found: error - path: out/ - - abi-base: - name: ABI - BASE - if: ${{ github.base_ref != '' }} - runs-on: ubuntu-latest - permissions: read-all - steps: - - name: Checkout repository - uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 - with: - ref: ${{ github.event.pull_request.head.sha }} - repository: ${{ github.event.pull_request.head.repo.full_name }} - fetch-depth: 0 - - - name: Checkout common ancestor - env: - HEAD_REF: ${{ github.head_ref }} - run: | - git remote add upstream https://github.com/${{ github.event.pull_request.base.repo.full_name }} - git -c protocol.version=2 fetch --prune --progress --no-recurse-submodules upstream +refs/heads/*:refs/remotes/upstream/* +refs/tags/*:refs/tags/* - ANCESTOR_REF=$(git merge-base upstream/${{ github.base_ref }} origin/$HEAD_REF) - git checkout --progress --force $ANCESTOR_REF - - - name: Build - run: | - dotnet build Jellyfin.Server -o ./out - - - name: Upload Head - uses: actions/upload-artifact@50769540e7f4bd5e21e526ee35c689e35e0d6874 # v4.4.0 - with: - name: abi-base - retention-days: 14 - if-no-files-found: error - path: out/ - - abi-diff: - permissions: - pull-requests: write # to create or update comment (peter-evans/create-or-update-comment) - - name: ABI - Difference - runs-on: ubuntu-latest - needs: - - abi-head - - abi-base - - steps: - - name: Download abi-head - uses: actions/download-artifact@fa0a91b85d4f404e444e00e005971372dc801d16 # v4.1.8 - with: - name: abi-head - path: abi-head - - - name: Download abi-base - uses: actions/download-artifact@fa0a91b85d4f404e444e00e005971372dc801d16 # v4.1.8 - with: - name: abi-base - path: abi-base - - - name: Setup ApiCompat - run: | - dotnet tool install --global Microsoft.DotNet.ApiCompat.Tool - - - name: Run ApiCompat - id: diff - run: | - { - echo 'body<> $GITHUB_OUTPUT - - - name: Find difference comment - uses: peter-evans/find-comment@3eae4d37986fb5a8592848f6a574fdf654e61f9e # v3.1.0 - id: find-comment - with: - issue-number: ${{ github.event.pull_request.number }} - direction: last - body-includes: abi-diff-workflow-comment - - - name: Reply or edit difference comment (changed) - uses: peter-evans/create-or-update-comment@71345be0265236311c031f5c7866368bd1eff043 # v4.0.0 - if: ${{ steps.diff.outputs.body != '' }} - with: - issue-number: ${{ github.event.pull_request.number }} - comment-id: ${{ steps.find-comment.outputs.comment-id }} - edit-mode: replace - token: ${{ secrets.JF_BOT_TOKEN }} - body: | - -
- ABI Difference - - ``` - ${{ steps.diff.outputs.body }} - ``` - -
- - - name: Reply or edit difference comment (unchanged) - uses: peter-evans/create-or-update-comment@71345be0265236311c031f5c7866368bd1eff043 # v4.0.0 - if: ${{ steps.diff.outputs.body == '' && steps.find-comment.outputs.comment-id != '' }} - with: - issue-number: ${{ github.event.pull_request.number }} - comment-id: ${{ steps.find-comment.outputs.comment-id }} - edit-mode: replace - token: ${{ secrets.JF_BOT_TOKEN }} - body: | - -
- ABI Difference - - No changes to the ABI found. See history of this comment for previous changes. - -
-- cgit v1.2.3