refactor(ci): add caching to ipfs-webui interop tests (#11173)
* ci: add caching to ipfs-webui interop tests cache node_modules, Playwright browsers, and test build output to speed up repeated CI runs. also use node version from ipfs-webui/.tool-versions instead of hardcoding, and upload test artifacts on failure. * docs(ci): add header comment to interop workflow explain what helia-interop and ipfs-webui jobs do
Marcin Rataj committed
Jan 29, 2026 at 02:56 UTC
ef99e0a0f70b97b713e6e1debf1d3d30806eb92e
1 file changed
+70
-22
.github/workflows/interop.yml
+70
-22
@@ -1,3 +1,17 @@
1
+# Interoperability Tests
2
+#
3
+# This workflow ensures Kubo remains compatible with the broader IPFS ecosystem.
4
+# It builds Kubo from source, then runs:
5
+#
6
+# 1. helia-interop: Tests compatibility with Helia (JavaScript IPFS implementation)
7
+# using Playwright-based tests from @helia/interop package.
8
+#
9
+# 2. ipfs-webui: Runs E2E tests from ipfs/ipfs-webui repository to verify
10
+# the web interface works correctly with the locally built Kubo binary.
11
+#
12
+# Both jobs use caching to speed up repeated runs (npm dependencies, Playwright
13
+# browsers, and webui build artifacts).
14
+
15
name: Interop
16
17
on:
@@ -84,9 +98,6 @@ jobs:
98
run:
99
shell: bash
100
steps:
87
- - uses: actions/setup-node@v6
88
- with:
89
- node-version: 20.x
101
- uses: actions/download-artifact@v7
102
with:
103
name: kubo
@@ -96,36 +107,73 @@ jobs:
107
with:
108
repository: ipfs/ipfs-webui
109
path: ipfs-webui
99
- - run: |
100
- echo "dir=$(npm config get cache)" >> $GITHUB_OUTPUT
101
- id: npm-cache-dir
102
- - uses: actions/cache@v5
110
+ - uses: actions/setup-node@v6
111
with:
104
- path: ${{ steps.npm-cache-dir.outputs.dir }}
105
- key: ${{ runner.os }}-${{ github.job }}-${{ hashFiles('**/package-lock.json') }}
106
- restore-keys: |
107
- ${{ runner.os }}-${{ github.job }}-
108
- - env:
109
- NPM_CACHE_DIR: ${{ steps.npm-cache-dir.outputs.dir }}
110
- run: |
111
- npm ci --prefer-offline --no-audit --progress=false --cache "$NPM_CACHE_DIR"
112
- npx playwright install --with-deps
113
- working-directory: ipfs-webui
114
- - id: ref
112
+ node-version-file: 'ipfs-webui/.tool-versions'
113
+ - id: webui-ref
114
run: echo "ref=$(git rev-parse --short HEAD)" | tee -a $GITHUB_OUTPUT
115
working-directory: ipfs-webui
117
- - id: state
116
+ - id: webui-state
117
env:
118
GITHUB_TOKEN: ${{ github.token }}
120
- ENDPOINT: repos/ipfs/ipfs-webui/commits/${{ steps.ref.outputs.ref }}/status
119
+ ENDPOINT: repos/ipfs/ipfs-webui/commits/${{ steps.webui-ref.outputs.ref }}/status
120
SELECTOR: .state
121
KEY: state
122
run: gh api "$ENDPOINT" --jq "$SELECTOR" | xargs -I{} echo "$KEY={}" | tee -a $GITHUB_OUTPUT
124
- - name: Build ipfs-webui@main (state=${{ steps.state.outputs.state }})
123
+ # Cache node_modules based on package-lock.json
124
+ - name: Cache node_modules
125
+ uses: actions/cache@v5
126
+ id: node-modules-cache
127
+ with:
128
+ path: ipfs-webui/node_modules
129
+ key: ${{ runner.os }}-webui-node-modules-${{ hashFiles('ipfs-webui/package-lock.json') }}
130
+ restore-keys: |
131
+ ${{ runner.os }}-webui-node-modules-
132
+ - name: Install dependencies
133
+ if: steps.node-modules-cache.outputs.cache-hit != 'true'
134
+ run: npm ci --prefer-offline --no-audit --progress=false
135
+ working-directory: ipfs-webui
136
+ # Cache Playwright browsers
137
+ - name: Cache Playwright browsers
138
+ uses: actions/cache@v5
139
+ id: playwright-cache
140
+ with:
141
+ path: ~/.cache/ms-playwright
142
+ key: ${{ runner.os }}-playwright-${{ hashFiles('ipfs-webui/package-lock.json') }}
143
+ restore-keys: |
144
+ ${{ runner.os }}-playwright-
145
+ # On cache miss: download browsers and install OS dependencies
146
+ - name: Install Playwright with dependencies
147
+ if: steps.playwright-cache.outputs.cache-hit != 'true'
148
+ run: npx playwright install --with-deps
149
+ working-directory: ipfs-webui
150
+ # On cache hit: only ensure OS dependencies are present (fast, idempotent)
151
+ - name: Install Playwright OS dependencies
152
+ if: steps.playwright-cache.outputs.cache-hit == 'true'
153
+ run: npx playwright install-deps
154
+ working-directory: ipfs-webui
155
+ # Cache test build output
156
+ - name: Cache test build
157
+ uses: actions/cache@v5
158
+ id: test-build-cache
159
+ with:
160
+ path: ipfs-webui/build
161
+ key: ${{ runner.os }}-webui-build-${{ hashFiles('ipfs-webui/package-lock.json', 'ipfs-webui/src/**', 'ipfs-webui/public/**') }}
162
+ restore-keys: |
163
+ ${{ runner.os }}-webui-build-
164
+ - name: Build ipfs-webui@${{ steps.webui-ref.outputs.ref }} (state=${{ steps.webui-state.outputs.state }})
165
+ if: steps.test-build-cache.outputs.cache-hit != 'true'
166
run: npm run test:build
167
working-directory: ipfs-webui
127
- - name: Test ipfs-webui@main (state=${{ steps.state.outputs.state }}) E2E against the locally built Kubo binary
168
+ - name: Test ipfs-webui@${{ steps.webui-ref.outputs.ref }} (state=${{ steps.webui-state.outputs.state }}) E2E against the locally built Kubo binary
169
run: npm run test:e2e
170
env:
171
IPFS_GO_EXEC: ${{ github.workspace }}/cmd/ipfs/ipfs
172
working-directory: ipfs-webui
173
+ - name: Upload test artifacts on failure
174
+ if: failure()
175
+ uses: actions/upload-artifact@v6
176
+ with:
177
+ name: webui-test-results
178
+ path: ipfs-webui/test-results/
179
+ retention-days: 7