-
-
Notifications
You must be signed in to change notification settings - Fork 20
131 lines (123 loc) · 4.76 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
121
122
123
124
125
126
127
128
129
130
131
name: Node.js CI
on:
push:
branches:
- '**'
pull_request:
branches:
- '**'
jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
container: ["node:16-alpine", "node:18-alpine", "node:20-alpine"]
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: apk update
- run: apk --no-cache add curl
- run: apk --no-cache add unixodbc
- run: apk add sudo
# - run: apk add unzip
- run: curl -O https://download.microsoft.com/download/b/9/f/b9f3cce4-3925-46d4-9f46-da08869c6486/msodbcsql18_18.1.1.1-1_amd64.apk
- run: curl -O https://download.microsoft.com/download/b/9/f/b9f3cce4-3925-46d4-9f46-da08869c6486/mssql-tools18_18.1.1.1-1_amd64.apk
- run: sudo apk add --allow-untrusted msodbcsql18_18.1.1.1-1_amd64.apk
- run: sudo apk add --allow-untrusted mssql-tools18_18.1.1.1-1_amd64.apk
- run: sudo apk add libnsl
- run: sudo apk add gcompat
- run: ln -s /usr/lib/libnsl.so.3 /usr/lib/libnsl.so.1
# - run: npm install
# - run: wget https://download.oracle.com/otn_software/linux/instantclient/193000/instantclient-basic-linux.x64-19.3.0.0.0dbru.zip && unzip instantclient-basic-linux.x64-19.3.0.0.0dbru.zip && cp -r instantclient_19_3/* /lib && rm -rf instantclient-basic-linux.x64-19.3.0.0.0dbru.zip && apk --no-cache add libaio && cd /lib && ln -s libnsl.so.2 /usr/lib/libnsl.so.1 && ln -s libc.so /usr/lib/libresolv.so.2
# - run: ldd /__w/rdb/rdb/tests/libsybdrvodb.so
- 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:16-alpine' && 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/[email protected]
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