-
-
Notifications
You must be signed in to change notification settings - Fork 176
217 lines (202 loc) · 7.14 KB
/
Copy pathnodejs.yml
File metadata and controls
217 lines (202 loc) · 7.14 KB
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
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
name: Build
on:
push:
branches: [ master ]
pull_request:
branches: [ master ]
jobs:
build-webpack:
name: Build webpack (node-${{ matrix.node-version }})
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [20]
include:
- node-version: '20'
steps:
- uses: actions/checkout@v7
with:
submodules: 'recursive'
- name: Setup Node.js
uses: actions/setup-node@v7
with:
node-version: ${{ matrix.node-version }}
- name: Install
run: npm ci
- name: Build
run: make build
- name: Upload build
uses: actions/upload-artifact@v7
with:
name: build-webpack
path: dist/*
build-vite:
name: Build vite (node-${{ matrix.node-version }})
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [20]
include:
- node-version: '20'
steps:
- uses: actions/checkout@v7
with:
submodules: 'recursive'
- name: Setup Node.js
uses: actions/setup-node@v7
with:
node-version: ${{ matrix.node-version }}
- name: Install
run: npm ci
- name: Build
run: make build-vite
- name: Upload build
uses: actions/upload-artifact@v7
with:
name: build-vite
path: dist/*
test:
name: Test (node-${{ matrix.node-version }}, py-${{ matrix.python-version }}, ${{ matrix.aw-server }} ${{ matrix.aw-version }})
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
node-version: [20]
python-version: ['3.9']
aw-server: ["aw-server", "aw-server-rust"]
aw-version: ["v0.12.3b18"]
include:
- node-version: '20'
python-version: '3.9'
aw-server: "aw-server-rust"
aw-version: "master"
steps:
- uses: actions/checkout@v7
with:
submodules: 'recursive'
fetch-depth: 0
- name: Setup Node.js
uses: actions/setup-node@v7
with:
node-version: ${{ matrix.node-version }}
- name: Set up Python
uses: actions/setup-python@v7
with:
python-version: ${{ matrix.python-version }}
# TODO: Refactor out getting ActivityWatch builds (both release and nightly) into an action
- name: Install and run ActivityWatch
if: ${{ matrix.aw-version != 'master' }}
run: |
wget --no-verbose -O activitywatch.zip https://github.com/ActivityWatch/activitywatch/releases/download/${{ matrix.aw-version }}/activitywatch-${{ matrix.aw-version }}-linux-x86_64.zip
unzip activitywatch.zip
./.github/configure_server.sh
./activitywatch/${{ matrix.aw-server }}/${{ matrix.aw-server }} --testing &
- name: Download aw-server-rust nightly
if: ${{ matrix.aw-server == 'aw-server-rust' && matrix.aw-version == 'master' }}
uses: dawidd6/action-download-artifact@v24
with:
repo: ActivityWatch/aw-server-rust
# Required, workflow file name or ID
workflow: build.yml
# Optional, the status or conclusion of a completed workflow to search for
# Can be one of a workflow conclusion::
# "failure", "success", "neutral", "cancelled", "skipped", "timed_out", "action_required"
# Or a workflow status:
# "completed", "in_progress", "queued"
# Default: "completed,success"
workflow_conclusion: "completed" # FIXME: Don't try to use builds that fail on Linux
branch: master
event: push
# Uploaded artifact name,
name: binaries-Linux # NOTE: debug build
# Directory where to extract artifact
path: aw-server-rust
# Search for the last valid run with the desired artifact
search_artifacts: true
- name: Install and run aw-server-rust nightly
if: ${{ matrix.aw-server == 'aw-server-rust' && matrix.aw-version == 'master' }}
run: |
chmod +x ./aw-server-rust/debug/aw-server
LOG_LEVEL=debug ./aw-server-rust/debug/aw-server --testing &
- name: Insert fake data into aw-server
run: |
pip install click git+https://github.com/ActivityWatch/aw-client.git
wget --no-verbose -O fakedata.py https://raw.githubusercontent.com/ActivityWatch/aw-fakedata/master/aw_fakedata.py
GITDATE=$(git show -s --format=%ci HEAD | sed -r 's/ .+//g')
STARTDATE=$(date --date="${GITDATE} -30 day" +%Y-%m-%d)
ENDDATE=$(date --date="${GITDATE} +1 day" +%Y-%m-%d)
python3 fakedata.py --since $STARTDATE --until $ENDDATE
- name: Install
run: npm ci
- name: Run tests
run: |
npm test
- uses: codecov/codecov-action@v7
timeout-minutes: 2
continue-on-error: true
with:
token: ${{ secrets.CODECOV_TOKEN }}
fail_ci_if_error: false
- name: Serve webui
run: |
npm run serve &
sleep 3 # give a few seconds
- name: Run e2e tests with testcafe
id: e2e
uses: DevExpress/testcafe-action@latest
with:
# NOTE: --skip-js-errors should be removed when things work properly
args: "--skip-js-errors chrome test/e2e/"
- name: Move screenshots to subdir
# Run this step even if e2e tests flag failure
if: ${{ success() || steps.e2e.conclusion == 'failure'}}
env:
aw_server: ${{ matrix.aw-server }}
aw_version: ${{ matrix.aw-version }}
run: |
mkdir -p screenshots/dist/$aw_server/$aw_version
mv screenshots/*.png screenshots/dist/$aw_server/$aw_version
- name: Upload screenshots
if: ${{ success() || steps.e2e.conclusion == 'failure'}}
uses: actions/upload-artifact@v7
with:
name: screenshots-${{ matrix.aw-server }}-${{ matrix.aw-version }}
path: screenshots/dist/*
# NOTE: the glob covers both cache roots. Since ActivityWatch/aw-server-rust#652
# a --testing server on a machine with no legacy testing data logs under
# ~/.cache/activitywatch-testing/, while released builds still use
# ~/.cache/activitywatch/. These are diagnostic steps, so a missing log
# directory must never fail the job.
- name: Print server logs to console
if: ${{ always() }}
shell: bash
run: |
shopt -s nullglob
logs=(~/.cache/activitywatch*/log/*/*.log)
if [ ${#logs[@]} -eq 0 ]; then
echo "No server logs found under ~/.cache/activitywatch*/log/"
exit 0
fi
for file in "${logs[@]}"; do echo "$file"; cat "$file"; echo; done
- name: Move logs to subdir
# Run this step even if e2e tests flag failure
if: ${{ always() }}
shell: bash
env:
aw_server: ${{ matrix.aw-server }}
aw_version: ${{ matrix.aw-version }}
run: |
shopt -s nullglob
logs=(~/.cache/activitywatch*/log/*/*.log)
if [ ${#logs[@]} -eq 0 ]; then
echo "No server logs to move"
exit 0
fi
mkdir -p "logs/dist/$aw_server/$aw_version"
mv "${logs[@]}" "logs/dist/$aw_server/$aw_version"
- name: Upload logs
if: ${{ always() }}
uses: actions/upload-artifact@v7
with:
name: logs-${{ matrix.aw-server }}-${{ matrix.aw-version }}
path: logs/dist/*