]> git.madduck.net Git - etc/vim.git/blob - .github/workflows/diff_shades.yml

madduck's git repository

Every one of the projects in this repository is available at the canonical URL git://git.madduck.net/madduck/pub/<projectpath> — see each project's metadata for the exact URL.

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.

SSH access, as well as push access can be individually arranged.

If you use my repositories frequently, consider adding the following snippet to ~/.gitconfig and using the third clone URL listed for each project:

[url "git://git.madduck.net/madduck/"]
  insteadOf = madduck:

release: skip bad macos wheels for now (#3411)
[etc/vim.git] / .github / workflows / diff_shades.yml
1 name: diff-shades
2
3 on:
4   push:
5     branches: [main]
6     paths: ["src/**", "pyproject.toml", ".github/workflows/*"]
7
8   pull_request:
9     paths: ["src/**", "pyproject.toml", ".github/workflows/*"]
10
11 concurrency:
12   group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.run_id }}
13   cancel-in-progress: true
14
15 jobs:
16   configure:
17     runs-on: ubuntu-latest
18     outputs:
19       matrix: ${{ steps.set-config.outputs.matrix }}
20
21     steps:
22       - uses: actions/checkout@v3
23       - uses: actions/setup-python@v4
24         with:
25           python-version: "*"
26
27       - name: Install diff-shades and support dependencies
28         run: |
29           python -m pip install click packaging urllib3
30           python -m pip install https://github.com/ichard26/diff-shades/archive/stable.zip
31
32       - name: Calculate run configuration & metadata
33         id: set-config
34         env:
35           GITHUB_TOKEN: ${{ github.token }}
36         run: >
37           python scripts/diff_shades_gha_helper.py config ${{ github.event_name }} ${{ matrix.mode }}
38
39   analysis:
40     name: analysis / ${{ matrix.mode }}
41     needs: configure
42     runs-on: ubuntu-latest
43     env:
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).
47       CC: clang-12
48     strategy:
49       fail-fast: false
50       matrix:
51         include: ${{ fromJson(needs.configure.outputs.matrix )}}
52
53     steps:
54       - name: Checkout this repository (full clone)
55         uses: actions/checkout@v3
56         with:
57           # The baseline revision could be rather old so a full clone is ideal.
58           fetch-depth: 0
59
60       - uses: actions/setup-python@v4
61         with:
62           python-version: "*"
63
64       - name: Install diff-shades and support dependencies
65         run: |
66           python -m pip install https://github.com/ichard26/diff-shades/archive/stable.zip
67           python -m pip install click 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"
72
73       - name: Attempt to use cached baseline analysis
74         id: baseline-cache
75         uses: actions/cache@v3
76         with:
77           path: ${{ matrix.baseline-analysis }}
78           key: ${{ matrix.baseline-cache-key }}
79
80       - name: Build and install baseline revision
81         if: steps.baseline-cache.outputs.cache-hit != 'true'
82         env:
83           GITHUB_TOKEN: ${{ github.token }}
84         run: >
85           ${{ matrix.baseline-setup-cmd }}
86           && python -m pip install .
87
88       - name: Analyze baseline revision
89         if: steps.baseline-cache.outputs.cache-hit != 'true'
90         run: >
91           diff-shades analyze -v --work-dir projects-cache/
92           ${{ matrix.baseline-analysis }} ${{ matrix.force-flag }}
93
94       - name: Build and install target revision
95         env:
96           GITHUB_TOKEN: ${{ github.token }}
97         run: >
98           ${{ matrix.target-setup-cmd }}
99           && python -m pip install .
100
101       - name: Analyze target revision
102         run: >
103           diff-shades analyze -v --work-dir projects-cache/
104           ${{ matrix.target-analysis }} --repeat-projects-from
105           ${{ matrix.baseline-analysis }} ${{ matrix.force-flag }}
106
107       - name: Generate HTML diff report
108         run: >
109           diff-shades --dump-html diff.html compare --diff
110           ${{ matrix.baseline-analysis }} ${{ matrix.target-analysis }}
111
112       - name: Upload diff report
113         uses: actions/upload-artifact@v3
114         with:
115           name: ${{ matrix.mode }}-diff.html
116           path: diff.html
117
118       - name: Upload baseline analysis
119         uses: actions/upload-artifact@v3
120         with:
121           name: ${{ matrix.baseline-analysis }}
122           path: ${{ matrix.baseline-analysis }}
123
124       - name: Upload target analysis
125         uses: actions/upload-artifact@v3
126         with:
127           name: ${{ matrix.target-analysis }}
128           path: ${{ matrix.target-analysis }}
129
130       - name: Generate summary file (PR only)
131         if: github.event_name == 'pull_request' && matrix.mode == 'preview-changes'
132         run: >
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 }}
137
138       - name: Upload summary file (PR only)
139         if: github.event_name == 'pull_request' && matrix.mode == 'preview-changes'
140         uses: actions/upload-artifact@v3
141         with:
142           name: .pr-comment.json
143           path: .pr-comment.json
144
145       - name: Verify zero changes (PR only)
146         if: matrix.mode == 'assert-no-changes'
147         run: >
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)
150
151       - name: Check for failed files for target revision
152         # Even if the previous step failed, we should still check for failed files.
153         if: always()
154         run: >
155           diff-shades show-failed --check --show-log ${{ matrix.target-analysis }}