Skip to content

Commit 74dc885

Browse files
authored
Merge pull request #27 from victor-gp/check-bat-ci-compliance
Check `bat` CI compliance
2 parents 7d1529e + 575e3e3 commit 74dc885

File tree

2 files changed

+38
-0
lines changed

2 files changed

+38
-0
lines changed

.github/workflows/ci.yaml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,3 +55,13 @@ jobs:
5555
- uses: actions/checkout@v3
5656
- name: Run theme regression tests
5757
run: tests/theme_regression.sh
58+
59+
bat_ci_compliance:
60+
name: Bat CI Compliance
61+
continue-on-error: true
62+
runs-on: ubuntu-latest
63+
timeout-minutes: 10
64+
steps:
65+
- uses: actions/checkout@v3
66+
- name: Check bat CI compliance
67+
run: scripts/check_bat_ci_compliance.sh

scripts/check_bat_ci_compliance.sh

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
#!/usr/bin/env bash
2+
3+
theirs=https://raw.githubusercontent.com/sharkdp/bat/refs/heads/master/tests/syntax-tests/highlighted/cmd-help/test.cmd-help
4+
ours=tests/highlighted/bat-short-0.22.1.txt
5+
theirs_copy=/tmp/bat-regression-test.cmd-help
6+
ours_basename=$(basename $ours)
7+
8+
cd "$(dirname "${BASH_SOURCE[0]}")" || exit 9
9+
10+
# Fetch regression test from `bat`
11+
curl --location --output $theirs_copy $theirs &> /dev/null
12+
curl_exit_status=$?
13+
if [ $curl_exit_status -ne 0 ]; then
14+
echo "could not fetch the bat regression test, curl failed with code $curl_exit_status."
15+
exit 1
16+
fi
17+
18+
# check compliance with our regression test in bat CI
19+
if ! diff ../$ours $theirs_copy; then
20+
cat <<EOF
21+
::warning file=$ours,title=Would fail bat CI::\
22+
The highlight changes to $ours_basename would fail CI in the bat project. For more details, see: \
23+
https://github.com/victor-gp/cmd-help-sublime-syntax/wiki/How-to-manually-bump-cmd%E2%80%90help-version-in-bat%27s-submodules
24+
EOF
25+
exit 1
26+
else
27+
echo "ok: $ours matches the version for bat CI"
28+
fi

0 commit comments

Comments
 (0)