-
Notifications
You must be signed in to change notification settings - Fork 314
149 lines (132 loc) · 5.07 KB
/
run-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
137
138
139
140
141
142
143
144
145
146
147
148
149
# This workflow will run all tests as well as pre-commit
name: Tests and linting
on:
push:
branches:
- master
pull_request:
schedule:
- cron: "0 0 */2 * *"
jobs:
pre-commit:
runs-on: ubuntu-latest
steps:
# All of these steps are just setup
- uses: actions/checkout@v4
- name: Setting MAMBA_PATH
run: echo "MAMBA_PATH=$HOME/mamba" >> $GITHUB_ENV
- name: Setting OPENWPM_MAMBA_PATH
run: echo "OPENWPM_MAMBA_PATH=$MAMBA_PATH/envs/openwpm" >> $GITHUB_ENV
# If the environment.yaml hasn't changed we just reuse the entire conda install
- id: cache
uses: actions/cache@v4
env:
cache-name: conda-cache
with:
path: ${{ env.MAMBA_PATH }}
key: ${{ env.cache-name }}-${{ hashFiles('environment.yaml') }}
- name: Install conda
if: ${{ steps.cache.outputs.cache-hit != 'true' }}
run: $GITHUB_WORKSPACE/scripts/install-mamba.sh
- run: echo "$MAMBA_PATH/bin" >> $GITHUB_PATH
- name: Install.sh (cache miss)
if: ${{ steps.cache.outputs.cache-hit != 'true' }}
run: $GITHUB_WORKSPACE/install.sh
- name: Install.sh (cache hit)
if: ${{ steps.cache.outputs.cache-hit == 'true' }}
run: $GITHUB_WORKSPACE/install.sh --skip-create
- run: echo "$OPENWPM_MAMBA_PATH/bin" >> $GITHUB_PATH
# Now we have a working OpenWPM environment
- run: pre-commit run --all
demo:
runs-on: ubuntu-latest
steps:
# All of these steps are just setup
- uses: actions/checkout@v4
- name: Setting MAMBA_PATH
run: echo "MAMBA_PATH=$HOME/mamba" >> $GITHUB_ENV
- name: Setting OPENWPM_MAMBA_PATH
run: echo "OPENWPM_MAMBA_PATH=$MAMBA_PATH/envs/openwpm" >> $GITHUB_ENV
# If the environment.yaml hasn't changed we just reuse the entire conda install
- id: cache
uses: actions/cache@v4
env:
cache-name: conda-cache
with:
path: ${{ env.MAMBA_PATH }}
key: ${{ env.cache-name }}-${{ hashFiles('environment.yaml') }}
- name: Install conda
if: ${{ steps.cache.outputs.cache-hit != 'true' }}
run: $GITHUB_WORKSPACE/scripts/install-mamba.sh
- run: echo "$MAMBA_PATH/bin" >> $GITHUB_PATH
- name: Install.sh (cache miss)
if: ${{ steps.cache.outputs.cache-hit != 'true' }}
run: $GITHUB_WORKSPACE/install.sh
- name: Install.sh (cache hit)
if: ${{ steps.cache.outputs.cache-hit == 'true' }}
run: $GITHUB_WORKSPACE/install.sh --skip-create
- run: echo "$OPENWPM_MAMBA_PATH/bin" >> $GITHUB_PATH
# Now we have a working OpenWPM environment
- run: python demo.py --headless
tests:
runs-on: ubuntu-latest
strategy:
matrix:
test-groups:
[
"test/test_[a-e]*",
"test/test_[f-h]*",
"test/test_[i-o,q-r,t-z]*",
"test/test_[p]*",
"test/test_[s]*",
"test/storage/*",
"test/extension/*",
]
fail-fast: false
steps:
# All of these steps are just setup, maybe we should wrap them in an action
- uses: actions/checkout@v4
- name: Cache node modules
uses: actions/cache@v4
env:
cache-name: cache-node-modules
with:
# npm cache files are stored in `~/.npm` on Linux/macOS
path: ~/.npm
key: ${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }}
# Setting env variables that depend on $HOME
- name: Setting MAMBA_PATH
run: echo "MAMBA_PATH=$HOME/mamba" >> $GITHUB_ENV
- name: Setting OPENWPM_MAMBA_PATH
run: echo "OPENWPM_MAMBA_PATH=$MAMBA_PATH/envs/openwpm" >> $GITHUB_ENV
# If the environment.yaml hasn't changed we just reuse the entire conda install
- id: conda-cache
uses: actions/cache@v4
env:
cache-name: conda-cache
with:
path: ${{ env.MAMBA_PATH }}
key: ${{ env.cache-name }}-${{ hashFiles('environment.yaml') }}
- name: Install conda
if: ${{ steps.conda-cache.outputs.cache-hit != 'true' }}
run: $GITHUB_WORKSPACE/scripts/install-mamba.sh
- run: echo "$MAMBA_PATH/bin" >> $GITHUB_PATH
- name: Install.sh (cache miss)
if: ${{ steps.conda-cache.outputs.cache-hit != 'true' }}
run: $GITHUB_WORKSPACE/install.sh
- name: Install.sh (cache hit)
if: ${{ steps.conda-cache.outputs.cache-hit == 'true' }}
run: $GITHUB_WORKSPACE/install.sh --skip-create
- run: echo "$OPENWPM_MAMBA_PATH/bin" >> $GITHUB_PATH
# Now we have a working OpenWPM environment
- run: ./scripts/ci.sh
env:
DISPLAY: ":99.0"
TESTS: ${{ matrix.test-groups }}
- name: Test Report
uses: dorny/test-reporter@v1
if: success() || failure() # run this step even if previous step failed
with:
name: ${{matrix.test-groups}} # Name of the check run which will be created
path: junit-report.xml # Path to test results
reporter: java-junit # Format of test results