-
Notifications
You must be signed in to change notification settings - Fork 0
181 lines (148 loc) · 5.08 KB
/
Copy pathpull_request.yaml
File metadata and controls
181 lines (148 loc) · 5.08 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
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
name: pull_request
on: pull_request
env:
DB_HOST: localhost
DB_PORT: 5432
DB_NAME: postgres
DB_USERNAME: postgres
DB_PASSWORD: postgres
DB_SCHEMA: public
SOURCE_DB_SCHEMA: query
permissions:
contents: read
pull-requests: read
jobs:
eslint:
name: Run TS Project eslint
runs-on: ubuntu-latest
strategy:
matrix:
node: [24.x]
steps:
- name: Check out TS Project Git repository
uses: actions/checkout@v5
- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node }}
cache: npm
- name: Install dependencies
run: npm install
- name: Build workspace dependencies
run: npx lerna run build --scope=@map-colonies/vector-standard-db
- name: Run TS Project linters
run: npx lerna run lint
openapi-lint:
name: Run OpenAPI lint Check
runs-on: ubuntu-latest
steps:
- name: Check out TS Project Git repository
uses: actions/checkout@v5
- name: OpenAPI Lint Checks
run: npx @redocly/cli lint --format=github-actions ./openapi3.yaml
helm-lint:
name: Run Helm lint Check
runs-on: ubuntu-latest
steps:
- name: Check out TS Project Git repository
uses: actions/checkout@v5
with:
fetch-depth: 0
- name: Helm Lint Checks
uses: MapColonies/shared-workflows/actions/helm-lint@helm-lint-v1
security:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@master
- name: Run Snyk to check for vulnerabilities
uses: snyk/actions/node@master
continue-on-error: true
env:
SNYK_TOKEN: ${{ secrets.SNYK_TOKEN }}
tests:
name: Run Tests
runs-on: ubuntu-latest
strategy:
matrix:
node: [24.x]
services:
# Label used to access the service container
postgres:
# Docker Hub image
image: postgis/postgis:14-3.3
# Provide the password for postgres
env:
POSTGRES_PASSWORD: ${{ env.DB_PASSWORD}}
POSTGRES_USER: ${{ env.DB_USERNAME }}
POSTGRES_DB: ${{ env.DB_NAME }}
DEST_DB_NAME: ${{ env.DB_USERNAME }}
DEST_DB_SCHEMA: ${{ env.DB_SCHEMA }}
DEST_DB_PASSWORD: ${{ env.DB_PASSWORD }}
SOURCE_DB_NAME: ${{ env.DB_USERNAME }}
SOURCE_DB_SCHEMA: ${{ env.SOURCE_DB_SCHEMA }}
SOURCE_DB_PASSWORD: ${{ env.DB_PASSWORD }}
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
steps:
- name: Check out Git repository
uses: actions/checkout@v5
- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node }}
cache: npm
- name: Install dependencies
run: npm install
- name: Build workspace dependencies
run: npx lerna run build --scope=@map-colonies/vector-standard-db
- name: Install pg client
run: |
sudo apt-get update && sudo apt-get install -y lsb-release
echo "deb http://apt.postgresql.org/pub/repos/apt $(lsb_release -cs)-pgdg main" | sudo tee /etc/apt/sources.list.d/pgdg.list > /dev/null
wget --quiet -O - https://www.postgresql.org/media/keys/ACCC4CF8.asc | sudo tee /usr/share/keyrings/postgresql-keyring.asc > /dev/null
echo "deb [signed-by=/usr/share/keyrings/postgresql-keyring.asc] http://apt.postgresql.org/pub/repos/apt $(lsb_release -cs)-pgdg main" | sudo tee /etc/apt/sources.list.d/pgdg.list > /dev/null
sudo apt-get update
sudo apt-get install -y postgresql-client
shell: bash
- name: Create schema
run: psql -h $DB_HOST -d $DB_NAME -U $DB_USERNAME -c 'CREATE SCHEMA IF NOT EXISTS ${{ env.DB_SCHEMA }}; CREATE SCHEMA IF NOT EXISTS ${{ env.SOURCE_DB_SCHEMA }};'
env:
PGPASSWORD: ${{ env.DB_PASSWORD }}
- name: Run migrations
run: npx lerna run migration:run
- name: Run tests
run: npx lerna run test
- uses: actions/upload-artifact@v4
with:
name: Test Reporters Node-${{ matrix.node }}
path: packages/*/html/**
build_docker_migrations_image:
name: Build Docker Migrations Image
runs-on: ubuntu-latest
steps:
- name: Check out TS Project Git repository
uses: actions/checkout@v5
- name: build migrations Docker image
run: docker build -f ./packages/db/migrations.Dockerfile -t test-migrations-build:latest .
build_docker_image:
name: Build Docker Image
runs-on: ubuntu-latest
strategy:
matrix:
package: [api, synchronizer]
steps:
- name: Check out Git repository
uses: actions/checkout@v6
- name: Build and Push Docker image
uses: docker/build-push-action@v6
with:
context: .
file: ./packages/${{ matrix.package }}/Dockerfile
push: false
tags: ${{ matrix.package }}:latest