-
-
Notifications
You must be signed in to change notification settings - Fork 2
201 lines (167 loc) · 5.16 KB
/
build.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
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
name: Build
on:
push:
branches: [ master ]
pull_request:
branches: [ master ]
jobs:
tests:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
python-version: ['3.10']
aw-server: ["aw-server", "aw-server-rust"]
aw-version: ["v0.12.3b13"]
steps:
- uses: actions/checkout@v3
with:
submodules: 'recursive'
- name: Set up ActivityWatch
uses: ActivityWatch/setup-action@v3
with:
aw-server: ${{ matrix.aw-server }}
aw-version: ${{ matrix.aw-version }}
aw-testing: false
fakedata: true
- name: Install poetry
run: |
pipx install poetry
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
cache: 'poetry'
- name: Install deps
run: poetry install
- name: Run tests
run: |
make test SLOW=true
- name: Upload coverage
run: |
bash <(curl -s https://codecov.io/bash)
typecheck:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
python-version: ['3.10']
steps:
- uses: actions/checkout@v3
with:
submodules: 'recursive'
- name: Install poetry
run: |
pipx install poetry
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
cache: 'poetry'
- name: Install deps
run: poetry install
- name: Run typecheck
run: |
make typecheck
notebooks:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
include:
- python-version: '3.10'
aw-server: "aw-server-rust"
aw-version: "master"
steps:
- uses: actions/checkout@v3
with:
submodules: 'recursive'
- name: Set up ActivityWatch
uses: ActivityWatch/setup-action@v3
if: ${{ matrix.aw-version != 'master' }}
with:
aw-server: ${{ matrix.aw-server }}
aw-version: ${{ matrix.aw-version }}
aw-testing: false
fakedata: true
- name: Download aw-server-rust nightly
uses: dawidd6/action-download-artifact@v2
if: ${{ matrix.aw-server == 'aw-server-rust' && matrix.aw-version == 'master' }}
with:
repo: ActivityWatch/aw-server-rust
# Required, workflow file name or ID
workflow: build.yml
# 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
- name: Run aw-server-rust nightly
shell: bash
if: ${{ matrix.aw-server == 'aw-server-rust' && matrix.aw-version == 'master' }}
run: |
chmod +x ./aw-server-rust/debug/aw-server
./aw-server-rust/debug/aw-server &
- name: Insert fake data into aw-server-rust # aw-server will have it handled by the action
shell: bash
if: ${{ matrix.aw-server == 'aw-server-rust' && matrix.aw-version == 'master' }}
env:
AW_TESTING: true
run: |
pip install git+https://github.com/ActivityWatch/aw-client.git
wget --no-verbose -O fakedata.py https://github.com/ActivityWatch/aw-fakedata/raw/63a357dbc7b8b832ec44cc55cafd6622ce909590/aw_fakedata.py
python3 fakedata.py
- name: Install poetry
run: |
pipx install poetry
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
cache: 'poetry'
- name: Install deps
run: poetry install
- name: Build notebooks
env:
aw_server: ${{ matrix.aw-server }}
aw_version: ${{ matrix.aw-version }}
run: |
make notebooks
mkdir notebooks/output/$aw_server
mv notebooks/output/*.html notebooks/output/$aw_server/
- name: Upload notebooks
uses: actions/upload-artifact@v3
with:
name: notebooks
path: notebooks/output
- name: Echo logs
if: ${{ always() }} # ${{ failure() }}
run: |
cat $HOME/.cache/activitywatch/log/aw-server-rust/*
deploy:
runs-on: ubuntu-latest
needs: [notebooks]
steps:
- uses: actions/download-artifact@v3
with:
name: notebooks
path: dist
- name: Display structure of downloaded files
run: ls -R
- run: |
mv dist/aw-server-rust/* dist/
rmdir dist/aw-server-rust
- name: Deploy 🚀
uses: JamesIves/github-pages-deploy-action@releases/v3
if: github.ref == 'refs/heads/master'
with:
BRANCH: gh-pages # The branch the action should deploy to.
FOLDER: dist # The folder the action should deploy.
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}