Skip to content

Commit

Permalink
添加测试 ci
Browse files Browse the repository at this point in the history
  • Loading branch information
qianmoQ committed Dec 29, 2024
1 parent dd23481 commit 0c2d372
Show file tree
Hide file tree
Showing 2 changed files with 73 additions and 0 deletions.
65 changes: 65 additions & 0 deletions .github/workflows/pageforge-ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
name: PageForge CI

on:
push:
branches: [ dev ]
pull_request:
branches: [ dev ]

jobs:
test:
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [16.x, 18.x, 20.x]

steps:
- uses: actions/checkout@v3

- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}
cache: 'npm'

- name: Install dependencies
run: npm ci

- name: Link package globally
run: |
npm link
npm link pageforge
- name: Run linting
run: npm run lint || echo "No lint script found"

- name: Run unit tests
run: npm test || echo "No test script found"

- name: Test create-site command
run: |
mkdir -p test-sites
pageforge create-site test-sites/test-site
test -d test-sites/test-site || exit 1
- name: Test init command
run: |
cd test-sites/test-site
pageforge init
test -f pageforge.yml || exit 1
- name: Test build command
run: |
cd test-sites/test-site
pageforge build
test -d dist || exit 1
- name: Test serve command
run: |
cd test-sites/test-site
timeout 30s pageforge serve --port 3001 &
sleep 5
curl -f http://localhost:3001 || exit 1
- name: Build project
run: npm run build || echo "No build script found"
8 changes: 8 additions & 0 deletions example/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -85,3 +85,11 @@ PageForge 是一款现代化的静态页面生成与部署平台,旨在帮助

![alt文本](https://raw.githubusercontent.com/devlive-community/pageforge/d751a0bdc90e4cdd8b124a6c8b2adb499c47025f/assets/logo.svg "图片标题" =600x200 center)

# 表格

---

| 标题1 | 标题2 | 标题3 |
| --- | --- | --- |
| 内容1 | 内容2 | 内容3 |
| 内容1 | 内容2 | 内容3 |

0 comments on commit 0c2d372

Please sign in to comment.