|
1 |
| -name: Update pnpm Version and Auto-Merge |
| 1 | +name: Test fastify-swc-server CLI |
2 | 2 |
|
3 | 3 | on:
|
4 |
| - schedule: |
5 |
| - - cron: "0 0 * * *" |
6 |
| - workflow_dispatch: |
7 |
| - |
8 |
| -permissions: |
9 |
| - contents: write |
10 |
| - pull-requests: write |
| 4 | + push: |
| 5 | + branches: [master] |
| 6 | + pull_request: |
| 7 | + branches: [master] |
11 | 8 |
|
12 | 9 | jobs:
|
13 |
| - update-pnpm: |
| 10 | + test: |
14 | 11 | runs-on: ubuntu-latest
|
15 | 12 |
|
16 |
| - outputs: |
17 |
| - pull_request_url: ${{ steps.create-pr.outputs.pull-request-url }} |
18 |
| - |
19 | 13 | steps:
|
20 |
| - - name: Check out the repository |
21 |
| - uses: actions/checkout@v3 |
| 14 | + - name: Checkout code |
| 15 | + uses: actions/checkout@v4 |
22 | 16 |
|
23 |
| - - name: Install Corepack |
24 |
| - run: npm install -g corepack |
| 17 | + - name: Set up SSH |
| 18 | + run: | |
| 19 | + mkdir -p ~/.ssh |
| 20 | + echo "$SSH_PRIVATE_KEY" | tr -d '\r' > ~/.ssh/id_rsa |
| 21 | + chmod 600 ~/.ssh/id_rsa |
| 22 | + ssh-keyscan github.com >> ~/.ssh/known_hosts |
| 23 | + env: |
| 24 | + SSH_PRIVATE_KEY: ${{ secrets.SSH_PRIVATE_KEY }} |
25 | 25 |
|
26 |
| - - name: Update pnpm Version |
27 |
| - run: corepack up |
| 26 | + - name: Set up pnpm |
| 27 | + uses: pnpm/action-setup@v4 |
| 28 | + with: |
| 29 | + version: "8.6.0" |
28 | 30 |
|
29 |
| - - name: Create a pull request |
30 |
| - id: create-pr |
31 |
| - uses: peter-evans/create-pull-request@v5 |
| 31 | + - name: Set up Node.js |
| 32 | + uses: actions/setup-node@v4 |
32 | 33 | with:
|
33 |
| - branch: update-pnpm-version |
34 |
| - title: "chore: Update pnpm version via Corepack" |
35 |
| - body: "This pull request updates the pnpm version in package.json using Corepack." |
36 |
| - labels: update, dependencies |
37 |
| - token: ${{ secrets.PERSONAL_ACCESS_TOKEN }} |
38 |
| - |
39 |
| - auto-merge: |
40 |
| - needs: update-pnpm |
41 |
| - runs-on: ubuntu-latest |
42 |
| - if: needs.update-pnpm.outputs.pull_request_url != '' |
| 34 | + node-version: "lts/*" |
| 35 | + cache: pnpm |
43 | 36 |
|
44 |
| - steps: |
45 |
| - - name: Enable auto-merge for the pull request |
46 |
| - run: gh pr merge --auto --merge "${{ needs.update-pnpm.outputs.pull_request_url }}" |
47 |
| - env: |
48 |
| - GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 37 | + - name: Install dependencies (skip prepare script) |
| 38 | + run: pnpm install --ignore-scripts |
| 39 | + |
| 40 | + - name: Pack and install CLI globally |
| 41 | + run: | |
| 42 | + npm pack |
| 43 | + sudo npm install -g $(ls fastify-swc-typescript-server-bootstrap-cli-*.tgz) |
| 44 | + # Verify CLI is available |
| 45 | + fastify-swc-server || echo "CLI installation verified" |
| 46 | +
|
| 47 | + - name: Test CLI functionality |
| 48 | + run: | |
| 49 | + # Create a new project using the CLI |
| 50 | + fastify-swc-server test-fastify-project |
| 51 | +
|
| 52 | + # Verify project structure |
| 53 | + ls -la test-fastify-project |
| 54 | +
|
| 55 | + # Change into the new project directory |
| 56 | + cd test-fastify-project |
| 57 | +
|
| 58 | + # Install dependencies using pnpm |
| 59 | + pnpm install |
| 60 | +
|
| 61 | + # Test if the project builds successfully |
| 62 | + pnpm run build |
| 63 | +
|
| 64 | + # Run the project in development mode |
| 65 | + pnpm dev & |
| 66 | +
|
| 67 | + # Wait briefly for the dev server to start |
| 68 | + sleep 5 |
| 69 | +
|
| 70 | + # Verify the server is running (check localhost:3000 by default or configured port) |
| 71 | + curl -I http://localhost:3000 || echo "Server verification skipped" |
| 72 | +
|
| 73 | + # Kill the dev server to clean up |
| 74 | + pkill -f "node" |
0 commit comments