Skip to content

Commit

Permalink
chore: macOS/ARM64 build compatibility (#1829)
Browse files Browse the repository at this point in the history
  • Loading branch information
ggrossetie authored Feb 15, 2025
1 parent 9688aba commit d12ac6e
Show file tree
Hide file tree
Showing 19 changed files with 618 additions and 684 deletions.
3 changes: 3 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,6 @@ indent_size = 2
[Makefile]
indent_style = tab
indent_size = 4

[*.mmd]
trim_trailing_whitespace=false
54 changes: 0 additions & 54 deletions Makefile

This file was deleted.

2 changes: 1 addition & 1 deletion bpmn/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,6 @@
"standard": "17.1.2"
},
"volta": {
"node": "20.18.0"
"node": "22.14.0"
}
}
2 changes: 1 addition & 1 deletion bytefield/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,6 @@
"standard": "17.1.2"
},
"volta": {
"node": "20.18.0"
"node": "22.14.0"
}
}
3 changes: 3 additions & 0 deletions ci/tests/diagrams/empty-message.mmd
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
sequenceDiagram
Alice->>John: Hello
John-->>Alice:
6 changes: 5 additions & 1 deletion ci/tests/smoke.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ const tests = [
{ engine: 'symbolator', file: 'component.sv', options: {}, outputFormat: ['svg', 'png'] },
{ engine: 'erd', file: 'schema.erd', options: {}, outputFormat: ['svg'] },
{ engine: 'mermaid', file: 'contribute.mmd', options: {}, outputFormat: ['svg'] },
{ engine: 'mermaid', file: 'empty-message.mmd', options: {}, outputFormat: ['svg'] },
{ engine: 'bpmn', file: 'example.bpmn', options: {}, outputFormat: ['svg'] },
{ engine: 'plantuml', file: 'architecture.puml', options: {}, outputFormat: ['svg', 'pdf', 'png', 'txt'] },
{ engine: 'plantuml', file: 'architecture.puml', options: { 'no-metadata': 'true' }, outputFormat: ['svg', 'png'] },
Expand Down Expand Up @@ -91,7 +92,10 @@ describe('Diagrams', function () {
deepEqual(response.status, 200, `status code must be 200 but was: ${response.status}`)
} catch (err) {
const textResponse = await response.text()
console.log('response:', textResponse)
const textResponseOutput = outputFormat !== 'svg'
? textResponse.substring(0, 50) + '[truncated...]'
: textResponse
console.log('response:', textResponseOutput)
throw err
}
})
Expand Down
2 changes: 1 addition & 1 deletion dbml/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,6 @@
"standard": "17.1.2"
},
"volta": {
"node": "20.18.0"
"node": "22.14.0"
}
}
2 changes: 1 addition & 1 deletion diagrams.net/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,6 @@
"standard": "17.1.2"
},
"volta": {
"node": "20.18.0"
"node": "22.14.0"
}
}
7 changes: 4 additions & 3 deletions excalidraw/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion excalidraw/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,6 @@
"standard": "17.1.2"
},
"volta": {
"node": "20.18.0"
"node": "22.14.0"
}
}
2 changes: 1 addition & 1 deletion mermaid/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,6 @@
"standard": "17.1.2"
},
"volta": {
"node": "20.18.0"
"node": "22.14.0"
}
}
15 changes: 15 additions & 0 deletions mermaid/test/convert-test.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,21 @@ describe('#convert', function () {
})
})

it(`should accept sequence diagram with an empty message`, async function () {
const browser = await getBrowser()
try {
const worker = new Worker(browser)
const source = `sequenceDiagram
Alice->>John: Hello
John-->>Alice:
`
const result = await worker.convert(new Task(source))
deepEqual(result.includes('<tspan dy="0" x="75">Alice</tspan>'), true, `output must include Alice but was: ${result}`)
} finally {
await browser.close()
}
})

pngTests.forEach((testCase) => {
it(`should return a PNG for type ${testCase.type} with height=${testCase.height}, width=${testCase.width}`, async function () {
const browser = await getBrowser()
Expand Down
2 changes: 1 addition & 1 deletion nomnoml/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,6 @@
"standard": "17.1.2"
},
"volta": {
"node": "20.18.0"
"node": "22.14.0"
}
}
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,15 @@
"description": "Utility scripts for continuous integration",
"type": "module",
"engines": {
"node": ">=20"
"node": ">=22"
},
"private": true,
"scripts": {
"test": "node --test-force-exit ci/tests/smoke.js",
"update-versions": "node ci/tasks/update-versions.js"
},
"volta": {
"node": "20.18.0"
"node": "22.14.0"
},
"dependencies": {
"blocked-at": "^1.2.0"
Expand Down
52 changes: 34 additions & 18 deletions server/ops/docker/jdk17-noble/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
# syntax=docker/dockerfile:1.13

## Nomnoml
FROM --platform=$BUILDPLATFORM node:20.18-bullseye-slim AS kroki-builder-nomnoml
FROM --platform=$BUILDPLATFORM node:22.14-bookworm-slim AS kroki-builder-nomnoml

RUN npm install -g @yao-pkg/[email protected] @yao-pkg/[email protected].16
RUN npm install -g @yao-pkg/[email protected] @yao-pkg/[email protected].20

ARG TARGETARCH
ARG TARGETOS
ENV NODE node20
ENV NODE=node22
RUN /usr/local/bin/pkg-fetch -n $NODE -p $TARGETOS -a $([ "$TARGETARCH" = "amd64" ] && echo "x64" || echo "$TARGETARCH")

COPY --from=nomnoml index.js package.json package-lock.json /app/
Expand All @@ -17,11 +17,14 @@ RUN npm install --target_arch=$([ "$TARGETARCH" = "amd64" ] && echo "x64" || ech
RUN /usr/local/bin/pkg --targets $NODE-$TARGETOS-$([ "$TARGETARCH" = "amd64" ] && echo "x64" || echo "$TARGETARCH") . -o app.bin

## Vega
FROM --platform=$BUILDPLATFORM node:20.18-bullseye-slim AS kroki-builder-vega
FROM --platform=$BUILDPLATFORM ubuntu:noble AS kroki-builder-vega

# System dependencies for "canvas" Node package
# https://github.com/Automattic/node-canvas#compiling
RUN apt-get update && apt-get install --no-install-recommends --yes \
curl \
ca-certificates \
unzip \
build-essential \
libcairo2-dev \
libgif-dev \
Expand All @@ -30,29 +33,34 @@ RUN apt-get update && apt-get install --no-install-recommends --yes \
librsvg2-dev && \
apt-get clean && apt-get autoremove

RUN npm install -g @yao-pkg/[email protected] @yao-pkg/[email protected]
RUN curl -o- https://fnm.vercel.app/install | bash && \
/root/.local/share/fnm/fnm install 22.14.0

ENV PATH="$PATH:/root/.local/share/fnm/node-versions/v22.14.0/installation/bin"

RUN npm install -g @yao-pkg/[email protected] @yao-pkg/[email protected]

ARG TARGETARCH
ARG TARGETOS
ENV NODE node20
RUN /usr/local/bin/pkg-fetch -n $NODE -p $TARGETOS -a $([ "$TARGETARCH" = "amd64" ] && echo "x64" || echo "$TARGETARCH")
ENV NODE=node22
RUN pkg-fetch -n $NODE -p $TARGETOS -a $([ "$TARGETARCH" = "amd64" ] && echo "x64" || echo "$TARGETARCH")

COPY --from=vega src /app/src
COPY --from=vega tests /app/tests
COPY --from=vega package.json package-lock.json /app/
WORKDIR /app

RUN npm install --target_arch=$([ "$TARGETARCH" = "amd64" ] && echo "x64" || echo "$TARGETARCH") --target_platform=$TARGETOS && npm run lint && npm t
RUN /usr/local/bin/pkg --targets $NODE-$TARGETOS-$([ "$TARGETARCH" = "amd64" ] && echo "x64" || echo "$TARGETARCH") . -o app.bin
RUN pkg --targets $NODE-$TARGETOS-$([ "$TARGETARCH" = "amd64" ] && echo "x64" || echo "$TARGETARCH") . -o app.bin

## DBML
FROM --platform=$BUILDPLATFORM node:20.18-bullseye-slim AS kroki-builder-dbml
FROM --platform=$BUILDPLATFORM node:22.14-bookworm-slim AS kroki-builder-dbml

RUN npm install -g @yao-pkg/[email protected] @yao-pkg/[email protected].16
RUN npm install -g @yao-pkg/[email protected] @yao-pkg/[email protected].20

ARG TARGETARCH
ARG TARGETOS
ENV NODE node20
ENV NODE=node22
RUN /usr/local/bin/pkg-fetch -n $NODE -p $TARGETOS -a $([ "$TARGETARCH" = "amd64" ] && echo "x64" || echo "$TARGETARCH")

COPY --from=dbml index.js package.json package-lock.json /app/
Expand All @@ -62,13 +70,13 @@ RUN npm install --target_arch=$([ "$TARGETARCH" = "amd64" ] && echo "x64" || ech
RUN /usr/local/bin/pkg --targets $NODE-$TARGETOS-$([ "$TARGETARCH" = "amd64" ] && echo "x64" || echo "$TARGETARCH") . -o app.bin

## Wavedrom
FROM --platform=$BUILDPLATFORM node:20.18-bullseye-slim AS kroki-builder-wavedrom
FROM --platform=$BUILDPLATFORM node:22.14-bookworm-slim AS kroki-builder-wavedrom

RUN npm install -g @yao-pkg/[email protected] @yao-pkg/[email protected].16
RUN npm install -g @yao-pkg/[email protected] @yao-pkg/[email protected].20

ARG TARGETARCH
ARG TARGETOS
ENV NODE node20
ENV NODE=node22
RUN /usr/local/bin/pkg-fetch -n $NODE -p $TARGETOS -a $([ "$TARGETARCH" = "amd64" ] && echo "x64" || echo "$TARGETARCH")

COPY --from=wavedrom index.js package.json package-lock.json /app/
Expand All @@ -78,13 +86,13 @@ RUN npm install --target_arch=$([ "$TARGETARCH" = "amd64" ] && echo "x64" || ech
RUN /usr/local/bin/pkg --targets $NODE-$TARGETOS-$([ "$TARGETARCH" = "amd64" ] && echo "x64" || echo "$TARGETARCH") . -o app.bin

## Bytefield
FROM --platform=$BUILDPLATFORM node:20.18-bullseye-slim AS kroki-builder-bytefield
FROM --platform=$BUILDPLATFORM node:22.14-bookworm-slim AS kroki-builder-bytefield

RUN npm install -g @yao-pkg/[email protected] @yao-pkg/[email protected].16
RUN npm install -g @yao-pkg/[email protected] @yao-pkg/[email protected].20

ARG TARGETARCH
ARG TARGETOS
ENV NODE node20
ENV NODE=node22
RUN /usr/local/bin/pkg-fetch -n $NODE -p $TARGETOS -a $([ "$TARGETARCH" = "amd64" ] && echo "x64" || echo "$TARGETARCH")

COPY --from=bytefield index.js package.json package-lock.json /app/
Expand Down Expand Up @@ -168,7 +176,7 @@ RUN SVGBOB_VERSION=`cat Cargo.toml | grep "svgbob_cli =" | sed -r 's/.*"([^"]+)"
FROM ghcr.io/yuzutech/erd:v0.2.3 AS erd

## yuzutech/kroki
FROM eclipse-temurin:17.0.12_7-jre-noble
FROM eclipse-temurin:17.0.14_7-jre-noble

ARG BLOCKDIAG_VERSION="3.1.0"
ARG D2_VERSION="0.6.3"
Expand All @@ -195,14 +203,20 @@ RUN apt-get update && apt-get install --no-install-recommends --yes \
# * texlive-science - Provides various science packages like "siunitx"
RUN apt-get update && apt-get install --no-install-recommends --yes \
dvisvgm=$DVISVGM_VERSION \
libpango1.0-dev \
librsvg2-dev \
fonts-freefont-ttf \
fonts-liberation \
fonts-noto-cjk \
ghostscript \
giflib-tools \
gsfonts \
libnuma1 \
libgd3 \
libgif-dev \
libjpeg-dev \
libgirepository-1.0 \
libcairo2-dev \
libcairo-gobject2 \
libjpeg9 \
libpango-1.0-0 \
Expand Down Expand Up @@ -272,6 +286,8 @@ ENV JAVA_OPTS="-Dlogback.configurationFile=/etc/kroki/logback.xml -Dvertx.logger

COPY --chown=kroki:kroki target/kroki-server.jar /usr/local/kroki/kroki-server.jar

RUN mkdir /tmp/vertx-cache && chown kroki:kroki /tmp/vertx-cache

EXPOSE 8000

USER kroki
Expand Down
14 changes: 14 additions & 0 deletions server/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
<structurizr-export.version>3.0.0</structurizr-export.version>
<structurizr-core.version>3.0.0</structurizr-core.version>
<caffeine.version>3.2.0</caffeine.version>
<bouncycastle.version>1.80</bouncycastle.version>
</properties>

<dependencies>
Expand Down Expand Up @@ -182,6 +183,19 @@
<version>${vertx.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.bouncycastle</groupId>
<artifactId>bcprov-jdk18on</artifactId>
<version>${bouncycastle.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.bouncycastle</groupId>
<artifactId>bcpkix-jdk18on</artifactId>
<version>${bouncycastle.version}</version>
<scope>test</scope>
</dependency>

</dependencies>
<build>
<resources>
Expand Down
Loading

0 comments on commit d12ac6e

Please sign in to comment.