-
Notifications
You must be signed in to change notification settings - Fork 3
144 lines (139 loc) · 5.55 KB
/
test-build-mssql.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
132
133
134
135
136
137
138
139
140
141
142
143
144
name: Test Build Mssql
on:
schedule:
- cron: "0 0 * * *"
#on: workflow_dispatch
env:
DB_USER: admin
DB_PASSWORD: yourStrong(!)Password
DB_DATABASE: watchmen
DB_ROOT_PASSWORD: admin
jobs:
test-api:
runs-on: ubuntu-latest
services:
mssql:
image: mcr.microsoft.com/mssql/server:2017-latest
ports:
- 1433:1433
env:
ACCEPT_EULA: Y
SA_PASSWORD: ${{env.DB_PASSWORD}}
options: --name=mssql --health-cmd="/opt/mssql-tools/bin/sqlcmd -S 127.0.0.1 -U SA -P 'yourStrong(!)Password' -Q 'SELECT 1'" --health-interval=10s --health-timeout=10s --health-retries=5
steps:
- name: Check out repository code
uses: actions/checkout@v3
- name: Create database
run: |
sudo apt-get update && sudo apt-get install -y mssql-tools
/opt/mssql-tools/bin/sqlcmd -S 127.0.0.1,1433 -U SA -P 'yourStrong(!)Password' -Q 'CREATE DATABASE watchmen'
- name: Run db meta script
run: |
script_path=./packages/watchmen-storage-mssql/meta-scripts
for version in `ls ${script_path}`
do
if [ -d ${script_path}/$version ];then
for file in ${script_path}/$version/*
do
echo `pwd`/$file
/opt/mssql-tools/bin/sqlcmd -S 127.0.0.1,1433 -U SA -P 'yourStrong(!)Password' -d watchmen -i $file
done
fi
done
- name: Run db data script
run: |
script_path=./packages/watchmen-storage-mssql/data-scripts
for version in `ls ${script_path}`
do
if [ -d ${script_path}/$version ];then
for file in ${script_path}/$version/*
do
echo `pwd`/$file
/opt/mssql-tools/bin/sqlcmd -S 127.0.0.1,1433 -U SA -P 'yourStrong(!)Password' -d watchmen -i $file
done
fi
done
- name: Setup python
uses: actions/setup-python@v3
with:
python-version: '3.9'
architecture: 'x64'
- name: Setup poetry
run: |
python -m pip install --upgrade pip
pip install poetry
- name: Make directory for server log
working-directory: ./packages/watchmen-rest-doll
run: mkdir -p temp
- name: build [watchmen-rest-doll] and start
working-directory: ./packages/watchmen-rest-doll
env:
LOGGER_LEVEL: INFO
LOGGER_TO_FILE: TRUE
BASE_PATH: ${{ github.workspace }}
META_STORAGE_TYPE: mssql
META_STORAGE_USER_NAME: SA
META_STORAGE_PASSWORD: yourStrong(!)Password
META_STORAGE_HOST: 127.0.0.1
META_STORAGE_PORT: 1433
META_STORAGE_NAME: watchmen
TUPLE_DELETABLE: True
SYNC_TOPIC_TO_STORAGE: TRUE
REPLACE_TOPIC_TO_STORAGE: TRUE
PIPELINE_ELASTIC_SEARCH_EXTERNAL_WRITER: TRUE
META_STORAGE_ECHO: FALSE
PIPELINE_PARALLEL_ACTIONS_IN_LOOP_UNIT: True
USE_STORAGE_DIRECTLY: TRUE
run: |
poetry config virtualenvs.create false
poetry update
poetry install --no-dev -vv -E mssql -E trino
uvicorn watchmen_rest_doll.main:app --host='0.0.0.0' --port='8000' > server.out 2>&1 &
- name: Install Node
uses: actions/setup-node@v3
with:
node-version: 16
- name: Install newman
run: |
npm install -g newman
npm install -g newman-reporter-htmlextra
- name: Make directory for result
run: mkdir -p testResults
- name: Run postman collection
run: |
newman run ./packages/watchmen-test-postman/watchmen-postman.json -e ./packages/watchmen-test-postman/mssql.json --bail -r cli,htmlextra --reporter-htmlextra-export testResults/htmlreport.html --delay-request 1000
- name: Output the run details
uses: actions/upload-artifact@v2
if: always()
with:
name: RunReports
path: testResults
- name: Output the doll details
uses: actions/upload-artifact@v2
if: always()
with:
name: DollServerOput
path: ./packages/watchmen-rest-doll/temp
- name: Send email
if: always()
uses: dawidd6/action-send-mail@v3.2.0
with:
server_address: smtp.feishu.cn
server_port: 465
username: github-ci@mail.matrdata.com
password: ${{secrets.MAIL_PASSWORD}}
subject: job ${{ job.status }} for ${{ github.job }} job of ${{ github.repository }}
to: ci-postman@mail.matrdata.com
from: github-ci@mail.matrdata.com
body: ${{ github.job }} job in worflow ${{ github.workflow }} of ${{ github.repository }} has ${{ job.status }}
attachments: testResults/htmlreport.html
- name: notify feishu
if: always()
uses: potaesm/github-actions-request@1.0.7
with:
url: ${{ secrets.FEISHU_CHANNLE_ID }}
method: post
baseURL: https://open.feishu.cn/open-apis/bot/v2/hook
headers: '{ "Content-Type": "application/json" }'
data: '{"msg_type":"interactive","card":{"config":{"wide_screen_mode":true},"header":{"title":{"tag":"lark_md","content":"Mssql CI testing ${{ job.status }}"}},"elements":[{"tag":"hr"},{"tag":"action","actions":[{"tag":"button","text":{"tag":"plain_text","content":"Check it out."},"type":"primary","url":"https://github.com/Indexical-Metrics-Measure-Advisory/watchmen/actions"}]}]}}'
timeout: 30000