]> 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:

makes install available for all users in docker image (#3202)
[etc/vim.git] / .github / workflows / diff_shades.yml
1 name: diff-shades
2
3 on:
4   push:
5     branches: [main]
6     paths: ["src/**", "setup.*", "pyproject.toml", ".github/workflows/*"]
7
8   pull_request:
9     paths: ["src/**", "setup.*", "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       # Clang is less picky with the C code it's given than gcc (and may
45       # generate faster binaries too).
46       CC: clang-12
47     strategy:
48       fail-fast: false
49       matrix:
50         include: ${{ fromJson(needs.configure.outputs.matrix )}}
51
52     steps:
53       - name: Checkout this repository (full clone)
54         uses: actions/checkout@v3
55         with:
56           # The baseline revision could be rather old so a full clone is ideal.
57           fetch-depth: 0
58
59       - uses: actions/setup-python@v4
60         with:
61           python-version: "*"
62
63       - name: Install diff-shades and support dependencies
64         run: |
65           python -m pip install https://github.com/ichard26/diff-shades/archive/stable.zip
66           python -m pip install click packaging urllib3
67           python -m pip install -r .github/mypyc-requirements.txt
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 setup.py --use-mypyc bdist_wheel
87           && python -m pip install dist/*.whl && rm build dist -r
88
89       - name: Analyze baseline revision
90         if: steps.baseline-cache.outputs.cache-hit != 'true'
91         run: >
92           diff-shades analyze -v --work-dir projects-cache/
93           ${{ matrix.baseline-analysis }} ${{ matrix.force-flag }}
94
95       - name: Build and install target revision
96         env:
97           GITHUB_TOKEN: ${{ github.token }}
98         run: >
99           ${{ matrix.target-setup-cmd }}
100           && python setup.py --use-mypyc bdist_wheel
101           && python -m pip install dist/*.whl
102
103       - name: Analyze target revision
104         run: >
105           diff-shades analyze -v --work-dir projects-cache/
106           ${{ matrix.target-analysis }} --repeat-projects-from
107           ${{ matrix.baseline-analysis }} ${{ matrix.force-flag }}
108
109       - name: Generate HTML diff report
110         run: >
111           diff-shades --dump-html diff.html compare --diff
112           ${{ matrix.baseline-analysis }} ${{ matrix.target-analysis }}
113
114       - name: Upload diff report
115         uses: actions/upload-artifact@v3
116         with:
117           name: ${{ matrix.mode }}-diff.html
118           path: diff.html
119
120       - name: Upload baseline analysis
121         uses: actions/upload-artifact@v3
122         with:
123           name: ${{ matrix.baseline-analysis }}
124           path: ${{ matrix.baseline-analysis }}
125
126       - name: Upload target analysis
127         uses: actions/upload-artifact@v3
128         with:
129           name: ${{ matrix.target-analysis }}
130           path: ${{ matrix.target-analysis }}
131
132       - name: Generate summary file (PR only)
133         if: github.event_name == 'pull_request' && matrix.mode == 'preview-changes'
134         run: >
135           python helper.py comment-body
136           ${{ matrix.baseline-analysis }} ${{ matrix.target-analysis }}
137           ${{ matrix.baseline-sha }} ${{ matrix.target-sha }}
138           ${{ github.event.pull_request.number }}
139
140       - name: Upload summary file (PR only)
141         if: github.event_name == 'pull_request' && matrix.mode == 'preview-changes'
142         uses: actions/upload-artifact@v3
143         with:
144           name: .pr-comment.json
145           path: .pr-comment.json
146
147       - name: Verify zero changes (PR only)
148         if: matrix.mode == 'assert-no-changes'
149         run: >
150           diff-shades compare --check ${{ matrix.baseline-analysis }} ${{ matrix.target-analysis }}
151           || (echo "Please verify you didn't change the stable code style unintentionally!" && exit 1)
152
153       - name: Check for failed files for target revision
154         # Even if the previous step failed, we should still check for failed files.
155         if: always()
156         run: >
157           diff-shades show-failed --check --show-log ${{ matrix.target-analysis }}
158           --check-allow 'sqlalchemy:test/orm/test_relationship_criteria.py'