Skip to content

Commit 8e6f2e1

Browse files
fengmk2claude
andcommitted
ci: add GitHub Actions workflow to test the action
Tests include: - Cross-platform testing (ubuntu, macos, windows) - Cache functionality verification - Build and type check validation - Dist freshness check Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
1 parent 5a42f5f commit 8e6f2e1

1 file changed

Lines changed: 85 additions & 0 deletions

File tree

.github/workflows/test.yml

Lines changed: 85 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,85 @@
1+
name: Test
2+
3+
on:
4+
push:
5+
branches: [main]
6+
pull_request:
7+
branches: [main]
8+
9+
jobs:
10+
test:
11+
strategy:
12+
fail-fast: false
13+
matrix:
14+
os: [ubuntu-latest, macos-latest, windows-latest]
15+
runs-on: ${{ matrix.os }}
16+
steps:
17+
- uses: actions/checkout@v4
18+
19+
- uses: actions/setup-node@v4
20+
with:
21+
node-version: '22'
22+
23+
- name: Setup Vite+
24+
uses: ./
25+
with:
26+
version: latest
27+
cache: false
28+
29+
- name: Verify installation
30+
run: |
31+
vp --version
32+
vite --version
33+
34+
test-cache:
35+
runs-on: ubuntu-latest
36+
steps:
37+
- uses: actions/checkout@v4
38+
39+
- uses: actions/setup-node@v4
40+
with:
41+
node-version: '22'
42+
43+
- name: Create test project
44+
run: |
45+
mkdir -p test-project
46+
cd test-project
47+
echo '{"name":"test-project","private":true}' > package.json
48+
49+
- name: Setup Vite+ with cache
50+
uses: ./
51+
id: setup
52+
with:
53+
cache: true
54+
cache-dependency-path: pnpm-lock.yaml
55+
56+
- name: Verify installation
57+
run: |
58+
vp --version
59+
echo "Installed version: ${{ steps.setup.outputs.version }}"
60+
echo "Cache hit: ${{ steps.setup.outputs.cache-hit }}"
61+
62+
build:
63+
runs-on: ubuntu-latest
64+
steps:
65+
- uses: actions/checkout@v4
66+
67+
- uses: pnpm/action-setup@v4
68+
69+
- uses: actions/setup-node@v4
70+
with:
71+
node-version: '22'
72+
cache: 'pnpm'
73+
74+
- name: Install dependencies
75+
run: pnpm install
76+
77+
- name: Type check
78+
run: pnpm run typecheck
79+
80+
- name: Build
81+
run: pnpm run build
82+
83+
- name: Verify dist is up to date
84+
run: |
85+
git diff --exit-code dist/ || (echo "dist/ is out of date. Run 'pnpm run build' and commit." && exit 1)

0 commit comments

Comments
 (0)