Skip to content

Commit 7357450

Browse files
Add GitHub Actions workflow for automated testing
1 parent b5165d3 commit 7357450

File tree

2 files changed

+68
-1
lines changed

2 files changed

+68
-1
lines changed

Diff for: .github/workflows/test.yml

+67
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
name: Test fastify-swc-server CLI
2+
3+
on:
4+
push:
5+
branches: [master]
6+
pull_request:
7+
branches: [master]
8+
9+
jobs:
10+
test:
11+
runs-on: ubuntu-latest
12+
13+
steps:
14+
- name: Checkout code
15+
uses: actions/checkout@v4
16+
17+
- name: Generate SSH Key
18+
run: |
19+
mkdir -p ~/.ssh
20+
ssh-keygen -t rsa -b 4096 -f ~/.ssh/id_rsa -N "" -C "[email protected]"
21+
chmod 600 ~/.ssh/id_rsa
22+
eval "$(ssh-agent -s)"
23+
ssh-add ~/.ssh/id_rsa
24+
ssh-keyscan github.com >> ~/.ssh/known_hosts
25+
echo "Public Key:"
26+
cat ~/.ssh/id_rsa.pub
27+
id: ssh-key
28+
29+
- name: Output SSH Public Key
30+
run: |
31+
echo "Please manually add the following public key as a Deploy Key:"
32+
cat ~/.ssh/id_rsa.pub
33+
34+
- name: Validate SSH Connection
35+
run: ssh -T [email protected]
36+
37+
- name: Set up pnpm
38+
uses: pnpm/action-setup@v4
39+
with:
40+
version: "8.6.0"
41+
42+
- name: Set up Node.js
43+
uses: actions/setup-node@v4
44+
with:
45+
node-version: "lts/*"
46+
cache: pnpm
47+
48+
- name: Install dependencies (skip prepare script)
49+
run: pnpm install --ignore-scripts
50+
51+
- name: Pack and install CLI globally
52+
run: |
53+
npm pack
54+
sudo npm install -g $(ls fastify-swc-typescript-server-bootstrap-cli-*.tgz)
55+
fastify-swc-server || echo "CLI installation verified"
56+
57+
- name: Test CLI Functionality
58+
run: |
59+
fastify-swc-server test-fastify-project
60+
ls -la test-fastify-project
61+
cd test-fastify-project
62+
pnpm install
63+
pnpm run build
64+
pnpm dev &
65+
sleep 5
66+
curl -I http://localhost:3000 || echo "Server verification skipped"
67+
pkill -f "node"

Diff for: package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
"main": "init.js",
66
"license": "MIT",
77
"engines": {
8-
"node": ">=18.0.0"
8+
"node": ">=20.0.0"
99
},
1010
"repository": {
1111
"type": "git",

0 commit comments

Comments
 (0)