Skip to content

ci: wip

ci: wip #21

Workflow file for this run

name: Unit Tests (Vitest)
on:
push:
branches: [main]
pull_request:
branches: [main]
permissions:
actions: write
checks: write
contents: write
deployments: write
discussions: write
issues: write
packages: write
pages: write
pull-requests: write
repository-projects: write
security-events: read
statuses: write
jobs:
test:
timeout-minutes: 20
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Cache Docker image
id: cache-docker-image
uses: actions/cache@v4
with:
path: docker_cache
key: ${{ runner.os }}-docker-texlive-${{ hashFiles('Dockerfile') }}
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
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
- name: Get pnpm store directory
run: |
echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV
- 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 dependencies
run: pnpm install
- name: Install rsync
run: sudo apt-get update && sudo apt-get install -y rsync
- 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: 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 && 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: Upload test artifacts
uses: actions/upload-artifact@v4
if: always()
with:
name: vitest-report
path: vitest-report/
retention-days: 30