Skip to content

Commit

Permalink
ci: wip
Browse files Browse the repository at this point in the history
  • Loading branch information
nvlang committed Jun 20, 2024
1 parent c0d834a commit ee71648
Show file tree
Hide file tree
Showing 3 changed files with 41 additions and 146 deletions.
13 changes: 8 additions & 5 deletions .github/workflows/playwright.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
---
name: Integration Tests (Playwright)
on:
# push:
# branches: [main]
push:
branches: [main]
pull_request:
branches: [main]

Expand Down Expand Up @@ -34,6 +34,8 @@ jobs:
packages: |
scheme-basic
luatex
xetex
latexmk
dvisvgm
standalone
pgf
Expand All @@ -49,9 +51,10 @@ jobs:
node-version: lts/*

- name: Install Poppler
run: |
sudo apt-get install -y poppler-data && \
sudo apt-get install -y poppler-utils
run: sudo apt-get install -y poppler-data poppler-utils

- name: Install MuPDF
run: sudo apt-get install -y mupdf mupdf-tools

- name: Install PNPM
run: npm install -g pnpm
Expand Down
101 changes: 33 additions & 68 deletions .github/workflows/vitest.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
---
name: Unit Tests (Vitest)
on:
# push:
Expand All @@ -21,88 +22,52 @@ permissions:

jobs:
test:
timeout-minutes: 20
timeout-minutes: 10
runs-on: ubuntu-latest

steps:
- name: Clear up disk space
run: |
sudo rm -rf /usr/share/dotnet
sudo rm -rf "$AGENT_TOOLSDIRECTORY"
- uses: actions/checkout@v4

- name: Checkout repository
uses: actions/checkout@v4

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3

- name: Get current year and month
id: date
run: echo "YEAR_MONTH=$(date +'%Y-%m')" >> $GITHUB_ENV

- name: Cache Docker image
id: cache-docker-image
uses: actions/cache@v4
- name: Set up TeX Live
uses: teatimeguest/setup-texlive-action@v3
with:
path: docker_cache
key: ${{ runner.os }}-docker-texlive-${{ env.YEAR_MONTH }}
restore-keys: |
${{ runner.os }}-docker-texlive-
- name: Load Docker image from cache
run: |
mkdir -p docker_cache
if [ -f docker_cache/texlive_image.tar ]; then
docker load -i docker_cache/texlive_image.tar
else
echo "No cache found, pulling image"
docker pull texlive/texlive:latest
docker save texlive/texlive:latest -o docker_cache/texlive_image.tar
fi
- name: Install Node.js
packages: |
scheme-basic
luatex
xetex
latexmk
dvisvgm
standalone
pgf
microtype
mathtools
luatex85
lipsum
xcolor
- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: 20

- uses: pnpm/action-setup@v4
name: Install pnpm
with:
version: 9.4.0
run_install: false
node-version: lts/*

- name: Get pnpm store directory
run: |
echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV
- name: Install Poppler
run: sudo apt-get install -y poppler-data poppler-utils

- uses: actions/cache@v4
name: Setup pnpm cache
with:
path: ${{ env.STORE_PATH }}
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
restore-keys: |
${{ runner.os }}-pnpm-store-
- name: Install MuPDF
run: sudo apt-get install -y mupdf mupdf-tools

- name: Install dependencies
run: pnpm install && pnpm exec playwright install --with-deps
- name: Install PNPM
run: npm install -g pnpm

- name: Prepare environment for Docker container
run: |
mkdir -p ${{ runner.temp }}/docker_workspace && \
rsync -a ${{ github.workspace }}/ ${{ runner.temp }}/docker_workspace/ && \
rsync -a ${{ env.STORE_PATH }} ${{ runner.temp }}/docker_workspace/.pnpm-store
- name: Install Node.js dependencies
run: pnpm install

- name: Run Unit Tests in Docker container
run: |
docker run --rm \
-v ${{ runner.temp }}/docker_workspace:/workspace \
-w /workspace texlive/texlive:latest \
/bin/bash -c "apt-get update && apt-get install -y curl gnupg gnupg poppler-data poppler-utils && curl -fsSL https://deb.nodesource.com/setup_20.x | bash - && apt-get install -y nodejs && npm install -g pnpm && pnpm install --store=/workspace/.pnpm-store && pnpm test"
- name: Run Vitest tests
run: pnpm test

- name: Upload test artifacts
uses: actions/upload-artifact@v4
- uses: actions/upload-artifact@v4
if: always()
with:
name: vitest-report
name: vitest-report-2
path: html/
retention-days: 30
73 changes: 0 additions & 73 deletions .github/workflows/vitest2.yml

This file was deleted.

0 comments on commit ee71648

Please sign in to comment.