generated from MapColonies/ts-server-boilerplate
-
Notifications
You must be signed in to change notification settings - Fork 1
129 lines (109 loc) · 3.61 KB
/
pull_request.yaml
File metadata and controls
129 lines (109 loc) · 3.61 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
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
name: pull_request
on: [pull_request, workflow_dispatch]
env:
DB_HOST: postgres
DB_NAME: postgres
DB_USERNAME: postgres
DB_PASSWORD: postgres
DB_SCHEMA: public
jobs:
eslint:
name: Run Linters
runs-on: ubuntu-latest
strategy:
matrix:
node: [24.x]
steps:
- name: Check out TS Project Git repository
uses: actions/checkout@v5
- name: Init Nodejs
uses: MapColonies/shared-workflows/actions/init-npm@init-npm-v1
with:
node-version: ${{ matrix.node }}
- name: Run TS Project linters
uses: wearerequired/lint-action@v2
with:
eslint: true
prettier: true
eslint_extensions: ts
tsc: true
tests:
name: Run Tests
runs-on: ubuntu-latest
container: node:24-bullseye
strategy:
matrix:
node: [24.x]
services:
# Label used to access the service container
postgres:
# Docker Hub image
image: postgres:15
# Provide the password for postgres
env:
POSTGRES_PASSWORD: ${{ env.DB_PASSWORD }}
POSTGRES_USER: ${{ env.DB_USERNAME }}
POSTGRES_DB: ${{ env.DB_NAME }}
ports:
- 5432:5432
# Set health checks to wait until postgres has started
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
minio1:
image: bitnamilegacy/minio:2022.8.13-debian-11-r1
env:
MINIO_ROOT_USER: minioadmin1
MINIO_ROOT_PASSWORD: minioadmin1
MINIO_API_PORT_NUMBER: '9003'
options: >-
--health-cmd "curl -f http://localhost:9003/minio/health/live"
--health-interval 10s
--health-timeout 5s
--health-retries 5
minio2:
image: bitnamilegacy/minio:2022.8.13-debian-11-r1
env:
MINIO_ROOT_USER: minioadmin2
MINIO_ROOT_PASSWORD: minioadmin2
MINIO_API_PORT_NUMBER: '9004'
options: >-
--health-cmd "curl -f http://localhost:9004/minio/health/live"
--health-interval 10s
--health-timeout 5s
--health-retries 5
steps:
- name: Check out TS Project Git repository
uses: actions/checkout@v4
- name: Install pg client
run: |
apt-get update && apt-get install -y lsb-release curl ca-certificates
install -d /usr/share/postgresql-common/pgdg
curl -o /usr/share/postgresql-common/pgdg/apt.postgresql.org.asc --fail https://www.postgresql.org/media/keys/ACCC4CF8.asc
sh -c 'echo "deb [signed-by=/usr/share/postgresql-common/pgdg/apt.postgresql.org.asc] https://apt.postgresql.org/pub/repos/apt $(lsb_release -cs)-pgdg main" > /etc/apt/sources.list.d/pgdg.list'
apt-get update
apt-get install -y postgresql-client
- name: Create pgcrypto extension
run: psql -h $DB_HOST -d $DB_NAME -U $DB_USERNAME -c 'CREATE EXTENSION pgcrypto;'
env:
PGPASSWORD: ${{ env.DB_PASSWORD }}
- name: Init nodejs
uses: MapColonies/shared-workflows/actions/init-npm@init-npm-v1.0.0
with:
node-version: ${{ matrix.node }}
- name: Run tests
run: npm run test
- uses: actions/upload-artifact@v4
with:
name: Test Reporters ${{ matrix.node }}
path: ./reports/**
build_image:
name: Build Image
runs-on: ubuntu-latest
steps:
- name: Check out Git repository
uses: actions/checkout@v4
- name: build Docker image
run: docker build -t test-build:latest .