-
Notifications
You must be signed in to change notification settings - Fork 118
184 lines (152 loc) · 5.42 KB
/
test_unit.yaml
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
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
name: Unit Tests
on:
push:
branches:
- main
- "releases/**"
pull_request:
branches:
- main
- "releases/**"
# Restrict tests to the most recent commit.
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
linux-unit-tests:
runs-on: ubuntu-22.04
name: Run Unit tests on Linux
steps:
- name: Clone repository
uses: actions/checkout@v4
with:
submodules: "recursive"
- name: Install dependences
run: |
sudo apt-get update
sudo apt-get install -y $(./scripts/linux/getdeps.py -a linux/debian/control)
- uses: actions/setup-python@v5
with:
python-version: "3.9"
cache: "pip"
- run: pip install -r requirements.txt
- name: Building tests
shell: bash
run: |
mkdir -p build
cmake -S . -B $(pwd)/build -GNinja
cmake --build $(pwd)/build --target build_tests
- name: Running native messaging tests
shell: bash
run: ctest -L nativemessaging --test-dir $(pwd)/build --output-on-failure
- name: Running QML tests
shell: bash
run: ctest -L qml --test-dir $(pwd)/build --output-on-failure
- name: Running unit tests
shell: bash
run: ctest -L unit --test-dir $(pwd)/build --output-on-failure
macos-unit-tests:
runs-on: macos-latest
defaults:
run:
shell: bash -el {0}
name: Run Unit tests on MacOS
steps:
- name: Clone repository
uses: actions/checkout@v4
with:
submodules: "recursive"
- uses: conda-incubator/setup-miniconda@v3
with:
miniconda-version: "latest"
environment-file: env.yml
activate-environment: vpn
- name: Install dependencies
run: |
./scripts/macos/conda_install_extras.sh
export SDKROOT=$(xcrun --sdk macosx --show-sdk-path)
brew install ninja
- name: Install Qt6
run: |
wget https://firefox-ci-tc.services.mozilla.com/api/index/v1/task/mozillavpn.v2.mozillavpn.cache.level-3.toolchains.v3.qt-macos-6.6.latest/artifacts/public%2Fbuild%2Fqt6_mac.zip -O mac.zip
unzip -a mac.zip
sudo mv qt_dist /opt
cd ..
- name: Building tests
run: |
export PATH=/opt/qt_dist/bin:$PATH
mkdir -p build
cmake -S . -B $(pwd)/build -GNinja
cmake --build $(pwd)/build --target build_tests
- name: Running native messaging tests
run: ctest -L nativemessaging --test-dir $(pwd)/build --output-on-failure
- name: Running QML tests
run: ctest -L qml --test-dir $(pwd)/build --output-on-failure
- name: Running unit tests
run: ctest -L unit --test-dir $(pwd)/build --output-on-failure
windows-unit-tests:
name: Run Unit tests on Windows
runs-on: windows-latest
steps:
- name: Clone repository
uses: actions/checkout@v4
with:
submodules: "recursive"
- name: Install Qt
shell: pwsh
run: |
Invoke-WebRequest -Uri https://firefox-ci-tc.services.mozilla.com/api/index/v1/task/mozillavpn.v2.mozillavpn.cache.level-3.toolchains.v3.qt-windows-x86_64-6.6.latest/artifacts/public%2Fbuild%2Fqt6_win.zip -OutFile win.zip
Expand-Archive win.zip
mv win\QT_OUT "C:\\MozillaVPNBuild"
- name: Add msvc dev commands to PATH
uses: ilammy/msvc-dev-cmd@v1
- name: Add msbuild to PATH
uses: microsoft/setup-msbuild@v2
- uses: actions/setup-python@v5
with:
python-version: "3.9"
cache: "pip"
- run: pip install -r requirements.txt
- name: Cache Wireguard NT
id: cache-wireguard-nt
uses: actions/cache@v4
with:
path: 3rdparty/wireguard-nt
key: wireguard-nt-${{ hashFiles('windows/wireguard_nt/CMakeLists.txt') }}
- name: Download Wireguard NT
if: steps.cache-wireguard-nt.outputs.cache-hit != 'true'
shell: bash
run: |
WIREGUARD_NT_URL=$(grep -Eo 'DOWNLOAD[[:space:]].*' windows/wireguard_nt/CMakeLists.txt | awk '{print $2}')
curl -sSL -o wireguard-nt.zip $WIREGUARD_NT_URL
unzip -d 3rdparty/ wireguard-nt.zip
- name: Building tests
run: |
mkdir ./build
cmake -S . -B ./build -GNinja -DCMAKE_BUILD_TYPE=Debug -DCMAKE_PREFIX_PATH="C:\MozillaVPNBuild\lib\cmake" -DWIREGUARD_FOLDER="3rdparty/wireguard-nt"
cmake --build ./build --target build_tests
- name: Running native messaging tests
shell: bash
run: ctest -L nativemessaging --test-dir ./build --output-on-failure
- name: Running QML tests
shell: bash
run: ctest -L qml --test-dir ./build --output-on-failure
- name: Running unit tests
shell: bash
run: ctest -L unit --test-dir ./build --output-on-failure
rust-unit-tests:
strategy:
matrix:
os: [ubuntu-22.04, windows-latest, macos-latest]
runs-on: ${{ matrix.os }}
name: Run Unit tests for Rust (${{ matrix.os }})
steps:
- name: Clone repository
uses: actions/checkout@v4
- name: Fetch glean submodules
run: |
git submodule update --init 3rdparty/glean
- name: Signature library tests
shell: bash
working-directory: ./signature
run: cargo test -- --nocapture