ci: run browser tests in docker

github actions doesn't work too well with `apt install` i guess lol
This commit is contained in:
alina 🌸 2024-04-24 15:30:39 +03:00
parent 1720433882
commit a994fd1112
Signed by: teidesu
SSH key fingerprint: SHA256:uNeCpw6aTSU4aIObXLvHfLkDa82HWH9EiOj9AXOIRpI
2 changed files with 21 additions and 4 deletions

18
.github/Dockerfile.test-web vendored Normal file
View file

@ -0,0 +1,18 @@
FROM node:20
WORKDIR /app
ARG BROWSER
RUN corepack enable && \
corepack prepare pnpm@8.7.1 --activate
COPY ../ /app/
RUN pnpm install --frozen-lockfile && \
pnpm -C packages/tl run gen-code && \
pnpm exec playwright install --with-deps $BROWSER
ENV BROWSER="$BROWSER"
ENTRYPOINT [ "pnpm", "run", "test:browser" ]
CMD [ "--browser.name=$BROWSER" ]

View file

@ -65,9 +65,8 @@ jobs:
browser: [chromium, firefox]
steps:
- uses: actions/checkout@v4
- uses: ./.github/actions/init
- name: 'Initialize browser'
run: pnpm exec playwright install --with-deps ${{ matrix.browser }}
- name: 'Build Docker image'
run: docker build . -f .github/Dockerfile.test-web --build-arg BROWSER=${{ matrix.browser }} -t mtcute/test-web
- name: 'Run tests'
# i wish we didn't have to do this, but vitest in browser is very flaky
# see: https://github.com/vitest-dev/vitest/issues/4173
@ -75,7 +74,7 @@ jobs:
with:
max_attempts: 3
timeout_minutes: 30
command: pnpm run test:browser --browser.name=${{ matrix.browser }}
command: docker run -e CI=1 mtcute/test-web
e2e:
runs-on: ubuntu-latest