-
Notifications
You must be signed in to change notification settings - Fork 2
97 lines (84 loc) · 2.54 KB
/
vitest.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
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=$HOME/.pnpm-store" >> $GITHUB_ENV
pnpm config set store-dir $HOME/.pnpm-store
- 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: Run Unit Tests in Docker container
run: |
docker run --rm \
-v ${{ github.workspace }}:/app \
-v $HOME/.pnpm-store:$HOME/.pnpm-store \
-v /usr/local/lib/node_modules:/usr/local/lib/node_modules \
-v /usr/local/bin:/usr/local/bin \
-w /app texlive/texlive:latest \
bash -c "pnpm test"
- name: Upload test artifacts
uses: actions/upload-artifact@v4
if: always()
with:
name: vitest-report
path: vitest-report/
retention-days: 30