Skip to content

Commit

Permalink
Merge pull request #43 from ActivityWatch/dev/makefile
Browse files Browse the repository at this point in the history
Moved build/install/test scripts to Makefile
  • Loading branch information
ErikBjare authored Apr 25, 2017
2 parents bc5b7ec + 06c1889 commit 44fd81d
Show file tree
Hide file tree
Showing 14 changed files with 157 additions and 103 deletions.
31 changes: 27 additions & 4 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,22 @@ matrix:
python: 3.5
env:
- TRAVIS_NODE_VERSION="6"
services:
- mongodb
deploy:
provider: releases
skip_cleanup: true
file: dist/activitywatch-linux.zip
api_key:
secure: PSkaHT7bhmCBFutBhfIyHd/j784e0bgzVrahA9+IrEZQqHmJzGvkytf4mQ+EWz0lYDX/Jko7aIFfuCQ8yoVNnnwCu8SwTKXcwrkwuJrymupIK+Xxau6C4rMBLK81mphZs8t2YjJK720EquZ54Tt5Y79Dh2tk9ZxdgqWgVLVhhZziD2/I5BfpsqRgCFqZc4UKAOAf5jpe1lgCOz4zkLP3vgQUyIJgkc9A1BT01f5v860hAlH8HchBAlIMklzPJt3ps9ch8dLRtCC3ZQRWIQpNGjw10P4BO3DqjF4ASeo0ZtbLGIFZeWnnAbQxRIztPUqiYnTQckvHcHYAKG8cyO8SBKQj1au5FRTCHbafpOOzLDWkXx+fqaYakxmPlW6YGp+zaiDQsmNCIdCWWsFU8+gUgZL8Owf4eYc2LI4LW7SI/RC7HjllqNP8WVbZSbQRcvQrK9ZN6fiOixTLni2cXyKy6SxVaDd/+iji8YwPW8JrOawTsXIoZRDE6vq41Y47tO/MU9yLm8RkRkApBGgsc+5RJCEEiDyghJ3op+rWIavcMmSZQ3TBo5e00XyPBd7dGkxoLk9WUSuaZgTmi7FSfDDxWW9TiE7tP2ruIV4fcAlOOkM5ll3K6XIo61JM0JAuAKsg7g32lOnr2DEGDk8XlV3QqIEzwjXLjdVrk3ALabp8HjI=
on:
tags: true
- os: linux
python: 3.6
env:
- TRAVIS_NODE_VERSION="6"
services:
- mongodb
deploy:
provider: releases
skip_cleanup: true
Expand All @@ -17,6 +33,8 @@ matrix:
language: generic
env:
- TRAVIS_NODE_VERSION="4"
services:
- mongodb
deploy:
provider: releases
skip_cleanup: true
Expand All @@ -27,7 +45,12 @@ matrix:
tags: true
- os: linux
python: nightly
services:
- mongodb
env:
- TRAVIS_NODE_VERSION="6"
allow_failures:
- python: 3.6
- python: nightly
- os: osx

Expand All @@ -45,9 +68,9 @@ before_install:
- rm -rf ~/.nvm && git clone https://github.com/creationix/nvm.git ~/.nvm && (cd ~/.nvm && git checkout `git describe --abbrev=0 --tags`) && source ~/.nvm/nvm.sh && nvm install $TRAVIS_NODE_VERSION

install:
- "./scripts/build.sh"
- "./scripts/install.sh --noroot"
- "make build"
- "make install"

script:
- "./scripts/integration_tests.sh"
- "./scripts/package.sh"
- "make test"
- "make package"
52 changes: 52 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
# I recommend creating a virtualenv as such before running before this makefile:
# - virtualenv --python=python3 venv
# - source ./venv/bin/activate

.PHONY: build install test clean

# TODO: Currently no way to do a `setup.py develop`/`pip install --editable`
build:
make --directory=aw-core build
make --directory=aw-client build
#
make --directory=aw-webui build
cp -r aw-webui/dist/* aw-server/aw_server/static/
#
make --directory=aw-server build
make --directory=aw-watcher-afk build
make --directory=aw-watcher-window build
make --directory=aw-qt build

install:
make --directory=aw-qt install
# Installation is already happening in the `make build` step currently.
# We might want to change this.
# bash scripts/install.sh

test:
make --directory=aw-core test
make --directory=aw-qt test
# TODO: Move "integration tests" to aw-client
./scripts/integration_tests.sh

package:
mkdir -p dist/activitywatch
#
make --directory=aw-watcher-afk package
cp -r aw-watcher-afk/dist/aw-watcher-afk/* dist/activitywatch
#
make --directory=aw-watcher-window package
cp -r aw-watcher-window/dist/aw-watcher-window/* dist/activitywatch
#
make --directory=aw-server package
cp -r aw-server/dist/aw-server/* dist/activitywatch
#
make --directory=aw-qt package
cp -r aw-qt/dist/aw-qt/* dist/activitywatch
#
bash scripts/package-zip.sh

clean:
rm -r build dist
mkdir dist
mkdir dist/activitywatch
51 changes: 40 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ ActivityWatch

[![Build Status Travis](https://travis-ci.org/ActivityWatch/activitywatch.svg?branch=master)](https://travis-ci.org/ActivityWatch/activitywatch)
[![Build Status Appveyor](https://ci.appveyor.com/api/projects/status/vm7g9sdfi2vgix6n?svg=true)](https://ci.appveyor.com/project/ErikBjare/activitywatch)
[![CII Best Practices](https://bestpractices.coreinfrastructure.org/projects/873/badge)](https://bestpractices.coreinfrastructure.org/projects/873)
[![Documentation](https://readthedocs.org/projects/activitywatch/badge/?version=latest)](http://activitywatch.readthedocs.io)

[Releases](https://github.com/ActivityWatch/activitywatch/releases)
Expand All @@ -16,7 +17,7 @@ ActivityWatch
ActivityWatch ***records what you do*** so that you can ***become aware of what you do*** and choose to do better. All in a secure way where ***you control the data***.


# About
## About

The goal of ActivityWatch is simple: *Enable the collection of as much valuable lifedata as possible without compromising user privacy.*

Expand All @@ -33,7 +34,7 @@ It is up to you as user to collect as much as you want, or as little as you want

You can read more on our [website](https://activitywatch.github.io/about/).

## Screenshots
### Screenshots

<img src="http://activitywatch.net/screenshot.png" width="22%">
<!--
Expand All @@ -42,7 +43,7 @@ You can read more on our [website](https://activitywatch.github.io/about/).
<img src="http://activitywatch.net/screenshot.png" width="22%">
-->

## Is this yet another time tracker?
### Is this yet another time tracker?

Yes, but we found that most time trackers lack in some important features. Common dealbreakers:

Expand All @@ -51,7 +52,7 @@ Yes, but we found that most time trackers lack in some important features. Commo
- High data resolution (storage of raw data)
- Plugins (simplicity to collect more data)

### Feature comparison
#### Feature comparison


<!-- TODO: Replace Platform names with icons, yes/no with checkbox icons, -->
Expand All @@ -75,31 +76,59 @@ Yes, but we found that most time trackers lack in some important features. Commo
| WakaTime | :x: | :x: | :white_check_mark: | :x: | :white_check_mark:, many |


## Installation & Usage
### Installation & Usage

We're not there yet for end-users, if you are a developer you may figure it out on your own until we get our shit together.
**We're not there yet for end-users**, however if you are a developer you may try the following:

# About this repository
```sh
# Ensure you have Python 3.5 or later installed
python3 -V

# Now you probably want to set up a virtualenv so we don't install everything system-wide.
sudo pip3 install virtualenv # Assuming you don't already have it, you might want to use your systems package manager instead.
virtualenv venv --python=python3 --clear
# Now you need to activate the virtualenv
# For bash/zsh users: source ./venv/bin/activate
# For fish users: source ./venv/bin/activate.fish

# Now we build and install everything into the virtualenv.
make build

# Now you should be able to start ActivityWatch
# Either use the trayicon manager:
aw-qt
# Or run each module seperately:
aw-server
aw-watcher-afk
aw-watcher-window

# Now everything should be running!
# You can see your data at http://localhost:5600/
```

If anything doesn't work, let us know!

## About this repository

This repo is a bundle of the core components and official modules of ActivityWatch (managed with `git submodule`). It's primary use is as a meta-package providing all the components in one repo; enabling easier packaging and installation. It is also where releases of the full suite are published (see [releases](https://github.com/ActivityWatch/activitywatch/releases)).

## Server
### Server

`aw-server` is the official implementation of the core service which the other activitywatch services interact with. It provides a datastore and serves the web interface developed in the *aw-webui* project (which provides the frontend part of the webapp).

The webapp includes basic data visualization (WIP), data browsing and export, and has a lot more planned for it.

## Watchers
### Watchers

- `aw-watcher-afk` - can be used to log the presence/absence of user activity from keyboard and mouse input
- `aw-watcher-window` - can be used to log the currently active application and it's window title
- `aw-watcher-web` - (WIP) can be used to increase the logging detail when browsing the web by collecting the URLs and titles of tabs (your web history with superpowers)

## Libraries
### Libraries

- `aw-core` - core library, provides no runnable modules
- `aw-client` - client library, useful when writing watchers

# Contributing
## Contributing

We currently don't have much of a good contributors guide (we're working on it), feel free to browse the documentation (also in a early state). You should also send me an email at: [erik@bjareho.lt](mailto:erik@bjareho.lt).
36 changes: 25 additions & 11 deletions appveyor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -45,24 +45,40 @@ install:
# not already installed.
- ps: if (-not(Test-Path($env:PYTHON))) { & scripts\install_python.ps1 }

# Required in order to get `make` to work
- "copy C:\\MinGW\\bin\\mingw32-make.exe C:\\MinGW\\bin\\make.exe"

# Use MinGW
- "SET PATH=C:\\MinGW\\bin;%PATH%"

# Use cygwin stuff for make, bash, etc.
- "SET PATH=C:\\cygwin\\bin;%PATH%"
# NOTE: Don't, better to use MinGW tooling
#- "SET PATH=C:\\cygwin\\bin;%PATH%"

# Prepend newly installed Python to the PATH of this build (this cannot be
# done from inside the powershell script as it would require to restart
# the parent CMD process).
# pyrcc5.exe can be found here:
# C:\Users\erb\AppData\Roaming\Python\Python35\Scripts\pyrcc5.exe
- "SET PATH=%PYTHON%;%PYTHON%\\Scripts;%PATH%"
- "SET PATH=%PYTHON%;%PATH%"
- "SET PATH=%PYTHON%\\Scripts;%PATH%"

# Install node and npm
- ps: "./scripts/install_node.ps1"
- "SET PATH=C:\\Program Files\\nodejs;%PATH%"
# For debugging: Echo the path variable, one path per line
- ps: "$env:path.split(\";\")"
- ECHO "%PYTHON%"

# Check that we have the expected version and architecture for Python
- "%CMD_IN_ENV% python --version"
- "%CMD_IN_ENV% python -c \"import struct; print(struct.calcsize('P') * 8)\""

# Add the python3 executable
- "copy %PYTHON%\\python.exe %PYTHON%\\python3.exe"
- "%CMD_IN_ENV% python3 --version"

# Install node and npm
- ps: "./scripts/install_node.ps1"
- "SET PATH=C:\\Program Files\\nodejs;%PATH%"

# Upgrade to the latest version of pip to avoid it displaying warnings
# about it being out of date.
- "%CMD_IN_ENV% pip install --disable-pip-version-check --user --upgrade pip"
Expand Down Expand Up @@ -91,23 +107,21 @@ install:

build_script:
# Build the compiled extension
- "%CMD_IN_ENV% bash ./scripts/build.sh"
- "%CMD_IN_ENV% bash ./scripts/install.sh --user"
- "%CMD_IN_ENV% make build"
- "%CMD_IN_ENV% make install"
#- "%CMD_IN_ENV% python setup.py build"

test_script:
# Run the project tests
# TODO: Run actual build_script here
- ECHO "Not working yet"
#- "%CMD_IN_ENV% python -m pytest"
- "%CMD_IN_ENV% make test"

after_test:
# If tests are successful, create binary packages for the project.
#- "%CMD_IN_ENV% python setup.py bdist_wheel"
#- "%CMD_IN_ENV% python setup.py bdist_wininst"
#- "%CMD_IN_ENV% python setup.py bdist_msi"
#- ps: "ls dist"
- "%CMD_IN_ENV% bash ./scripts/package.sh"
- "%CMD_IN_ENV% make package"

#artifacts:
# Archive the generated packages in the ci.appveyor.com build report.
Expand Down
2 changes: 1 addition & 1 deletion aw-client
2 changes: 1 addition & 1 deletion aw-core
2 changes: 1 addition & 1 deletion aw-qt
2 changes: 1 addition & 1 deletion aw-server
Submodule aw-server updated 2 files
+8 −0 Makefile
+1 −1 setup.py
2 changes: 1 addition & 1 deletion aw-watcher-afk
Submodule aw-watcher-afk updated 1 files
+8 −0 Makefile
2 changes: 1 addition & 1 deletion aw-watcher-window
18 changes: 0 additions & 18 deletions scripts/build.sh

This file was deleted.

25 changes: 0 additions & 25 deletions scripts/install.sh

This file was deleted.

2 changes: 1 addition & 1 deletion scripts/integration_tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ serverpid=$!

sleep 2

nosetests aw-server
pytest aw-server
tests_exitcode=$?

kill $serverpid
Expand Down
Loading

0 comments on commit 44fd81d

Please sign in to comment.