-
Notifications
You must be signed in to change notification settings - Fork 0
92 lines (73 loc) · 2.56 KB
/
test.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
name: Test fastify-swc-server CLI
on:
push:
branches: [master]
pull_request:
branches: [master]
jobs:
test:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Generate SSH Key
run: |
mkdir -p ~/.ssh
ssh-keygen -t rsa -b 4096 -f ~/.ssh/id_rsa -N "" -C "[email protected]"
chmod 600 ~/.ssh/id_rsa
eval "$(ssh-agent -s)"
ssh-add ~/.ssh/id_rsa
ssh-keyscan github.com >> ~/.ssh/known_hosts
echo "Public Key:"
cat ~/.ssh/id_rsa.pub
id: ssh-key
- name: Add SSH Public Key to Repository
uses: peter-evans/create-or-update-comment@v3
with:
token: ${{ secrets.GITHUB_TOKEN }}
repository: ${{ github.repository }}
issue-number: ${{ github.event.pull_request.number }}
body: |
Please add this SSH public key as a Deploy Key to your repository:
```
${{ steps.ssh-key.outputs.public_key }}
```
- name: Debug SSH Connection
run: ssh -T [email protected] || echo "SSH connection failed"
- name: Set up pnpm
uses: pnpm/action-setup@v4
with:
version: "8.6.0"
- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: "lts/*"
cache: pnpm
- name: Install dependencies (skip prepare script)
run: pnpm install --ignore-scripts
- name: Pack and install CLI globally
run: |
npm pack
sudo npm install -g $(ls fastify-swc-typescript-server-bootstrap-cli-*.tgz)
# Verify CLI is available
fastify-swc-server || echo "CLI installation verified"
- name: Test CLI Functionality
run: |
# Create a new project using the CLI
fastify-swc-server test-fastify-project
# Verify project structure
ls -la test-fastify-project
# Change into the new project directory
cd test-fastify-project
# Install dependencies using pnpm
pnpm install
# Test if the project builds successfully
pnpm run build
# Run the project in development mode
pnpm dev &
# Wait briefly for the dev server to start
sleep 5
# Verify the server is running (check localhost:3000 by default or configured port)
curl -I http://localhost:3000 || echo "Server verification skipped"
# Kill the dev server to clean up
pkill -f "node"