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 aefa04f commit 7cdc3aa
Showing 1 changed file with 53 additions and 11 deletions.
64 changes: 53 additions & 11 deletions .github/workflows/pageforge-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [18.x, 20.x]
node-version: [16.x, 18.x, 20.x]

steps:
- uses: actions/checkout@v3
Expand Down Expand Up @@ -55,28 +55,70 @@ jobs:

- 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
mkdir -p test-sites/create-site-test
pageforge create-site test-sites/create-site-test
test -d test-sites/create-site-test || exit 1
- name: Test init command
- name: Test init command in new directory
run: |
cd test-sites/test-site
mkdir -p test-sites/init-test
cd test-sites/init-test
pageforge init
test -f pageforge.yml || exit 1
- name: Test build command
- name: Test build command in new directory
run: |
cd test-sites/test-site
mkdir -p test-sites/build-test
cd test-sites/build-test
pageforge create-site .
pageforge build
test -d dist || exit 1
- name: Test serve command
- name: Test serve command in new directory
run: |
cd test-sites/test-site
mkdir -p test-sites/serve-test
cd test-sites/serve-test
pageforge create-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"
run: pnpm run build || echo "No build script found"

test-deploy:
needs: test
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3

- name: Use Node.js
uses: actions/setup-node@v3
with:
node-version: '18.x'

- name: Install pnpm
uses: pnpm/action-setup@v2
with:
version: 8

- name: Install dependencies
run: pnpm install

- name: Link package globally
run: |
pnpm link --global
pnpm link --global pageforge
- name: Test deploy-github command
run: |
mkdir -p test-sites/deploy-test
cd test-sites/deploy-test
pageforge create-site .
pageforge build
git config --global user.email "[email protected]"
git config --global user.name "Test User"
git init
git add .
git commit -m "Initial commit"
pageforge deploy-github || echo "Deploy failed as expected in test environment"

0 comments on commit 7cdc3aa

Please sign in to comment.