Reintroduce js-libp2p v0.45.0 and fix build from cache (#189)
* Add js-libp2p v0.45.0 * Name the image before creating browser images * Update commit sha to test webrtc * Enable webrtc & webrtc-direct tests
This commit is contained in:
parent
ba3f8cfc20
commit
06a82c0d95
|
@ -1 +1,4 @@
|
|||
*image.json
|
||||
js-libp2p-*.zip
|
||||
js-libp2p-*
|
||||
js-libp2p-*/*
|
||||
|
|
|
@ -0,0 +1,18 @@
|
|||
# syntax=docker/dockerfile:1
|
||||
|
||||
# Copied since we won't have the repo to use if expanding from cache.
|
||||
|
||||
# Workaround: https://github.com/docker/cli/issues/996
|
||||
ARG BASE_IMAGE=node-js-libp2p-head
|
||||
FROM ${BASE_IMAGE} as js-libp2p-base
|
||||
|
||||
FROM mcr.microsoft.com/playwright
|
||||
|
||||
|
||||
COPY --from=js-libp2p-base /app/ /app/
|
||||
WORKDIR /app/interop
|
||||
RUN ./node_modules/.bin/playwright install
|
||||
ARG BROWSER=chromium # Options: chromium, firefox, webkit
|
||||
ENV BROWSER=$BROWSER
|
||||
|
||||
ENTRYPOINT npm test -- --build false --types false -t browser -- --browser $BROWSER
|
|
@ -0,0 +1,11 @@
|
|||
# Here because we want to fetch the node_modules within docker so that it's
|
||||
# installed on the same platform the test is run. Otherwise tools like `esbuild` will fail to run
|
||||
FROM node:18
|
||||
WORKDIR /app
|
||||
COPY . .
|
||||
RUN npm i && npm run build
|
||||
|
||||
WORKDIR /app/interop
|
||||
RUN npm i && npm run build
|
||||
|
||||
ENTRYPOINT [ "npm", "test", "--", "--build", "false", "--types", "false", "-t", "node" ]
|
|
@ -0,0 +1,34 @@
|
|||
image_name := js-v0.45
|
||||
commitSha := 2165bc2a8388316f9a675f86fc08cfdd27c2a84d
|
||||
|
||||
# TODO Enable webkit once https://github.com/libp2p/js-libp2p/pull/1627 is in
|
||||
all: image.json chromium-image.json firefox-image.json
|
||||
|
||||
# Necessary because multistage builds require a docker image name rather than a digest to be used
|
||||
load-image-json: image.json
|
||||
docker image tag $$(jq -r .imageID image.json) ${image_name}
|
||||
|
||||
chromium-image.json: load-image-json BrowserDockerfile
|
||||
docker build -f BrowserDockerfile --build-arg=BASE_IMAGE=${image_name} --build-arg=BROWSER=chromium -t chromium-${image_name} .
|
||||
docker image inspect chromium-${image_name} -f "{{.Id}}" | \
|
||||
xargs -I {} echo "{\"imageID\": \"{}\"}" > $@
|
||||
|
||||
firefox-image.json: load-image-json BrowserDockerfile
|
||||
docker build -f BrowserDockerfile --build-arg=BASE_IMAGE=${image_name} --build-arg=BROWSER=firefox -t firefox-${image_name} .
|
||||
docker image inspect firefox-${image_name} -f "{{.Id}}" | \
|
||||
xargs -I {} echo "{\"imageID\": \"{}\"}" > $@
|
||||
|
||||
image.json: js-libp2p-${commitSha}
|
||||
cd js-libp2p-${commitSha} && docker build -t ${image_name} -f ../Dockerfile .
|
||||
docker image inspect ${image_name} -f "{{.Id}}" | \
|
||||
xargs -I {} echo "{\"imageID\": \"{}\"}" > $@
|
||||
|
||||
js-libp2p-${commitSha}:
|
||||
wget -O js-libp2p-${commitSha}.zip "https://github.com/libp2p/js-libp2p/archive/${commitSha}.zip"
|
||||
unzip -o js-libp2p-${commitSha}.zip
|
||||
unzip -o js-libp2p-${commitSha}.zip
|
||||
|
||||
clean:
|
||||
rm -rf image.json js-libp2p-*.zip js-libp2p-* *-image.json
|
||||
|
||||
.PHONY: all clean browser-images load-image-json
|
|
@ -11,10 +11,13 @@ import rustv051 from "./impl/rust/v0.51/image.json"
|
|||
import jsV041 from "./impl/js/v0.41/node-image.json"
|
||||
import jsV042 from "./impl/js/v0.42/node-image.json"
|
||||
import jsV044 from "./impl/js/v0.44/node-image.json"
|
||||
import jsV045 from "./impl/js/v0.45/image.json"
|
||||
import nimv10 from "./impl/nim/v1.0/image.json"
|
||||
import chromiumJsV041 from "./impl/js/v0.41/chromium-image.json"
|
||||
import chromiumJsV042 from "./impl/js/v0.42/chromium-image.json"
|
||||
import chromiumJsV044 from "./impl/js/v0.44/chromium-image.json"
|
||||
import chromiumJsV045 from "./impl/js/v0.45/chromium-image.json"
|
||||
import firefoxJsV045 from "./impl/js/v0.45/firefox-image.json"
|
||||
import zigv001 from "./impl/zig/v0.0.1/image.json"
|
||||
|
||||
export type Version = {
|
||||
|
@ -77,6 +80,13 @@ export const versions: Array<Version> = [
|
|||
secureChannels: ["noise"],
|
||||
muxers: ["mplex", "yamux"],
|
||||
},
|
||||
{
|
||||
id: "js-v0.45.0",
|
||||
containerImageID: jsV045.imageID,
|
||||
transports: ["tcp", "ws", { name: "wss", onlyDial: true }],
|
||||
secureChannels: ["noise"],
|
||||
muxers: ["mplex", "yamux"],
|
||||
},
|
||||
{
|
||||
id: "chromium-js-v0.41.0",
|
||||
containerImageID: chromiumJsV041.imageID,
|
||||
|
@ -98,6 +108,20 @@ export const versions: Array<Version> = [
|
|||
secureChannels: ["noise"],
|
||||
muxers: ["mplex", "yamux"],
|
||||
},
|
||||
{
|
||||
id: "chromium-js-v0.45.0",
|
||||
containerImageID: chromiumJsV045.imageID,
|
||||
transports: [{ name: "webtransport", onlyDial: true }, { name: "wss", onlyDial: true }, { name: "webrtc-direct", onlyDial: true }, "webrtc"],
|
||||
secureChannels: ["noise"],
|
||||
muxers: ["mplex", "yamux"],
|
||||
},
|
||||
{
|
||||
id: "firefox-js-v0.45.0",
|
||||
containerImageID: firefoxJsV045.imageID,
|
||||
transports: [{ name: "wss", onlyDial: true }, { name: "webrtc-direct", onlyDial: true }, "webrtc"],
|
||||
secureChannels: ["noise"],
|
||||
muxers: ["mplex", "yamux"],
|
||||
},
|
||||
{
|
||||
id: "go-v0.27.1",
|
||||
containerImageID: gov027.imageID,
|
||||
|
|
Loading…
Reference in New Issue