|
6 | 6 | pull_request: |
7 | 7 | branches: [ main ] |
8 | 8 |
|
| 9 | +env: |
| 10 | + NODE_VER: 22.5 |
| 11 | + |
9 | 12 | jobs: |
10 | 13 | testCodebase: |
11 | 14 | runs-on: ubuntu-latest |
12 | 15 | steps: |
13 | 16 | - uses: actions/checkout@v4 |
14 | | - - name: Use Node.js 20.6.1 |
15 | | - uses: actions/setup-node@v4 |
16 | | - with: |
17 | | - node-version: 20.6.1 |
18 | 17 |
|
19 | | - - uses: pnpm/action-setup@v3 |
| 18 | + - uses: pnpm/action-setup@v4 |
20 | 19 | name: Install pnpm |
21 | | - id: pnpm-install |
22 | 20 | with: |
23 | | - version: 8 |
| 21 | + run_install: false |
24 | 22 |
|
25 | | - - name: Get pnpm store directory |
26 | | - shell: bash |
27 | | - run: | |
28 | | - echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV |
29 | | -
|
30 | | - - uses: actions/cache@v4 |
31 | | - name: Setup pnpm cache |
| 23 | + - name: Use Node.js ${{ env.NODE_VER }} |
| 24 | + uses: actions/setup-node@v4 |
32 | 25 | with: |
33 | | - path: ${{ env.STORE_PATH }} |
34 | | - key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }} |
35 | | - restore-keys: | |
36 | | - ${{ runner.os }}-pnpm-store- |
| 26 | + node-version: ${{ env.NODE_VER }} |
| 27 | + cache: 'pnpm' |
| 28 | + |
| 29 | + - name: Install deps |
| 30 | + run: pnpm i |
37 | 31 |
|
38 | | - - run: pnpm install |
| 32 | + - name: Check linting |
| 33 | + run: pnpm lint |
39 | 34 |
|
40 | | - - run: pnpm run lint |
41 | | - - run: pnpm run typecheck |
| 35 | + - name: Check typecheck |
| 36 | + run: pnpm typecheck |
42 | 37 |
|
43 | 38 | testCli: |
44 | 39 | runs-on: ubuntu-latest |
45 | 40 | steps: |
46 | 41 | - uses: actions/checkout@v4 |
47 | | - - name: Use Node.js 20.6.1 |
48 | | - uses: actions/setup-node@v4 |
49 | | - with: |
50 | | - node-version: 20.6.1 |
51 | 42 |
|
52 | | - - uses: pnpm/action-setup@v3 |
| 43 | + - uses: pnpm/action-setup@v4 |
53 | 44 | name: Install pnpm |
54 | | - id: pnpm-install |
55 | 45 | with: |
56 | | - version: 8 |
57 | | - |
58 | | - - name: Get pnpm store directory |
59 | | - shell: bash |
60 | | - run: | |
61 | | - echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV |
| 46 | + run_install: false |
62 | 47 |
|
63 | | - - uses: actions/cache@v4 |
64 | | - name: Setup pnpm cache |
| 48 | + - name: Use Node.js ${{ env.NODE_VER }} |
| 49 | + uses: actions/setup-node@v4 |
65 | 50 | with: |
66 | | - path: ${{ env.STORE_PATH }} |
67 | | - key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }} |
68 | | - restore-keys: | |
69 | | - ${{ runner.os }}-pnpm-store- |
| 51 | + node-version: ${{ env.NODE_VER }} |
| 52 | + cache: 'pnpm' |
| 53 | + |
| 54 | + - name: Install deps |
| 55 | + run: pnpm i |
70 | 56 |
|
71 | | - - run: pnpm install |
72 | | - - run: pnpm dev:ci |
| 57 | + - name: Run the CI with default options |
| 58 | + run: pnpm dev:ci |
73 | 59 |
|
74 | | - # This is what the user would do, minus actually starting the application |
75 | | - - run: cd my-sidebase-app && npx prisma db push |
| 60 | + # setup the database inside the generated app |
| 61 | + - name: app:init the database |
| 62 | + run: cd my-sidebase-app && npx prisma db push |
76 | 63 |
|
77 | 64 | # code should be 100% correct at the start |
78 | | - - run: cd my-sidebase-app && pnpm lint |
79 | | - - run: cd my-sidebase-app && npm exec nuxi prepare && pnpm run typecheck |
| 65 | + - name: app:check linting |
| 66 | + run: cd my-sidebase-app && pnpm lint |
| 67 | + |
| 68 | + - name: app:check typing |
| 69 | + run: cd my-sidebase-app && npm exec nuxi prepare && pnpm run typecheck |
80 | 70 |
|
81 | 71 | # start dev-app, all of the following adapted from https://stackoverflow.com/a/60996259 |
82 | | - - run: "cd my-sidebase-app && timeout 30 npm run dev || ( [[ $? -eq 124 ]] && echo \"app started and did not exit within first 30 seconds, thats good\" )" |
| 72 | + - name: app:run in dev |
| 73 | + run: "cd my-sidebase-app && timeout 30 npm run dev || ( [[ $? -eq 124 ]] && echo \"app started and did not exit within first 30 seconds, thats good\" )" |
83 | 74 |
|
84 | 75 | # start prod-app |
85 | | - - run: "export AUTH_ORIGIN=http://localhost:3000 && export AUTH_SECRET=test123 && cd my-sidebase-app && npm run build && timeout 30 npm run preview || ( [[ $? -eq 124 ]] && echo \"app started and did not exit within first 30 seconds, thats good\" )" |
| 76 | + - name: app:run in prod |
| 77 | + run: "export AUTH_ORIGIN=http://localhost:3000 && export AUTH_SECRET=test123 && cd my-sidebase-app && npm run build && timeout 30 npm run preview || ( [[ $? -eq 124 ]] && echo \"app started and did not exit within first 30 seconds, thats good\" )" |
86 | 78 |
|
87 | 79 | # start dev-app and curl from it |
88 | | - - run: "cd my-sidebase-app && timeout 30 npm run dev & (sleep 20 && curl --fail localhost:3000) || ( [[ $? -eq 124 ]] && echo \"app started and did not exit within first 30 seconds, thats good\" )" |
| 80 | + - name: app:test in prod |
| 81 | + run: "cd my-sidebase-app && timeout 30 npm run dev & (sleep 20 && curl --fail localhost:3000) || ( [[ $? -eq 124 ]] && echo \"app started and did not exit within first 30 seconds, thats good\" )" |
0 commit comments