Repository navigation
48 lines (41 loc) · 1.69 KB
/
Copy pathci.yml
File metadata and controls
48 lines (41 loc) · 1.69 KB
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
name: CI
on: [push, pull_request]
env:
VERCEL_ORG_ID: ${{ secrets.VERCEL_ORG_ID }}
VERCEL_PROJECT_ID: ${{ secrets.VERCEL_PROJECT_ID }}
jobs:
build-and-test:
name: Build and test
runs-on: ubuntu-latest
timeout-minutes: 5
steps:
- name: Checkout Git repository
uses: actions/checkout@v7
- name: Setup pnpm
uses: pnpm/setup@v3
with:
cache: true
- name: Pull environment variables
run: pnpm vercel env pull --environment development .env --token ${{ secrets.VERCEL_TOKEN }}
- name: Start database services
run: docker compose up --detach --wait
- name: Cache Next.js
uses: actions/cache@v6
with:
path: |
~/.npm
${{ github.workspace }}/apps/web/.next/cache
# Generate a new cache whenever packages or source files change.
key: ${{ runner.os }}-nextjs-${{ hashFiles('**/pnpm-lock.yaml') }}-${{ hashFiles('**/*.js', '**/*.jsx', '**/*.ts', '**/*.tsx') }}
# If source files changed but packages didn't, rebuild from a prior cache.
restore-keys: |
${{ runner.os }}-nextjs-${{ hashFiles('**/pnpm-lock.yaml') }}-
- name: Lint, format, build, type check, and test
run: pnpm test
- name: Smoke-test production API
run: |
pnpm install --prod --filter @interval.so/api --frozen-lockfile
HOST=127.0.0.1 PORT=3333 NODE_ENV=production node --env-file=.env apps/api/build/bin/server.js &
server_pid=$!
trap 'kill "$server_pid" 2>/dev/null || true' EXIT
curl --fail --retry 10 --retry-connrefused --retry-delay 1 --retry-max-time 30 http://127.0.0.1:3333/health