-
-
Notifications
You must be signed in to change notification settings - Fork 19
120 lines (112 loc) · 3.91 KB
/
ci.yml
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
name: Node.js CI
on:
push:
branches:
- '**'
pull_request:
branches:
- '**'
jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
container: ["node:18-bookworm", "node:20-bookworm", "node:22-bookworm"]
container:
image: ${{ matrix.container }}
services:
postgres:
image: postgres
env:
POSTGRES_PASSWORD: postgres
POSTGRES_DB: postgres
# Set health checks to wait until postgres has started
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
ports:
- 5432:5432
mssql:
image: mcr.microsoft.com/mssql/server:2019-latest
env:
SA_PASSWORD: P@assword123
ACCEPT_EULA: 'Y'
ports:
- 1433:1433
mysql:
image: mysql:8.0.31
env:
MYSQL_DATABASE: test
MYSQL_USER: test
MYSQL_PASSWORD: test
MYSQL_ROOT_PASSWORD: test
ports:
- 3306:3306
options: >-
--health-cmd="mysqladmin ping"
--health-interval=10s
--health-timeout=5s
--health-retries=3
sapase:
image: larsroald/ase-server
ports:
- 5000:5000
oracle:
image: gvenzl/oracle-xe
env:
ORACLE_PASSWORD: P@assword123
ports:
- 1521:1521
steps:
- uses: actions/checkout@v4
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
- run: curl https://packages.microsoft.com/keys/microsoft.asc | apt-key add -
- run: curl https://packages.microsoft.com/config/debian/11/prod.list > /etc/apt/sources.list.d/mssql-release.list
- run: apt-get update
- run: ACCEPT_EULA=Y apt-get install -y msodbcsql18
- run: apt-get install -y unixodbc-dev
- run: npm install
- run: npm run lint
- run: npm run tscheck
- run: npm run test
- run: npm run coverage # Only run the coverage once
- if: ${{ matrix.container == 'node:18-bookworm' && github.ref == 'refs/heads/master'}}
name: Get Coverage for badge
run: |
# var SUMMARY = [
# '',
# '=============================== Coverage summary ===============================',
# 'Statements : 32.5% ( 39/120 )',
# 'Branches : 38.89% ( 21/54 )',
# 'Functions : 21.74% ( 5/23 )',
# 'Lines : 31.93% ( 38/119 )',
# '================================================================================',
# ''
# ];
# SUMMARY = SUMMARY.split('\n')[5]; // 'Lines : 31.93% ( 38/119 )'
# SUMMARY = SUMMARY.split(':')[1].split('(')[0].trim(); // '31.93%'
SUMMARY="$(npm run coverage | tail -2 | head -1)"
echo "SUMMARY=$SUMMARY"
COVERAGE=$(echo $SUMMARY | awk -F':' '{print $2}' | awk '{print $1}')
echo "COVERAGE=$COVERAGE"
echo "COVERAGE=$COVERAGE" >> $GITHUB_ENV
BRANCH_NAME=$(echo $GITHUB_REF | awk 'BEGIN { FS = "/" } ; { print $2 "_" $3 }')
echo "BRANCH_NAME=$BRANCH_NAME"
echo "BRANCH=$BRANCH_NAME" >> $GITHUB_ENV
- if: ${{ matrix.container == 'node:16-alpine' && github.ref == 'refs/heads/master'}}
name: Create the Badge
uses: schneegans/dynamic-badges-action@v1.7.0
with:
auth: ${{ secrets.GIST_SECRET }}
gistID: 1a69422f03da7f8155cf94fe66022452
filename: rdb__${{ env.BRANCH }}.json
# https://gist.githubusercontent.com/lroal/1a69422f03da7f8155cf94fe66022452/raw/rdb___.json
label: coverage
message: ${{ env.COVERAGE }}
color: green
namedLogo: vitest