-
-
Notifications
You must be signed in to change notification settings - Fork 108
168 lines (156 loc) · 5.65 KB
/
nodejs.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
name: Build
on:
push:
branches: [ master ]
pull_request:
branches: [ master ]
jobs:
build:
name: Build (node-${{ matrix.node-version }})
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [16]
python-version: ['3.9']
include:
- node-version: '16'
python-version: '3.9'
steps:
- uses: actions/checkout@v4
with:
submodules: 'recursive'
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
- name: Install
run: npm ci
- name: Build
run: npm run build
- name: Upload build
uses: actions/upload-artifact@v3.1.2
with:
name: build
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: [16]
python-version: ['3.9']
aw-server: ["aw-server", "aw-server-rust"]
aw-version: ["v0.12.3b11"]
include:
- node-version: '16'
python-version: '3.9'
aw-server: "aw-server-rust"
aw-version: "master"
steps:
- uses: actions/checkout@v4
with:
submodules: 'recursive'
fetch-depth: 0
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
- name: Set up Python
uses: actions/setup-python@v5
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@v3
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
bash <(curl -s https://codecov.io/bash)
- 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@v3.1.2
with:
name: screenshots
path: screenshots/dist/*
- name: Print server logs to console
if: ${{ always() }}
shell: bash
run:
for file in ~/.cache/activitywatch/log/*/*.log; do echo $file; cat $file; echo; done
- name: Move logs to subdir
# Run this step even if e2e tests flag failure
if: ${{ always() }}
env:
aw_server: ${{ matrix.aw-server }}
aw_version: ${{ matrix.aw-version }}
run: |
mkdir -p logs/dist/$aw_server/$aw_version
mv ~/.cache/activitywatch/log/*/*.log logs/dist/$aw_server/$aw_version
- name: Upload logs
if: ${{ always() }}
uses: actions/upload-artifact@v3.1.2
with:
name: logs
path: logs/dist/*