-
Notifications
You must be signed in to change notification settings - Fork 731
88 lines (74 loc) · 2.1 KB
/
Copy pathserver-tests.yml
File metadata and controls
88 lines (74 loc) · 2.1 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
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
83
84
85
86
87
88
name: Server Tests
on:
pull_request:
# Only trigger when relevant files change to save CI minutes
paths-ignore:
- 'frontend/**'
- '**.md'
- '.gitignore'
- '.editorconfig'
- '**/.eslintrc*'
- '.prettierrc'
- '.prettierignore'
- 'LICENSE'
# Automatically cancel in-progress runs if you push new code to the same PR
concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
cancel-in-progress: true
permissions:
contents: read
actions: write # GHA cache for Flyway image layers
jobs:
test:
runs-on: ubuntu-latest
timeout-minutes: 30
services:
postgres:
image: postgres:14-alpine
command: postgres -c wal_level=logical
env:
POSTGRES_USER: postgres
POSTGRES_PASSWORD: example
POSTGRES_DB: postgres
ports:
- 5432:5432
options: >-
--health-cmd "pg_isready -U postgres"
--health-interval 2s
--health-timeout 5s
--health-retries 15
env:
NODE_ENV: test
DB_HOST: localhost
DB_PORT: 5432
DB_USER: postgres
DB_PASSWORD: example
steps:
- name: Check out repository code
uses: actions/checkout@v4
- name: Setup pnpm
uses: pnpm/action-setup@v4
- name: Setup Node
uses: actions/setup-node@v4
with:
node-version: 20
cache: 'pnpm'
- name: Install dependencies
run: pnpm i --frozen-lockfile
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Build Flyway image
uses: docker/build-push-action@v6
with:
context: backend/src/database
file: backend/src/database/Dockerfile.flyway
load: true
tags: crowd_flyway
cache-from: type=gha,scope=flyway
cache-to: type=gha,mode=max,scope=flyway
- name: Prepare test database
env:
SKIP_FLYWAY_BUILD: 1
run: ./.github/scripts/prepare-test-template-db.sh
- name: Run server tests
run: pnpm test:server