yum-mirror/slang

Making it easier to work with shaders

git clone https://git.yummers.dev/yum-mirror/slang

aidanfnvFix slangc path used by cmdline reference doc regeneration action (#7128)fba75a6f3

master
5.2 KiB116 linesraw
1name: Regenerate Command Line Reference
2on:
3  repository_dispatch:
4    types: [regenerate-cmdline-ref-command]
5jobs:
6  regenerate-cmdline-ref:
7    runs-on: ubuntu-latest
8    steps:
9      - name: Checkout PR branch
10        uses: actions/checkout@v4
11        with:
12          token: ${{ secrets.SLANGBOT_PAT }}
13          repository: ${{ github.event.client_payload.pull_request.head.repo.full_name }}
14          ref: ${{ github.event.client_payload.pull_request.head.ref }}
15          path: pr-branch
16          submodules: "recursive"
17
18      - name: Checkout target branch
19        uses: actions/checkout@v4
20        with:
21          token: ${{ secrets.SLANGBOT_PAT }}
22          repository: ${{ github.event.client_payload.pull_request.base.repo.full_name }}
23          ref: ${{ github.event.client_payload.pull_request.base.ref }}
24          path: target-branch
25          submodules: "recursive"
26
27      - name: Install dependencies
28        run: |
29          sudo apt-get update
30          sudo apt-get install -y libx11-dev
31
32      - name: Setup
33        uses: ./target-branch/.github/actions/common-setup
34        with:
35          os: linux
36          compiler: gcc
37          platform: x86_64
38          config: release
39          build-llvm: false
40
41      - name: Build Slang
42        id: build
43        run: |
44          cd pr-branch
45          cmake --preset default --fresh \
46            -DSLANG_SLANG_LLVM_FLAVOR=DISABLE \
47            -DSLANG_ENABLE_TESTS=OFF \
48            -DSLANG_ENABLE_EXAMPLES=OFF \
49            -DSLANG_ENABLE_GFX=OFF \
50            -DSLANG_ENABLE_SLANGD=OFF \
51            -DSLANG_EXCLUDE_DAWN=ON \
52            -DSLANG_EXCLUDE_TINT=ON
53          cmake --workflow --preset release
54
55      - name: Regenerate Command Line Reference
56        id: regen
57        run: |
58          cd pr-branch
59          mkdir -p docs
60          ./build/${{ env.cmake_config }}/bin/slangc -help-style markdown -h > docs/command-line-slangc-reference.md 2>&1
61
62      - name: Configure Git commit signing
63        id: git-info
64        run: |
65          echo "${{ secrets.SLANGBOT_SIGNING_KEY }}" > "${{runner.temp}}"/signing_key
66          chmod 600 "${{runner.temp}}"/signing_key
67          git -C pr-branch config commit.gpgsign true
68          git -C pr-branch config gpg.format ssh
69          git -C pr-branch config user.signingkey "${{runner.temp}}"/signing_key
70          bot_info=$(curl -s -H "Authorization: Bearer ${{ secrets.SLANGBOT_PAT }}" \
71            "https://api.github.com/user")
72          echo "bot_identity=$(echo $bot_info | jq --raw-output '.login + " <" + (.id|tostring) + "+" + .login + "@users.noreply.github.com>"')" >> $GITHUB_OUTPUT
73          echo "bot_name=$(echo $bot_info | jq --raw-output '.login')" >> $GITHUB_OUTPUT
74
75      - name: Create Pull Request
76        id: create-pr
77        uses: peter-evans/create-pull-request@v7
78        with:
79          token: ${{ secrets.SLANGBOT_PAT }}
80          path: pr-branch
81          commit-message: "regenerate command line reference"
82          title: "Regenerate command line reference for PR #${{ github.event.client_payload.pull_request.number }}"
83          body: "Automated command line reference generation for ${{ github.event.client_payload.pull_request.html_url }}"
84          committer: ${{ steps.git-info.outputs.bot_identity }}
85          author: ${{ steps.git-info.outputs.bot_identity }}
86          branch: regenerate-cmdline-ref-${{ github.event.client_payload.pull_request.number }}-${{ github.event.client_payload.pull_request.head.ref }}
87          base: ${{ github.event.client_payload.pull_request.head.ref }}
88          push-to-fork: ${{ steps.git-info.outputs.bot_name }}/slang
89          delete-branch: true
90
91      - name: Comment on PR
92        uses: peter-evans/create-or-update-comment@v4
93        if: always()
94        with:
95          token: ${{ secrets.SLANGBOT_PAT }}
96          repository: ${{ github.event.client_payload.github.payload.repository.full_name }}
97          issue-number: ${{ github.event.client_payload.pull_request.number }}
98          body: |
99            ${{ 
100              steps.build.conclusion == 'failure'
101              && format('❌ Slang build failed. Please check the [workflow run](https://github.com/{0}/actions/runs/{1})', github.repository, github.run_id)
102              || (steps.regen.conclusion == 'failure' 
103                  && format('❌ Command line reference generation failed. Please check the [workflow run](https://github.com/{0}/actions/runs/{1})', github.repository, github.run_id)
104                  || (steps.create-pr.conclusion == 'failure' 
105                      && format('❌ Failed to create regenerate command line reference pull request. Please check the [workflow run](https://github.com/{0}/actions/runs/{1})', github.repository, github.run_id)
106                      || format('🌈 Regenerated command line reference, please merge the changes from [this PR]({0})', steps.create-pr.outputs.pull-request-url)))
107            }}
108
109      - name: Add reaction
110        uses: peter-evans/create-or-update-comment@v4
111        with:
112          token: ${{ secrets.SLANGBOT_PAT }}
113          repository: ${{ github.event.client_payload.github.payload.repository.full_name }}
114          comment-id: ${{ github.event.client_payload.github.payload.comment.id }}
115          reactions-edit-mode: replace
116          reactions: hooray