-
-
Notifications
You must be signed in to change notification settings - Fork 16
82 lines (63 loc) · 1.93 KB
/
pr-tests.yml
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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
name: Test the PR
on:
pull_request:
branches:
- main
workflow_dispatch:
jobs:
build-and-test:
name: Build and test with Node.js ${{ matrix.node-version }} and ${{ matrix.db }}
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [18, 20] # See supported Node.js release schedule at https://nodejs.org/en/about/releases
db: [postgresql, mysql, mongodb, sqlite]
env:
DB_PROVIDER: ${{ matrix.db }}
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Install pnpm
uses: pnpm/action-setup@v4
with:
version: 9
- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
cache: 'pnpm'
- name: Install modules
run: pnpm install
- name: Check code formatting
run: pnpm run lint
- name: Generate Prisma Client
run: pnpm run prisma:gen
- name: Build
run: pnpm run build
- name: Run unit tests
run: pnpm run test
build-and-test-docker:
name: Build and test Docker image
runs-on: ubuntu-latest
env:
DB_PROVIDER: postgresql
DB_HOST: db
DB_PORT: 5432
DB_USERNAME: postgres
DB_PASSWORD: secret
DB_NAME: testdb
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Build the Docker image
run: docker buildx build --platform linux/amd64,linux/arm64 -t idn-area:${{ github.sha }} .
- name: Run Docker compose
run: docker-compose -f /mnt/data/docker-compose.yml up -d
- name: Run e2e tests with Docker
run: |
docker-compose -f /mnt/data/docker-compose.yml exec app \
pnpm run test:e2e
- name: Tear down Docker compose
run: docker-compose -f /mnt/data/docker-compose.yml down