Skip to content

Commit ee8f570

Browse files
authored
ci: improve workflows (#542)
1 parent 6eb0436 commit ee8f570

File tree

5 files changed

+975
-60
lines changed

5 files changed

+975
-60
lines changed

.github/actions/setup/action.yml

+17
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
name: 'Setup job'
2+
description: ''
3+
4+
runs:
5+
using: 'composite'
6+
steps:
7+
- name: Setup node
8+
uses: actions/setup-node@v4
9+
with:
10+
node-version: 20.10.0
11+
cache: yarn
12+
13+
- name: Run yarn install
14+
shell: bash
15+
run: yarn --frozen-lockfile
16+
env:
17+
CI: 'true'

.github/workflows/commitlint.yml

+30
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
on:
2+
pull_request:
3+
types: [synchronize, edited, opened]
4+
5+
concurrency:
6+
group: ${{ github.workflow }}-${{ github.ref }}
7+
cancel-in-progress: true
8+
9+
jobs:
10+
lint:
11+
runs-on: ubuntu-latest
12+
steps:
13+
- uses: actions/checkout@v3
14+
with:
15+
fetch-depth: 0
16+
17+
- name: Setup
18+
uses: ./.github/actions/setup
19+
timeout-minutes: 10
20+
21+
- name: Lint commit messages
22+
run: yarn commitlint --from $BASE_SHA --to $HEAD_SHA --verbose
23+
env:
24+
BASE_SHA: ${{ github.event.pull_request.base.sha }}
25+
HEAD_SHA: ${{ github.event.pull_request.head.sha }}
26+
27+
- name: Lint pull request title
28+
run: echo $PR_TITLE | yarn commitlint --verbose
29+
env:
30+
PR_TITLE: ${{ github.event.pull_request.title }}

.github/workflows/main.yml

+33-60
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,9 @@ on:
44
pull_request:
55
push:
66

7-
87
jobs:
98
unit-tests:
109
runs-on: ubuntu22-4x16
11-
strategy:
12-
matrix:
13-
node-version: [20.10.0]
1410
services:
1511
storage-ftp:
1612
image: garethflowers/ftp-server:0.7.0
@@ -28,20 +24,10 @@ jobs:
2824
- '2222:22'
2925
steps:
3026
- uses: actions/checkout@v4
31-
- name: Install yarn
32-
run: corepack enable && yarn set version 4.0.2
33-
- name: Use Node.js ${{ matrix.node-version }}
34-
uses: actions/setup-node@v4
35-
with:
36-
node-version: ${{ matrix.node-version }}
37-
cache: yarn
38-
- name: npm install
39-
run: yarn
40-
- name: Lint commit messages
41-
run: ./node_modules/.bin/commitlint --from $BASE_SHA --to $HEAD_SHA --verbose
42-
env:
43-
BASE_SHA: ${{ github.event.pull_request.base.sha }}
44-
HEAD_SHA: ${{ github.event.pull_request.head.sha }}
27+
28+
- name: Setup
29+
uses: ./.github/actions/setup
30+
timeout-minutes: 10
4531

4632
- name: Build
4733
run: |
@@ -99,7 +85,6 @@ jobs:
9985
runs-on: ubuntu22-4x16
10086
strategy:
10187
matrix:
102-
node-version: [20.10.0]
10388
postgres-version: [14]
10489
services:
10590
postgres:
@@ -113,20 +98,18 @@ jobs:
11398
options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5
11499
steps:
115100
- uses: actions/checkout@v4
116-
- name: Install yarn
117-
run: corepack enable && yarn set version 4.0.2
118-
- name: Use Node.js ${{ matrix.node-version }}
119-
uses: actions/setup-node@v4
120-
with:
121-
node-version: ${{ matrix.node-version }}
122-
cache: yarn
123-
- name: npm install
124-
run: corepack enable && yarn set version 4.0.2 && yarn
101+
102+
- name: Setup
103+
uses: ./.github/actions/setup
104+
timeout-minutes: 10
105+
125106
- name: Build
126107
run: |
127108
./node_modules/.bin/tsc --build packages/postgres/tsconfig.json;
109+
128110
- name: Test
129111
run: npm run test:coverage packages/postgres/
112+
130113
- name: Send coverage
131114
run: ./node_modules/.bin/codecov -f coverage/*.json
132115

@@ -136,7 +119,6 @@ jobs:
136119
runs-on: ubuntu22-4x16
137120
strategy:
138121
matrix:
139-
node-version: [20.10.0]
140122
mysql-version: [8.0]
141123
services:
142124
mysql:
@@ -149,46 +131,39 @@ jobs:
149131
- '3306:3306'
150132
steps:
151133
- uses: actions/checkout@v4
152-
- name: Install yarn
153-
run: corepack enable && yarn set version 4.0.2
154-
- name: Use Node.js ${{ matrix.node-version }}
155-
uses: actions/setup-node@v4
156-
with:
157-
node-version: ${{ matrix.node-version }}
158-
cache: yarn
159-
- name: npm install
160-
run: corepack enable && yarn set version 4.0.2 && yarn
134+
135+
- name: Setup
136+
uses: ./.github/actions/setup
137+
timeout-minutes: 10
138+
161139
- name: Build
162140
run: |
163141
./node_modules/.bin/tsc --build packages/mysql/tsconfig.json
142+
164143
- name: Test
165144
run: npm run test:coverage packages/mysql/
145+
166146
- name: Send coverage
167147
run: ./node_modules/.bin/codecov -f coverage/*.json
168148

169149
orm-sqlite:
170150
needs:
171151
- unit-tests
172152
runs-on: ubuntu22-4x16
173-
strategy:
174-
matrix:
175-
node-version: [20.10.0]
176153
steps:
177154
- uses: actions/checkout@v4
178-
- name: Install yarn
179-
run: corepack enable && yarn set version 4.0.2
180-
- name: Use Node.js ${{ matrix.node-version }}
181-
uses: actions/setup-node@v4
182-
with:
183-
node-version: ${{ matrix.node-version }}
184-
cache: yarn
185-
- name: npm install
186-
run: corepack enable && yarn set version 4.0.2 && yarn
155+
156+
- name: Setup
157+
uses: ./.github/actions/setup
158+
timeout-minutes: 10
159+
187160
- name: Build
188161
run: |
189162
./node_modules/.bin/tsc --build packages/sqlite/tsconfig.json
163+
190164
- name: Test
191165
run: npm run test:coverage packages/sqlite/
166+
192167
- name: Send coverage
193168
run: ./node_modules/.bin/codecov -f coverage/*.json
194169

@@ -198,7 +173,6 @@ jobs:
198173
runs-on: ubuntu22-4x16
199174
strategy:
200175
matrix:
201-
node-version: [20.10.0]
202176
mongo-version: [4.0]
203177
services:
204178
# this is used for the simple-auth test
@@ -218,20 +192,19 @@ jobs:
218192
with:
219193
mongodb-version: ${{ matrix.mongo-version }}
220194
mongodb-replica-set: test-rs
195+
221196
- uses: actions/checkout@v4
222-
- name: Install yarn
223-
run: corepack enable && yarn set version 4.0.2
224-
- name: Use Node.js ${{ matrix.node-version }}
225-
uses: actions/setup-node@v4
226-
with:
227-
node-version: ${{ matrix.node-version }}
228-
cache: yarn
229-
- name: Install
230-
run: corepack enable && yarn set version 4.0.2 && yarn
197+
198+
- name: Setup
199+
uses: ./.github/actions/setup
200+
timeout-minutes: 10
201+
231202
- name: Build
232203
run: |
233204
./node_modules/.bin/tsc --build packages/mongo/tsconfig.json
205+
234206
- name: Test
235207
run: npm run test:coverage packages/mongo/
208+
236209
- name: Send coverage
237210
run: ./node_modules/.bin/codecov -f coverage/*.json

0 commit comments

Comments
 (0)