-
Notifications
You must be signed in to change notification settings - Fork 4
143 lines (124 loc) · 5.29 KB
/
run-tests.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
name: run-tests
on: [pull_request, workflow_dispatch]
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
permissions:
contents: read
env:
VIDEO_SERVICE_PROVIDER: ${{vars.VIDEO_SERVICE_PROVIDER}}
OT_API_KEY: ${{secrets.API_KEY}}
OT_API_SECRET: ${{secrets.API_SECRET}}
VONAGE_APP_ID: ${{secrets.VONAGE_APP_ID}}
VONAGE_PRIVATE_KEY: ${{secrets.VONAGE_PRIVATE_KEY}}
jobs:
run:
runs-on: ubuntu-22.04
steps:
- name: Check for "skip-ci" label
id: check-skip-ci
uses: actions/github-script@v6
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
script: |
const pr = context.payload.pull_request;
const labels = pr.labels.map(label => label.name);
return labels.includes("skip-ci");
- name: Skip CI
if: steps.check-skip-ci.outputs.result == 'true'
run: |
echo "Skipping CI :^)"
- name: Checkout
if: steps.check-skip-ci.outputs.result == 'false'
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Install chrome latest
if: steps.check-skip-ci.outputs.result == 'false'
run: |
wget -q -O - https://dl.google.com/linux/linux_signing_key.pub | sudo apt-key add -
sudo sh -c 'echo "deb [arch=amd64] http://dl.google.com/linux/chrome/deb/ stable main" >> /etc/apt/sources.list.d/google.list'
sudo apt update && sudo apt install -y google-chrome-stable
echo "Check chrome version"
/usr/bin/google-chrome-stable --version
echo "Chrome latest downloaded and installed"
- name: Install edge latest
if: steps.check-skip-ci.outputs.result == 'false'
run: |
curl https://packages.microsoft.com/keys/microsoft.asc | gpg --dearmor > microsoft.gpg
sudo install -o root -g root -m 644 microsoft.gpg /etc/apt/trusted.gpg.d/
sudo sh -c 'echo "deb [arch=amd64] https://packages.microsoft.com/repos/edge stable main" > /etc/apt/sources.list.d/microsoft-edge-dev.list'
sudo rm microsoft.gpg
sudo apt update && sudo apt install -y microsoft-edge-stable
echo "Check edge version"
/usr/bin/microsoft-edge-stable --version
echo "Edge latest downloaded and installed"
- name: install firefox latest
if: steps.check-skip-ci.outputs.result == 'false'
run: |
sudo apt update
wget -O firefoxsetup.tar.bz2 "https://download.mozilla.org/?product=firefox-latest&os=linux64&lang=en-US"
sudo tar -xf firefoxsetup.tar.bz2 --directory /opt
echo "Check firefox version"
/opt/firefox/firefox --version
echo "Firefox latest downloaded and installed"
- name: Install opera latest
run: |
sudo add-apt-repository 'deb https://deb.opera.com/opera-stable/ stable non-free'
wget -qO- https://deb.opera.com/archive.key | sudo apt-key add -
sudo apt-get update
sudo apt-get install opera-stable -y
echo "Check opera version"
/usr/bin/opera --version
echo "Opera latest downloaded and installed"
- name: Setup node
if: steps.check-skip-ci.outputs.result == 'false'
uses: actions/setup-node@v3
with:
node-version: 22
cache: npm
- name: Install Dependencies
if: steps.check-skip-ci.outputs.result == 'false'
run: |
node -v
npm -v
npm install --global yarn
yarn
- name: Install electron dependencies
run: |
sudo apt-get update
sudo apt-get install -y libgtk-3-0 libx11-xcb1 libxcomposite1 libxrandr2 libxdamage1 libxi6 libxtst6 libnss3 libasound2
- name: Run unit tests
if: steps.check-skip-ci.outputs.result == 'false'
run: |
yarn test
- name: SonarCloud Scan On PR
if: steps.check-skip-ci.outputs.result == 'false' && github.event.pull_request.head.repo.fork == false
uses: SonarSource/sonarqube-scan-action@v4
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
PR_NUMBER: ${{ github.event.pull_request.number }}
PR_BRANCH: ${{ github.head_ref }}
BASE_BRANCH: ${{ github.event.pull_request.head.ref }}
with:
args: >
-Dsonar.pullrequest.key="$PR_NUMBER"
-Dsonar.pullrequest.branch="$PR_BRANCH"
-Dsonar.pullrequest.base="$BASE_BRANCH"
- name: SonarCloud Branch Analysis On base branch
if: steps.check-skip-ci.outputs.result == 'false' && github.event.pull_request.head.repo.fork == false
uses: SonarSource/sonarqube-scan-action@v4
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
BASE_BRANCH: ${{ github.event.pull_request.head.ref }}
with:
args: >
-Dsonar.branch.name="$BASE_BRANCH"
- name: Run integration tests
if: steps.check-skip-ci.outputs.result == 'false' && github.event.pull_request.head.repo.fork == false
run: |
echo "VIDEO_SERVICE_PROVIDER: $VIDEO_SERVICE_PROVIDER"
Xvfb :99 & export DISPLAY=:99
yarn test:integration