-
Notifications
You must be signed in to change notification settings - Fork 0
122 lines (100 loc) · 2.98 KB
/
pageforge-ci.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
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
name: PageForge CI
on:
push:
branches: [ dev ]
pull_request:
branches: [ dev ]
jobs:
test-command:
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 }}
- 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/site1
- name: Test init command
run: |
mkdir -p test-sites/site2
cd test-sites/site2
pageforge init
- name: Test build command
run: |
mkdir -p test-sites/site3
cd test-sites/site3
pageforge create-site .
pageforge build
- name: Test serve command
run: |
mkdir -p test-sites/site4
cd test-sites/site4
pageforge create-site .
pageforge build
timeout 30s pageforge serve --port 3001 &
sleep 5
curl -f http://localhost:3001
- name: Build project
run: pnpm run build || echo "No build script found"
test-deploy:
needs: test-command
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/site4
cd test-sites/site4
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"