-
Notifications
You must be signed in to change notification settings - Fork 471
145 lines (125 loc) · 4.2 KB
/
daily-build-and-test.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
145
name: CI
on:
schedule:
- cron: '0 0 * * *'
push:
branches:
- main
pull_request:
branches:
- main
workflow_dispatch:
permissions:
contents: read
actions: read
checks: write
jobs:
build-and-test:
runs-on: ubuntu-latest
steps:
- name: Checkout Repository
uses: actions/checkout@v4
- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: '18'
- name: Set up xvfb
run: |
sudo apt-get update
sudo apt-get install -y libxkbfile-dev pkg-config libsecret-1-dev libkrb5-dev libxss1 dbus xvfb libgtk-3-0 libgbm1
sudo cp build/xvfb.init /etc/init.d/xvfb
sudo chmod +x /etc/init.d/xvfb
sudo update-rc.d xvfb defaults
sudo service xvfb start
- name: Install tools
run: |
echo "Installing Yarn"
npm install --global [email protected]
echo "Installing Gulp CLI"
npm install --global [email protected]
echo "Installing VSCE"
npm install --global [email protected]
echo "Installing gulp"
npm install --global [email protected]
- name: Install extension dependencies
run: |
yarn --frozen-lockfile
- name: Install playwright dependencies
run: |
npx playwright install --with-deps
- name: Build extension
run: |
yarn build
- name: Run lint
run: |
yarn lint
- name: Run tests
run: |
DISPLAY=:10 yarn test --coverage --log
- name: Unit Test Report
uses: dorny/test-reporter@v1
if: success() || failure()
with:
name: 'Unit Test Report'
path: ./test-reports/**/*.xml
reporter: jest-junit
badge-title: 'unit-tests'
- name: Generate Code Coverage Report
id: testcoverage
run: |
yarn gulp cover
- name: Code Coverage Report
uses: irongut/[email protected]
with:
filename: ./coverage/cobertura-coverage.xml
badge: true
fail_below_min: true
format: markdown
hide_branch_rate: false
hide_complexity: true
indicators: true
output: both
- name: Create a check run for code coverage
uses: LouisBrunner/[email protected]
if: always()
with:
token: ${{ secrets.GITHUB_TOKEN }}
name: Unit Test Coverage Report
conclusion: ${{ steps.testcoverage.conclusion }}
output: |
{"summary":"${{ steps.testcoverage.summary }}"}
output_text_description_file: ./code-coverage-results.md
- name: Setup environment for smoke tests
run: |
echo "Setting up environment for smoke tests"
echo "PASSWORD=$(LC_ALL=C tr -dc 'A-Za-z0-9!?%=' < /dev/urandom | head -c 16)$(LC_ALL=C tr -dc '@^#' < /dev/urandom | head -c 1)" >> $GITHUB_ENV
- name: Install mssql
run: |
sudo cp build/mssql.init /etc/init.d/mssql-server
sudo chmod +x /etc/init.d/mssql-server
curl https://packages.microsoft.com/keys/microsoft.asc | sudo tee /etc/apt/trusted.gpg.d/microsoft.asc
sudo add-apt-repository "$(wget -qO- https://packages.microsoft.com/config/ubuntu/22.04/mssql-server-2022.list)"
sudo apt-get update
sudo apt-get install -y mssql-server
sudo ACCEPT_EULA='Y' MSSQL_PID='Developer' MSSQL_SA_PASSWORD=${{ env.PASSWORD }} /opt/mssql/bin/mssql-conf setup || true
- name: Start mssql
run: |
sudo service mssql-server start
- name: Run smoke tests
run: |
VS_CODE_VERSION=stable
SERVER_NAME=localhost
AUTHENTICATION_TYPE="SQL Login"
USER_NAME=sa
PASSWORD=${{ env.PASSWORD }}
SAVE_PASSWORD=No
PROFILE_NAME=test-server
DISPLAY=:10 yarn smoketest
- name: Smoke Test Report
uses: dorny/test-reporter@v1
if: success() || failure()
with:
name: 'Smoke Test Report'
path: ./test-reports/**/smoke-results.xml
reporter: jest-junit
badge-title: 'smoke-tests'