Skip to content

Commit 0e07aea

Browse files
committed
👷 add compatibility check step for C# and Node.js outputs in GitHub Actions
1 parent e4699c0 commit 0e07aea

File tree

1 file changed

+46
-1
lines changed

1 file changed

+46
-1
lines changed

.github/workflows/test.yml

Lines changed: 46 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,10 +87,55 @@ jobs:
8787
if-no-files-found: error
8888
overwrite: true
8989
retention-days: 7
90+
ensure_compatibility:
91+
name: Ensure compatibility with qs (JS vs C#)
92+
needs: lint
93+
runs-on: ubuntu-latest
94+
95+
steps:
96+
- name: Checkout
97+
uses: actions/checkout@v4
98+
- name: Setup Node.js
99+
uses: actions/setup-node@v4
100+
with:
101+
node-version: '20'
102+
- name: Setup .NET
103+
uses: actions/setup-dotnet@v4
104+
with:
105+
dotnet-version: '8.0.x'
106+
- name: Install JS dependencies
107+
run: npm install
108+
working-directory: QsNet.Comparison/js
109+
- name: Run C# comparison
110+
run: dotnet run --project QsNet.Comparison -c Release > cs.out
111+
- name: Run Node comparison
112+
run: node QsNet.Comparison/js/qs.js > node.out
113+
- name: Show first lines (debug)
114+
if: ${{ always() }}
115+
run: |
116+
echo "=== C# (first 80 lines) ==="
117+
head -n 80 cs.out || true
118+
echo "=== Node (first 80 lines) ==="
119+
head -n 80 node.out || true
120+
- name: Diff outputs
121+
run: |
122+
set -eo pipefail
123+
diff -u node.out cs.out > diff.out || (echo "::error::Differences found between Node and C# outputs. See artifact diff.out"; exit 1)
124+
- name: Upload diff artifacts on failure
125+
if: failure()
126+
uses: actions/upload-artifact@v4
127+
with:
128+
name: comparison-diff
129+
path: |
130+
node.out
131+
cs.out
132+
diff.out
90133
coverage:
91134
name: Coverage (merged)
92135
runs-on: ubuntu-latest
93-
needs: test
136+
needs:
137+
- test
138+
- ensure_compatibility
94139
steps:
95140
- uses: actions/checkout@v4
96141
- name: Setup .NET 8 SDK

0 commit comments

Comments
 (0)