-
Notifications
You must be signed in to change notification settings - Fork 117
136 lines (120 loc) · 4.11 KB
/
linux_tests.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
name: Linux 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:
build_test_addons:
name: Build Test Addons
uses: ./.github/workflows/build_addons.yaml
with:
test-addons-name: test-addons-${{ github.sha }}
build_test_app:
name: Build Test Client
runs-on: ubuntu-22.04
outputs:
matrix: ${{ steps.enumerate.outputs.tests }}
steps:
- name: Clone repository
uses: actions/checkout@v4
with:
submodules: "recursive"
- run: |
sudo apt-get update
sudo apt-get install -y $(./scripts/linux/getdeps.py -a linux/debian/control) ccache
- uses: actions/setup-python@v5
with:
python-version: "3.9"
cache: "pip"
- run: pip install -r requirements.txt
- name: Setup compiler cache
uses: actions/cache@v4
with:
path: ~/.cache/ccache
key: ccache-${{ runner.os }}-${{ runner.arch }}-${{ github.sha }}
lookup-only: github.event_name == 'pull_request'
restore-keys: ccache-${{ runner.os }}-${{ runner.arch }}-${{ github.event_name == 'pull_request' && github.event.pull_request.base.sha || github.sha }}
- name: Compile test client
shell: bash
run: |
mkdir -p build-${{ runner.os }}
cmake -S $(pwd) -B build-${{ runner.os }} -GNinja -DCMAKE_BUILD_TYPE=RelWithDebInfo \
-DCMAKE_CXX_COMPILER_LAUNCHER=ccache -DCMAKE_C_COMPILER_LAUNCHER=ccache
cmake --build build-${{ runner.os }} --target mozillavpn
- uses: actions/upload-artifact@v4
with:
name: test-client-${{ github.sha }}
path: |
build-${{ runner.os }}/*.txt
build-${{ runner.os }}/*.cmake
build-${{ runner.os }}/src/mozillavpn
build-${{ runner.os }}/tests/functional
- name: Generate tasklist
id: enumerate
shell: bash
run: |
echo -n "tests=" >> $GITHUB_OUTPUT
for test in $(find tests/functional -name 'test*.js' | sort); do
printf '{"name": "%s", "path": "%s"}' $(basename ${test%.js} | sed -n 's/test//p') $test
done | jq -s -c >> $GITHUB_OUTPUT
functionaltests:
name: Functional tests
needs:
- build_test_app
- build_test_addons
runs-on: ubuntu-22.04
timeout-minutes: 45
strategy:
fail-fast: false # Don't cancel other jobs if a test fails
matrix:
test: ${{ fromJson(needs.build_test_app.outputs.matrix) }}
steps:
- name: Clone repository
uses: actions/checkout@v4
- uses: actions/download-artifact@v4
with:
name: test-client-${{ github.sha }}
path: build-${{ runner.os }}
- uses: actions/download-artifact@v4
with:
name: test-addons-${{ github.sha }}
path: build-${{ runner.os }}/tests/functional/addons
- name: Install test dependecies
run: |
sudo apt-get update
sudo apt-get install -y $(./scripts/linux/getdeps.py -r linux/debian/control)
sudo apt install --no-upgrade firefox xvfb -y
chmod +x build-${{ runner.os }}/src/mozillavpn
- uses: actions/setup-python@v5
with:
python-version: "3.9"
cache: "pip"
- run: pip install -r requirements.txt
- uses: actions/setup-node@v4
with:
node-version: 18
cache: "npm"
- run: npm install
- name: Running ${{ matrix.test.name }} Tests
id: runTests
shell: bash
env:
TZ: Europe/London
HEADLESS: yes
ARTIFACT_DIR: ${{ runner.temp }}/artifacts
run: ctest -R test${{matrix.test.name}} --test-dir build-${{ runner.os }} --verbose
- name: Uploading artifacts
uses: actions/upload-artifact@v4
if: ${{ always() }}
with:
name: ${{ matrix.test.name }} Logs
path: ${{ runner.temp }}/artifacts