Skip to content

Commit 42c1c09

Browse files
authored
chore: run examples and interop as part of main ci run (#1858)
Instead of installing deps for main, exmaples and multidim-interop, add examples and multidim interop to main.yml so we only install once and block releases if examples or interop fail.
1 parent 85a317b commit 42c1c09

File tree

8 files changed

+91
-122
lines changed

8 files changed

+91
-122
lines changed

.github/workflows/examples.yml

Lines changed: 0 additions & 65 deletions
This file was deleted.

.github/workflows/interop-test.yml

Lines changed: 0 additions & 35 deletions
This file was deleted.

.github/workflows/main.yml

Lines changed: 83 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,17 @@ on:
99

1010
jobs:
1111

12+
build:
13+
runs-on: ubuntu-latest
14+
steps:
15+
- uses: actions/checkout@v3
16+
- uses: actions/setup-node@v3
17+
with:
18+
node-version: lts/*
19+
- uses: ipfs/aegir/actions/cache-node-modules@master
20+
1221
check:
22+
needs: build
1323
runs-on: ubuntu-latest
1424
steps:
1525
- uses: actions/checkout@v3
@@ -21,12 +31,12 @@ jobs:
2131
- run: npm run --if-present dep-check
2232

2333
test-node:
24-
needs: check
34+
needs: build
2535
runs-on: ${{ matrix.os }}
2636
strategy:
2737
matrix:
2838
os: [windows-latest, ubuntu-latest, macos-latest]
29-
node: [16]
39+
node: [lts/*]
3040
fail-fast: true
3141
steps:
3242
- uses: actions/checkout@v3
@@ -41,7 +51,7 @@ jobs:
4151
flags: node
4252

4353
test-chrome:
44-
needs: check
54+
needs: build
4555
runs-on: ubuntu-latest
4656
steps:
4757
- uses: actions/checkout@v3
@@ -56,7 +66,7 @@ jobs:
5666
flags: chrome
5767

5868
test-chrome-webworker:
59-
needs: check
69+
needs: build
6070
runs-on: ubuntu-latest
6171
steps:
6272
- uses: actions/checkout@v3
@@ -71,7 +81,7 @@ jobs:
7181
flags: chrome-webworker
7282

7383
test-firefox:
74-
needs: check
84+
needs: build
7585
runs-on: ubuntu-latest
7686
steps:
7787
- uses: actions/checkout@v3
@@ -86,7 +96,7 @@ jobs:
8696
flags: firefox
8797

8898
test-firefox-webworker:
89-
needs: check
99+
needs: build
90100
runs-on: ubuntu-latest
91101
steps:
92102
- uses: actions/checkout@v3
@@ -101,7 +111,7 @@ jobs:
101111
flags: firefox-webworker
102112

103113
test-webkit:
104-
needs: check
114+
needs: build
105115
runs-on: ubuntu-latest
106116
steps:
107117
- uses: actions/checkout@v3
@@ -117,7 +127,7 @@ jobs:
117127
flags: webkit
118128

119129
test-electron-main:
120-
needs: check
130+
needs: build
121131
runs-on: ubuntu-latest
122132
steps:
123133
- uses: actions/checkout@v3
@@ -132,7 +142,7 @@ jobs:
132142
flags: electron-main
133143

134144
test-electron-renderer:
135-
needs: check
145+
needs: build
136146
runs-on: ubuntu-latest
137147
steps:
138148
- uses: actions/checkout@v3
@@ -147,7 +157,7 @@ jobs:
147157
flags: electron-renderer
148158

149159
test-interop:
150-
needs: check
160+
needs: build
151161
runs-on: ubuntu-latest
152162
steps:
153163
- uses: actions/checkout@v3
@@ -157,6 +167,66 @@ jobs:
157167
- uses: ipfs/aegir/actions/cache-node-modules@master
158168
- run: npm run test:interop -- --bail
159169

170+
test-example:
171+
needs: build
172+
runs-on: ubuntu-latest
173+
strategy:
174+
matrix:
175+
example: [
176+
chat,
177+
connection-encryption,
178+
discovery-mechanisms,
179+
echo,
180+
libp2p-in-the-browser,
181+
peer-and-content-routing,
182+
pnet,
183+
protocol-and-stream-muxing,
184+
pubsub,
185+
transports
186+
]
187+
fail-fast: true
188+
steps:
189+
- uses: actions/checkout@v3
190+
- uses: actions/setup-node@v3
191+
with:
192+
node-version: lts/*
193+
- uses: ipfs/aegir/actions/cache-node-modules@master
194+
with:
195+
directories: |
196+
./examples/node_modules
197+
~/.cache
198+
build: |
199+
cd examples
200+
npm i
201+
npx playwright install
202+
cache_name: cache-examples
203+
- run: |
204+
cd examples
205+
npm run test -- ${{ matrix.example }}
206+
207+
multidim-interop:
208+
needs: build
209+
runs-on: ubuntu-latest
210+
steps:
211+
- uses: actions/checkout@v3
212+
- uses: ipfs/aegir/actions/cache-node-modules@master
213+
- name: Build images
214+
run: (cd interop && make)
215+
- name: Save package-lock.json as artifact
216+
uses: actions/upload-artifact@v2
217+
with:
218+
name: package locks
219+
path: |
220+
package-lock.json
221+
interop/package-lock.json
222+
- uses: libp2p/test-plans/.github/actions/run-interop-ping-test@master
223+
with:
224+
test-filter: js-libp2p-head
225+
extra-versions: ${{ github.workspace }}/interop/node-version.json ${{ github.workspace }}/interop/chromium-version.json ${{ github.workspace }}/interop/firefox-version.json
226+
s3-cache-bucket: ${{ vars.S3_LIBP2P_BUILD_CACHE_BUCKET_NAME }}
227+
s3-access-key-id: ${{ vars.S3_LIBP2P_BUILD_CACHE_AWS_ACCESS_KEY_ID }}
228+
s3-secret-access-key: ${{ secrets.S3_LIBP2P_BUILD_CACHE_AWS_SECRET_ACCESS_KEY }}
229+
160230
release:
161231
runs-on: ubuntu-latest
162232
needs: [
@@ -167,7 +237,9 @@ jobs:
167237
test-firefox-webworker,
168238
test-electron-main,
169239
test-electron-renderer,
170-
test-interop
240+
test-interop,
241+
test-example,
242+
multidim-interop
171243
]
172244
if: github.event_name == 'push' && github.ref == 'refs/heads/master'
173245
steps:

interop/BrowserDockerfile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@ FROM mcr.microsoft.com/playwright
44

55
COPY --from=node-js-libp2p-head /app/ /app/
66
WORKDIR /app/interop
7-
RUN ./node_modules/.bin/playwright install
7+
RUN npx playwright install
88
ARG BROWSER=chromium # Options: chromium, firefox, webkit
99
ENV BROWSER=$BROWSER
1010

11-
ENTRYPOINT npm test -- --build false --types false -t browser -- --browser $BROWSER
11+
ENTRYPOINT npm run test:interop:multidim -- --build false --types false -t browser -- --browser $BROWSER

interop/Dockerfile

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,8 @@ WORKDIR /app
44
COPY package.json .
55
COPY ./node_modules ./node_modules
66
COPY ./packages ./packages
7+
COPY ./interop ./interop
78

89
WORKDIR /app/interop
9-
COPY ./interop/node_modules ./node_modules
10-
COPY ./interop/dist ./dist
11-
COPY ./interop/package.json .
12-
COPY ./interop/.aegir.js .
13-
COPY ./interop/relay.js .
1410

15-
ENTRYPOINT [ "npm", "test", "--", "--build", "false", "--types", "false", "-t", "node" ]
11+
ENTRYPOINT [ "npm", "run", "test:interop:multidim", "--", "--build", "false", "--types", "false", "-t", "node" ]

interop/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
"scripts": {
1111
"start": "node index.js",
1212
"build": "aegir build",
13-
"test": "aegir test"
13+
"test:interop:multidim": "aegir test"
1414
},
1515
"dependencies": {
1616
"@chainsafe/libp2p-noise": "^12.0.0",

package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@
4545
]
4646
},
4747
"workspaces": [
48-
"packages/*"
48+
"packages/*",
49+
"interop"
4950
]
5051
}

packages/crypto/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@
8383
"test:chrome-webworker": "aegir test -t webworker",
8484
"test:firefox": "aegir test -t browser -- --browser firefox",
8585
"test:firefox-webworker": "aegir test -t webworker -- --browser firefox",
86-
"test:webkit": "bash -c '[ \"${CI}\" == \"true\" ] && playwright install-deps'; aegir test -t browser -- --browser webkit",
86+
"test:webkit": "aegir test -t browser -- --browser webkit",
8787
"test:node": "aegir test -t node --cov",
8888
"test:electron-main": "aegir test -t electron-main",
8989
"generate": "protons ./src/keys/keys.proto"

0 commit comments

Comments
 (0)