-
Notifications
You must be signed in to change notification settings - Fork 141
98 lines (94 loc) · 2.86 KB
/
Copy pathintegration-tests.yml
File metadata and controls
98 lines (94 loc) · 2.86 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
89
90
91
92
93
94
95
96
97
98
name: Backend Integration Tests
on:
push:
branches: [main, develop]
pull_request:
branches: [main, develop]
jobs:
prometheus-alerts-check:
name: Validate Prometheus Alerts
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Install promtool
run: |
PROM_VERSION="2.51.0"
curl -sS -L "https://github.com/prometheus/prometheus/releases/download/v${PROM_VERSION}/prometheus-${PROM_VERSION}.linux-amd64.tar.gz" | tar xz
sudo mv "prometheus-${PROM_VERSION}.linux-amd64/promtool" /usr/local/bin/
- name: Validate Prometheus Alert Rules
run: |
promtool check rules monitoring/prometheus-alerts.yml
promtool check rules monitoring/alerts.yml
unit-tests:
name: Unit Tests
runs-on: ubuntu-latest
defaults:
run:
working-directory: .
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 20
- run: npm ci
- run: npm --workspace=backend run test:unit
continue-on-error: true
- name: Upload coverage
uses: actions/upload-artifact@v4
with:
name: unit-coverage
path: backend/coverage/
integration-tests:
name: Integration Tests
runs-on: ubuntu-latest
defaults:
run:
working-directory: .
services:
postgres:
image: timescale/timescaledb:latest-pg15
env:
POSTGRES_DB: bridge_watch_test
POSTGRES_USER: bridge_watch
POSTGRES_PASSWORD: bridge_watch_dev
ports:
- 5432:5432
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
redis:
image: redis:7-alpine
ports:
- 6379:6379
options: >-
--health-cmd "redis-cli ping"
--health-interval 10s
--health-timeout 5s
--health-retries 5
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 20
- run: npm ci
- name: Validate Prometheus Alert Rules
run: docker run --rm --entrypoint promtool -v ${{ github.workspace }}:/work prom/prometheus:v2.54.1 check rules /work/monitoring/prometheus-alerts.yml
- name: Run integration tests
run: npm --workspace=backend run test:integration
continue-on-error: true
env:
NODE_ENV: test
POSTGRES_HOST: localhost
POSTGRES_PORT: 5432
POSTGRES_DB: bridge_watch_test
POSTGRES_USER: bridge_watch
POSTGRES_PASSWORD: bridge_watch_dev
REDIS_HOST: localhost
REDIS_PORT: 6379
- name: Upload coverage
uses: actions/upload-artifact@v4
with:
name: integration-coverage
path: backend/coverage/