-
Notifications
You must be signed in to change notification settings - Fork 6
177 lines (155 loc) · 5 KB
/
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
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
name: Test Implementations
on:
push:
branches: [ main ]
paths-ignore:
- '**.md'
pull_request:
paths-ignore:
- '**.md'
jobs:
extension-mv2:
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v3
with:
path: 'reference-tests'
- uses: actions/checkout@v3
with:
repository: 'duckduckgo/duckduckgo-privacy-extension'
path: 'extension'
- uses: actions/setup-node@v3
with:
node-version: 18
cache: 'npm'
cache-dependency-path: 'extension/package-lock.json'
- run: cd reference-tests && npm link
- name: Setup Extension
working-directory: ./extension
run: |
npm run install-ci
npm link @duckduckgo/privacy-reference-tests
- name: Test Extension (MV2)
working-directory: ./extension
run: |
npm test
ddg2dnr:
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v3
with:
path: 'reference-tests'
- uses: actions/checkout@v3
with:
repository: 'duckduckgo/duckduckgo-privacy-extension'
path: 'extension'
- uses: actions/setup-node@v3
with:
node-version: 18
cache: 'npm'
cache-dependency-path: 'extension/package-lock.json'
- run: cd reference-tests && npm link
- name: Setup Extension
working-directory: ./extension
run: |
npm run install-ci
npm link @duckduckgo/privacy-reference-tests
- name: Test ddg2dnr (MV3)
working-directory: ./extension/packages/ddg2dnr
run: npm test -- --grep Reference
BrowserServicesKit:
name: BSK unit tests
runs-on: macos-13
timeout-minutes: 30
steps:
- name: Check out the code
uses: actions/checkout@v3
with:
repository: 'duckduckgo/BrowserServicesKit'
path: 'BrowserServicesKit'
- name: Check out the tests
uses: actions/checkout@v3
with:
path: 'BrowserServicesKit/Tests/BrowserServicesKitTests/Resources/privacy-reference-tests'
- name: Set cache key hash
working-directory: ./BrowserServicesKit
run: |
has_only_tags=$(jq '[ .pins[].state | has("version") ] | all' Package.resolved)
if [[ "$has_only_tags" == "true" ]]; then
echo "cache_key_hash=${{ hashFiles('Package.resolved') }}" >> $GITHUB_ENV
else
echo "Package.resolved contains dependencies specified by branch or commit, skipping cache."
fi
- name: Cache SPM
if: env.cache_key_hash
uses: actions/cache@v3
with:
path: ./BrowserServicesKit/build
key: ${{ runner.os }}-spm-${{ env.cache_key_hash }}
restore-keys: |
${{ runner.os }}-spm-
- name: Select Xcode
run: sudo xcode-select -s /Applications/Xcode_15.0.app/Contents/Developer
- name: Install xcbeautify
continue-on-error: true
run: brew install xcbeautify
- name: Run tests
working-directory: ./BrowserServicesKit
run: set -o pipefail && swift test | tee build-log.txt | xcbeautify --report junit --report-path . --junit-report-filename tests.xml
- name: Publish Unit Tests Report
uses: mikepenz/action-junit-report@v3
if: always()
with:
check_name: BSK Test Report
report_paths: ./BrowserServicesKit/tests.xml
require_tests: true
- name: Upload logs
uses: actions/upload-artifact@v3
if: always()
with:
name: build-log.txt
path: ./BrowserServicesKit/build-log.txt
AndroidUnit:
name: Android unit tests
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
path: 'reference-tests'
- name: Checkout repository
uses: actions/checkout@v3
with:
repository: 'duckduckgo/android'
path: 'android'
submodules: recursive
- name: Link reference-tests
working-directory: reference-tests
run: npm link
- name: Setup NPM deps
working-directory: android
run: |
npm install -g copy-files-from-to
npm ci
npm link @duckduckgo/privacy-reference-tests
- name: Copy files
working-directory: android
run: copy-files-from-to
- name: Set up JDK 17
uses: actions/setup-java@v3
with:
java-version: '17'
distribution: 'adopt'
- name: JVM tests
uses: gradle/gradle-build-action@v2
with:
arguments: jvm_tests
build-root-directory: android
- name: Bundle the JVM checks report
if: always()
run: find ./android/ -type d -name 'reports' | zip -@ -r unit-tests-report.zip
- name: Upload the JVM checks report
if: always()
uses: actions/upload-artifact@v3
with:
name: unit-tests-report
path: unit-tests-report.zip