-
Notifications
You must be signed in to change notification settings - Fork 0
130 lines (115 loc) · 4.17 KB
/
Copy pathcompatibility.yml
File metadata and controls
130 lines (115 loc) · 4.17 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
name: Runtime Compatibility
on:
schedule:
- cron: "0 0 * * 1"
workflow_dispatch:
permissions:
contents: read
jobs:
detect-changes:
name: Detect repository changes (last 7 days)
runs-on: ubuntu-latest
outputs:
has_changes: ${{ steps.diff.outputs.has_changes }}
steps:
- name: Checkout code
uses: actions/checkout@v7
with:
fetch-depth: 0
- id: diff
name: Check for recent changes
run: |
if [ "$(git rev-list --count --since='7 days ago' HEAD)" -gt 0 ]; then
echo "has_changes=true" >> "$GITHUB_OUTPUT"
else
echo "has_changes=false" >> "$GITHUB_OUTPUT"
fi
test-deno:
name: Test with Deno
needs: detect-changes
if: needs.detect-changes.outputs.has_changes == 'true'
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v7
- name: Setup Deno
uses: denoland/setup-deno@v2
with:
deno-version: 2.9.1
cache: true
- name: Run tests
run: |
deno task test:unit
deno task test:spec
test-nodejs:
name: Test with Node.js (JSR import)
needs: detect-changes
if: needs.detect-changes.outputs.has_changes == 'true'
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v7
- name: Setup Node.js
uses: actions/setup-node@v6
with:
node-version: 24.18
- name: Create test package
working-directory: /tmp
run: |
mkdir -p test-package
cd test-package
npm init -y
npx jsr add @anitrend/request-client
- name: Run Node.js compatibility test
working-directory: /tmp/test-package
run: |
cp ${{ github.workspace }}/examples/node-compatibility.mjs .
node node-compatibility.mjs
test-bun:
name: Test with Bun (JSR import)
needs: detect-changes
if: needs.detect-changes.outputs.has_changes == 'true'
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v7
- name: Setup Bun
uses: oven-sh/setup-bun@v2
with:
bun-version: 1.3
- name: Create test package
working-directory: /tmp
run: |
mkdir -p test-package
cd test-package
bun init -y
bunx jsr add @anitrend/request-client
- name: Run Bun compatibility test
working-directory: /tmp/test-package
run: |
cp ${{ github.workspace }}/examples/node-compatibility.mjs ./test.mjs
bun run test.mjs
summary:
name: Compatibility Summary
runs-on: ubuntu-latest
needs: [detect-changes, test-deno, test-nodejs, test-bun]
if: always()
steps:
- name: No changes — skipped heavy jobs
if: needs.detect-changes.outputs.has_changes != 'true'
run: |
echo "## Runtime Compatibility Test Results" >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY
echo "No repository changes in the last 7 days. Skipping compatibility tests." >> $GITHUB_STEP_SUMMARY
- name: Generate summary
if: needs.detect-changes.outputs.has_changes == 'true'
run: |
echo "## Runtime Compatibility Test Results" >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY
echo "| Runtime | Status |" >> $GITHUB_STEP_SUMMARY
echo "|---------|--------|" >> $GITHUB_STEP_SUMMARY
echo "| Deno | ${{ needs.test-deno.result == 'success' && '✅ Pass' || needs.test-deno.result == 'skipped' && '⏭️ Skipped' || '❌ Fail' }} |" >> $GITHUB_STEP_SUMMARY
echo "| Node.js | ${{ needs.test-nodejs.result == 'success' && '✅ Pass' || needs.test-nodejs.result == 'skipped' && '⏭️ Skipped' || '❌ Fail' }} |" >> $GITHUB_STEP_SUMMARY
echo "| Bun | ${{ needs.test-bun.result == 'success' && '✅ Pass' || needs.test-bun.result == 'skipped' && '⏭️ Skipped' || '❌ Fail' }} |" >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY
echo "**Note:** Node.js and Bun tests require the package to be published to JSR." >> $GITHUB_STEP_SUMMARY