修复 chalk 依赖 #4
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: PageForge CI | |
on: | |
push: | |
branches: [ dev ] | |
pull_request: | |
branches: [ dev ] | |
jobs: | |
test: | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
node-version: [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 }} | |
- name: Install pnpm | |
uses: pnpm/action-setup@v2 | |
with: | |
version: 8 | |
- name: Get pnpm store directory | |
shell: bash | |
run: | | |
echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV | |
- uses: actions/cache@v3 | |
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: Link package globally | |
run: | | |
pnpm link --global | |
pnpm link --global pageforge | |
- name: Run linting | |
run: pnpm run lint || echo "No lint script found" | |
- name: Run unit tests | |
run: pnpm 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: pnpm run build || echo "No build script found" |