All patches and comments are welcome. Please squash your changes to logical
commits before using git-format-patch and git-send-email to
patches@git.madduck.net.
If you'd read over the Git project's submission guidelines and adhered to them,
I'd be especially grateful.
6 paths: ["src/**", "pyproject.toml", ".github/workflows/*"]
9 paths: ["src/**", "pyproject.toml", ".github/workflows/*"]
12 group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.run_id }}
13 cancel-in-progress: true
17 runs-on: ubuntu-latest
19 matrix: ${{ steps.set-config.outputs.matrix }}
22 - uses: actions/checkout@v4
23 - uses: actions/setup-python@v4
27 - name: Install diff-shades and support dependencies
29 python -m pip install 'click==8.1.3' packaging urllib3
30 python -m pip install https://github.com/ichard26/diff-shades/archive/stable.zip
32 - name: Calculate run configuration & metadata
35 GITHUB_TOKEN: ${{ github.token }}
37 python scripts/diff_shades_gha_helper.py config ${{ github.event_name }} ${{ matrix.mode }}
40 name: analysis / ${{ matrix.mode }}
42 runs-on: ubuntu-latest
44 HATCH_BUILD_HOOKS_ENABLE: "1"
45 # Clang is less picky with the C code it's given than gcc (and may
46 # generate faster binaries too).
51 include: ${{ fromJson(needs.configure.outputs.matrix )}}
54 - name: Checkout this repository (full clone)
55 uses: actions/checkout@v4
57 # The baseline revision could be rather old so a full clone is ideal.
60 - uses: actions/setup-python@v4
64 - name: Install diff-shades and support dependencies
66 python -m pip install https://github.com/ichard26/diff-shades/archive/stable.zip
67 python -m pip install 'click==8.1.3' packaging urllib3
68 # After checking out old revisions, this might not exist so we'll use a copy.
69 cat scripts/diff_shades_gha_helper.py > helper.py
70 git config user.name "diff-shades-gha"
71 git config user.email "diff-shades-gha@example.com"
73 - name: Attempt to use cached baseline analysis
75 uses: actions/cache@v3
77 path: ${{ matrix.baseline-analysis }}
78 key: ${{ matrix.baseline-cache-key }}
80 - name: Build and install baseline revision
81 if: steps.baseline-cache.outputs.cache-hit != 'true'
83 GITHUB_TOKEN: ${{ github.token }}
85 ${{ matrix.baseline-setup-cmd }}
86 && python -m pip install .
88 - name: Analyze baseline revision
89 if: steps.baseline-cache.outputs.cache-hit != 'true'
91 diff-shades analyze -v --work-dir projects-cache/
92 ${{ matrix.baseline-analysis }} ${{ matrix.force-flag }}
94 - name: Build and install target revision
96 GITHUB_TOKEN: ${{ github.token }}
98 ${{ matrix.target-setup-cmd }}
99 && python -m pip install .
101 - name: Analyze target revision
103 diff-shades analyze -v --work-dir projects-cache/
104 ${{ matrix.target-analysis }} --repeat-projects-from
105 ${{ matrix.baseline-analysis }} ${{ matrix.force-flag }}
107 - name: Generate HTML diff report
109 diff-shades --dump-html diff.html compare --diff
110 ${{ matrix.baseline-analysis }} ${{ matrix.target-analysis }}
112 - name: Upload diff report
113 uses: actions/upload-artifact@v3
115 name: ${{ matrix.mode }}-diff.html
118 - name: Upload baseline analysis
119 uses: actions/upload-artifact@v3
121 name: ${{ matrix.baseline-analysis }}
122 path: ${{ matrix.baseline-analysis }}
124 - name: Upload target analysis
125 uses: actions/upload-artifact@v3
127 name: ${{ matrix.target-analysis }}
128 path: ${{ matrix.target-analysis }}
130 - name: Generate summary file (PR only)
131 if: github.event_name == 'pull_request' && matrix.mode == 'preview-changes'
133 python helper.py comment-body
134 ${{ matrix.baseline-analysis }} ${{ matrix.target-analysis }}
135 ${{ matrix.baseline-sha }} ${{ matrix.target-sha }}
136 ${{ github.event.pull_request.number }}
138 - name: Upload summary file (PR only)
139 if: github.event_name == 'pull_request' && matrix.mode == 'preview-changes'
140 uses: actions/upload-artifact@v3
142 name: .pr-comment.json
143 path: .pr-comment.json
145 - name: Verify zero changes (PR only)
146 if: matrix.mode == 'assert-no-changes'
148 diff-shades compare --check ${{ matrix.baseline-analysis }} ${{ matrix.target-analysis }}
149 || (echo "Please verify you didn't change the stable code style unintentionally!" && exit 1)
151 - name: Check for failed files for target revision
152 # Even if the previous step failed, we should still check for failed files.
155 diff-shades show-failed --check --show-log ${{ matrix.target-analysis }}