Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: update ci #860

Merged
merged 10 commits into from
Apr 12, 2024
Merged
Show file tree
Hide file tree
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/bundlewatch.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ jobs:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: 18.x
node-version: 20.x

- name: Update npm
run: npm i -g npm@7
Expand Down
10 changes: 8 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [18.x, 20.x]
node-version: [18.x, 20.x, 21.x]
react: [16, 17, 18]
steps:
- uses: actions/checkout@v3

Expand All @@ -22,6 +23,10 @@ jobs:
- name: Install dependencies
run: npm ci

- name: Install React <18 deps
if: matrix.react == '16' || matrix.react == '17'
run: npm i react@${{ matrix.react }} react-dom@${{ matrix.react }} @testing-library/react@12 --legacy-peer-deps

- name: Run tests
run: npm test

Expand All @@ -31,7 +36,8 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [18.x, 20.x]
node-version: [20.x]
react: [18]

steps:
- uses: actions/checkout@v3
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,10 @@ jobs:
- name: Setup node
uses: actions/setup-node@v3
with:
node-version: 18
node-version: 20

- name: Update npm
run: npm i -g npm@7
run: npm i -g npm@10
erunion marked this conversation as resolved.
Show resolved Hide resolved

- name: Install dependencies
run: |
Expand Down
24 changes: 9 additions & 15 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,30 +1,24 @@
ARG NODE_VERSION=20
FROM node:${NODE_VERSION}-bookworm
ARG NODE_VERSION=18
FROM node:${NODE_VERSION}-alpine3.18

ARG NODE_VERSION
ENV NODE_VERSION=$NODE_VERSION

ENV PUPPETEER_SKIP_CHROMIUM_DOWNLOAD true
ENV PUPPETEER_EXECUTABLE_PATH=/usr/bin/google-chrome-stable

RUN apt-get update && apt-get install -y \
curl \
gnupg \
fonts-noto-color-emoji \
&& curl --location --silent https://dl-ssl.google.com/linux/linux_signing_key.pub | apt-key add - \
&& sh -c 'echo "deb [arch=amd64] http://dl.google.com/linux/chrome/deb/ stable main" >> /etc/apt/sources.list.d/google.list' \
&& apt-get update \
&& apt-get install google-chrome-stable -y --no-install-recommends \
&& rm -rf /var/lib/apt/lists/*
ENV PUPPETEER_EXECUTABLE_PATH /usr/bin/chromium-browser

RUN apk update && apk add \
make \
font-noto-emoji \
font-roboto \
chromium

RUN npm install -g npm@latest

ENV DOCKER_WORKSPACE=/markdown
WORKDIR ${DOCKER_WORKSPACE}

COPY package.json package-lock.json ./

RUN npm config set registry https://registry.npmjs.org/
RUN npm install

COPY . ./
Expand Down
40 changes: 40 additions & 0 deletions Dockerfile.legacy
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
ARG NODE_VERSION=18
FROM node:${NODE_VERSION}-alpine3.18

ARG NODE_VERSION
ENV NODE_VERSION=$NODE_VERSION

ENV PUPPETEER_SKIP_CHROMIUM_DOWNLOAD=true
ENV PUPPETEER_EXECUTABLE_PATH /usr/bin/chromium-browser

ENV USE_LEGACY=true

ARG REACT_VERSION
ENV REACT_VERSION=$REACT_VERSION

RUN apk update && apk add \
make \
font-noto-emoji \
font-roboto \
chromium

RUN npm install -g npm@latest

ENV DOCKER_WORKSPACE=/markdown
WORKDIR ${DOCKER_WORKSPACE}

COPY package.json package-lock.json ./
RUN npm install

RUN npm install react@${REACT_VERSION} react-dom@${REACT_VERSION} @testing-library/react@12

COPY . ./

RUN mkdir -p __tests__/browser/__image_snapshots__/__diff_output__

RUN make emojis

EXPOSE 9966

CMD ["test.browser"]
ENTRYPOINT ["npm", "run"]
7 changes: 6 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,13 @@ example/public/img/emojis: node_modules/@readme/emojis
mkdir -p example/public/img/emojis
cp node_modules/@readme/emojis/src/img/*.png example/public/img/emojis/

ifeq ($(USE_LEGACY), true)
dockerfile = -f Dockerfile.legacy
endif

build:
docker build --platform linux/amd64 -t markdown .
@echo USE_LEGACY=$(USE_LEGACY)
docker build --platform linux/amd64 -t markdown $(dockerfile) --build-arg REACT_VERSION=${REACT_VERSION} .

# This lets us call `make run test.browser`. Make expects cmdline args
# to be targets. So this creates noop targets out of args. Copied from
Expand Down
Loading
Loading