-
Notifications
You must be signed in to change notification settings - Fork 43
138 lines (119 loc) · 4.26 KB
/
regression-test.yml
File metadata and controls
138 lines (119 loc) · 4.26 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
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
name: Regression Tests
on:
push:
branches: [ master ]
pull_request:
branches: [ master ]
permissions:
pull-requests: write
jobs:
regression:
strategy:
fail-fast: false
matrix:
config:
- os: ubuntu-latest
cc: gcc
cxx: g++
core: virtualjaguar_libretro.so
platform: linux-x64
- os: ubuntu-24.04-arm
cc: gcc
cxx: g++
core: virtualjaguar_libretro.so
platform: linux-arm64
- os: macos-latest
cc: clang
cxx: clang++
core: virtualjaguar_libretro.dylib
platform: macos-arm64
name: regression-${{ matrix.config.platform }}
runs-on: ${{ matrix.config.os }}
steps:
- uses: actions/checkout@v4
- name: Install ImageMagick
run: |
if [ "$(uname -s)" = "Darwin" ]; then
brew install imagemagick
else
sudo apt-get update -qq && sudo apt-get install -y -qq imagemagick
fi
- name: Cache miniretro
id: cache-miniretro
uses: actions/cache@v4
with:
path: miniretro-bin
key: miniretro-${{ runner.os }}-${{ runner.arch }}-${{ hashFiles('.github/workflows/regression-test.yml') }}
- name: Build miniretro
if: steps.cache-miniretro.outputs.cache-hit != 'true'
run: |
git clone --depth 1 https://github.com/davidgfnet/miniretro.git /tmp/miniretro-src
LDFLAGS="-ldl"
if [ "$(uname -s)" = "Darwin" ]; then LDFLAGS=""; fi
${{ matrix.config.cxx }} -O2 -Wall -Wno-deprecated-declarations -Wno-unused-result \
-o miniretro-bin \
/tmp/miniretro-src/miniretro.cc \
/tmp/miniretro-src/util.cc \
/tmp/miniretro-src/loader.cc \
$LDFLAGS
- name: Build core
run: make -j4 CC=${{ matrix.config.cc }} CXX=${{ matrix.config.cxx }}
- name: Run regression tests
run: |
export MINIRETRO_BIN="$(pwd)/miniretro-bin"
export DIFF_DIR="$(pwd)/regression-diffs"
chmod +x "${MINIRETRO_BIN}"
./test/regression_test.sh ./${{ matrix.config.core }}
- name: Run SRAM interface tests
run: ./test/sram_test.sh ./${{ matrix.config.core }}
- name: Upload diff artifacts
if: failure()
uses: actions/upload-artifact@v4
with:
name: regression-diffs-${{ matrix.config.platform }}
path: regression-diffs/
if-no-files-found: ignore
- name: Comment on PR with results
if: always() && github.event_name == 'pull_request'
continue-on-error: true
uses: actions/github-script@v7
with:
script: |
const fs = require('fs');
const path = 'regression-diffs/summary.md';
if (!fs.existsSync(path)) return;
const summary = fs.readFileSync(path, 'utf8');
const platform = '${{ matrix.config.platform }}';
// Paginate to find existing comment even on busy PRs
const comments = await github.paginate(
github.rest.issues.listComments,
{
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: context.issue.number,
per_page: 100,
}
);
const marker = `<!-- regression-${platform} -->`;
const existing = comments.find(c => c.body.includes(marker));
const hasDiffs = fs.readdirSync('regression-diffs').some(f => f.endsWith('_diff.png'));
const body = `${marker}\n### Regression: \`${platform}\`\n\n${summary}\n\n` +
(hasDiffs
? `> :warning: Visual diffs uploaded as artifacts — download \`regression-diffs-${platform}\` to inspect.\n`
: '') +
`\n<sub>Updated by CI at ${new Date().toISOString()}</sub>`;
if (existing) {
await github.rest.issues.updateComment({
owner: context.repo.owner,
repo: context.repo.repo,
comment_id: existing.id,
body,
});
} else {
await github.rest.issues.createComment({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: context.issue.number,
body,
});
}