|
1 | | -# Sample workflow for building and deploying a Next.js site to GitHub Pages |
2 | | -# |
3 | | -# To get started with Next.js see: https://nextjs.org/docs/getting-started |
4 | | -# |
5 | | -name: Build Next.js site |
| 1 | +name: Build |
6 | 2 |
|
7 | 3 | on: |
8 | | - # Runs on pushes targeting the default branch |
9 | 4 | push: |
10 | 5 | branches: ["main"] |
11 | | - |
12 | 6 | pull_request: |
13 | | - |
14 | | - # Allows you to run this workflow manually from the Actions tab |
15 | 7 | workflow_dispatch: |
16 | 8 |
|
17 | | -# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages |
18 | | -permissions: |
19 | | - contents: read |
20 | | - pages: write |
21 | | - id-token: write |
22 | | - |
23 | | -# Allow only one concurrent deployment, skipping runs queued between the run in-progress and latest queued. |
24 | | -# However, do NOT cancel in-progress runs as we want to allow these production deployments to complete. |
25 | | -concurrency: |
26 | | - group: "pages" |
27 | | - cancel-in-progress: false |
28 | | - |
29 | 9 | jobs: |
30 | | - # Build job |
31 | 10 | build: |
32 | 11 | runs-on: ubuntu-latest |
33 | 12 | steps: |
34 | 13 | - name: Checkout |
35 | 14 | uses: actions/checkout@v4 |
36 | | - - name: Detect package manager |
37 | | - id: detect-package-manager |
38 | | - run: | |
39 | | - if [ -f "${{ github.workspace }}/yarn.lock" ]; then |
40 | | - echo "manager=yarn" >> $GITHUB_OUTPUT |
41 | | - echo "command=install" >> $GITHUB_OUTPUT |
42 | | - echo "runner=yarn" >> $GITHUB_OUTPUT |
43 | | - exit 0 |
44 | | - elif [ -f "${{ github.workspace }}/package.json" ]; then |
45 | | - echo "manager=npm" >> $GITHUB_OUTPUT |
46 | | - echo "command=ci" >> $GITHUB_OUTPUT |
47 | | - echo "runner=npx --no-install" >> $GITHUB_OUTPUT |
48 | | - exit 0 |
49 | | - else |
50 | | - echo "Unable to determine package manager" |
51 | | - exit 1 |
52 | | - fi |
| 15 | + |
53 | 16 | - name: Setup Node |
54 | 17 | uses: actions/setup-node@v4 |
55 | 18 | with: |
56 | | - node-version: "24" |
57 | | - cache: ${{ steps.detect-package-manager.outputs.manager }} |
58 | | - - name: Restore cache |
59 | | - uses: actions/cache@v3 |
60 | | - with: |
61 | | - path: | |
62 | | - .next/cache |
63 | | - # Generate a new cache whenever packages or source files change. |
64 | | - key: ${{ runner.os }}-nextjs-${{ hashFiles('**/package-lock.json', '**/yarn.lock') }}-${{ hashFiles('**.[jt]s', '**.[jt]sx') }} |
65 | | - # If source files changed but packages didn't, rebuild from a prior cache. |
66 | | - restore-keys: | |
67 | | - ${{ runner.os }}-nextjs-${{ hashFiles('**/package-lock.json', '**/yarn.lock') }}- |
68 | | - - name: Install dependencies |
69 | | - run: ${{ steps.detect-package-manager.outputs.manager }} ${{ steps.detect-package-manager.outputs.command }} |
70 | | - - name: Build with Next.js |
71 | | - run: ${{ steps.detect-package-manager.outputs.runner }} next build |
| 19 | + node-version: "20" |
72 | 20 |
|
| 21 | + - name: Install frontend dependencies |
| 22 | + working-directory: ./app |
| 23 | + run: npm ci |
| 24 | + |
| 25 | + - name: Build frontend |
| 26 | + working-directory: ./app |
| 27 | + run: npm run build |
| 28 | + |
| 29 | + - name: Lint frontend |
| 30 | + working-directory: ./app |
| 31 | + run: npm run lint |
| 32 | + |
| 33 | + - name: Setup Python |
| 34 | + uses: actions/setup-python@v5 |
| 35 | + with: |
| 36 | + python-version: "3.12" |
73 | 37 |
|
| 38 | + - name: Install backend dependencies |
| 39 | + run: pip install -e ".[test]" |
0 commit comments