-
Notifications
You must be signed in to change notification settings - Fork 38
74 lines (69 loc) · 2.27 KB
/
Copy pathreplay.yml
File metadata and controls
74 lines (69 loc) · 2.27 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
name: Replay
permissions:
contents: read
on:
workflow_call:
inputs:
name:
description: 'Display name (if set, job shows only parse_mode)'
required: false
default: ''
type: string
repo_url:
description: 'Git repository URL to clone and test against'
required: false
default: ''
type: string
commits:
description: 'Commits to replay: number (e.g., 200), range (e.g., abc..def), or 0 for all'
required: true
type: string
workflow_dispatch:
inputs:
repo_url:
description: 'Git repository URL to clone and test against'
required: true
type: string
commits:
description: 'Commits to replay: number (e.g., 200), range (e.g., abc..def), or 0 for all'
required: true
default: '200'
type: string
env:
CARGO_INCREMENTAL: 0
CARGO_TERM_COLOR: always
CLICOLOR: 1
CI: 1
jobs:
replay:
runs-on: ubuntu-latest
strategy:
matrix:
parse_mode: [unidiff, gitdiff]
name: ${{ inputs.name && matrix.parse_mode || format('{0} ({1}, {2})', inputs.repo_url, matrix.parse_mode, inputs.commits) }}
steps:
- uses: actions/checkout@v6
with:
fetch-depth: ${{ inputs.repo_url && 1 || 0 }}
- if: inputs.repo_url != ''
env:
REPO_URL: ${{ inputs.repo_url }}
COMMITS: ${{ inputs.commits }}
run: |
set -euo pipefail
# Guard against non-numeric values when computing --depth.
# Range syntax (a..b) and "0" both require full history.
if [[ "$COMMITS" == *".."* || "$COMMITS" == "0" ]]; then
git clone "$REPO_URL" target/test-repo
elif [[ "$COMMITS" =~ ^[0-9]+$ ]]; then
git clone "$REPO_URL" --depth "$((COMMITS + 1))" target/test-repo
else
echo "invalid commits value: $COMMITS" >&2
exit 1
fi
- run: rustup toolchain install stable --profile minimal
- run: cargo test --release --test replay -F binary -- --ignored --nocapture
env:
DIFFY_TEST_REPO: ${{ inputs.repo_url == '' && '.' || 'target/test-repo' }}
DIFFY_TEST_COMMITS: ${{ inputs.commits }}
DIFFY_TEST_PARSE_MODE: ${{ matrix.parse_mode }}