Skip to content

Commit f2afa99

Browse files
authored
Merge pull request #105 from ActivityWatch/dev/github-actions
Move from Travis to GitHub Actions
2 parents 214ff66 + a2ddd8e commit f2afa99

File tree

9 files changed

+124
-116
lines changed

9 files changed

+124
-116
lines changed

.github/workflows/build.yml

Lines changed: 93 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,93 @@
1+
name: Rust
2+
3+
on:
4+
push:
5+
branches: [ master ]
6+
pull_request:
7+
branches: [ master ]
8+
9+
jobs:
10+
build:
11+
name: Build on ${{ matrix.os }}
12+
runs-on: ${{ matrix.os }}
13+
strategy:
14+
matrix:
15+
os: [ubuntu-18.04, windows-latest, macOS-latest]
16+
17+
steps:
18+
- uses: actions/checkout@v2
19+
- name: Set up Rust nightly
20+
uses: actions-rs/toolchain@v1
21+
with:
22+
profile: minimal
23+
toolchain: nightly
24+
override: true
25+
- name: Cache cargo build
26+
uses: actions/cache@v1
27+
env:
28+
cache-name: cargo-build-target
29+
with:
30+
path: target
31+
key: ${{ runner.os }}-${{ env.cache-name }}-${{ hashFiles('**/Cargo.lock') }}
32+
restore-keys: |
33+
${{ runner.os }}-${{ env.cache-name }}-
34+
- name: Build
35+
run: cargo build --workspace --verbose
36+
- name: Run tests
37+
run: cargo test --workspace --verbose
38+
- name: Run tests with coverage
39+
if: startsWith(matrix.os, 'ubuntu')
40+
run: |
41+
sudo apt-get install libcurl4-openssl-dev libelf-dev libdw-dev binutils-dev
42+
cargo install --force cargo-kcov;
43+
cargo kcov --print-install-kcov-sh | sh;
44+
cargo kcov --all --verbose;
45+
bash <(curl -s https://codecov.io/bash);
46+
47+
48+
build-android:
49+
name: Build for Android
50+
runs-on: ubuntu-18.04
51+
steps:
52+
- uses: actions/checkout@v2
53+
- name: Set up Rust nightly
54+
uses: actions-rs/toolchain@v1
55+
with:
56+
profile: minimal
57+
toolchain: nightly
58+
override: true
59+
- name: Cache cargo build
60+
uses: actions/cache@v1
61+
env:
62+
cache-name: cargo-build-target-android
63+
with:
64+
path: target
65+
key: ${{ runner.os }}-${{ env.cache-name }}-${{ hashFiles('**/Cargo.lock') }}
66+
restore-keys: |
67+
${{ runner.os }}-${{ env.cache-name }}-
68+
- name: Install NDK
69+
run: |
70+
./install-ndk.sh
71+
- name: Build
72+
run: |
73+
export ANDROID_NDK_HOME=`pwd`/NDK
74+
./compile-android.sh
75+
76+
lint:
77+
runs-on: ubuntu-18.04
78+
79+
steps:
80+
- uses: actions/checkout@v2
81+
- name: Set up Rust nightly
82+
uses: actions-rs/toolchain@v1
83+
with:
84+
profile: minimal
85+
toolchain: nightly
86+
components: clippy, rustfmt
87+
override: true
88+
- name: Check formatting
89+
if: always()
90+
run: cargo fmt -- --check
91+
- name: Run clippy # Doesn't fail build
92+
if: always()
93+
run: cargo clippy

.travis.yml

Lines changed: 0 additions & 82 deletions
This file was deleted.

README.md

Lines changed: 22 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -2,41 +2,43 @@ aw-server-rust
22
==============
33

44
[![Dependency Status](https://deps.rs/repo/github/activitywatch/aw-server-rust/status.svg)](https://deps.rs/repo/github/activitywatch/aw-server-rust)
5-
[![Build Status](https://travis-ci.org/ActivityWatch/aw-server-rust.svg?branch=master)](https://travis-ci.org/ActivityWatch/aw-server-rust)
6-
[![Coverage Status](https://codecov.io/gh/ActivityWatch/aw-server-rust/branch/master/graph/badge.svg)](https://codecov.io/gh/ActivityWatch/aw-server-rust)
5+
![Build Status](https://github.com/ActivityWatch/aw-server-rust/workflows/Rust/badge.svg)
76

8-
A reimplementation of aw-server in Rust
7+
[![Coverage Status](https://codecov.io/gh/ActivityWatch/aw-server-rust/branch/master/graph/badge.svg)](https://codecov.io/gh/ActivityWatch/aw-server-rust)
98

10-
Primary features missing:
11-
- None?
9+
A reimplementation of aw-server in Rust.
1210

1311
Caveats:
14-
- Lots of TODO and FIXME comments
1512

16-
Bugs:
17-
- Memory leak during Bucket import? (wtf rust?)
13+
- Lots of TODO and FIXME comments
14+
15+
Features missing compared to the Python implementation of aw-server:
1816

19-
Features missing compared to aw-server python:
20-
- Swagger support
17+
- API explorer (Swagger/OpenAPI)
2118

2219
### How to compile
2320

24-
Install rust nightly with rustup
21+
Install rust nightly with `rustup`:
2522

26-
``` rustup default nightly ```
23+
```
24+
rustup default nightly
25+
```
2726

28-
Run cargo build to build
27+
Build with `cargo`:
2928

30-
``` cargo build --release ```
29+
```
30+
cargo build --release
31+
```
3132

32-
### How to run
33+
Your built executable will be located in `./target/release/aw-server-rust`
3334

34-
After compilation you will have an executable at target/release/aw-server-rust
3535

36-
``` ./target/release/aw-server-rust ```
36+
### How to run
3737

38-
If you want to quick-compile for debugging, run cargo run from the project root
38+
If you want to quick-compile for debugging, run cargo run from the project root:
3939

40-
*NOTE:* this will start aw-server-rust on the testing port 5666 instead of port 5600
40+
```
41+
cargo run --bin aw-server
42+
```
4143

42-
``` cargo run ```
44+
*NOTE:* This will start aw-server-rust in testing mode (on port 5666 instead of port 5600).

aw-client-rust/tests/test.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ mod test {
2323
match client.get_info() {
2424
Ok(_) => break,
2525
Err(err) => {
26-
if i == timeout_s-1 {
26+
if i == timeout_s - 1 {
2727
panic!(
2828
"Timed out starting aw-server after {}s: {:?}",
2929
timeout_s, err

aw-models/src/event.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,9 @@ impl Event {
2424

2525
impl PartialEq for Event {
2626
fn eq(&self, other: &Event) -> bool {
27-
!(self.timestamp != other.timestamp ||
28-
self.duration != other.duration ||
29-
self.data != other.data)
27+
!(self.timestamp != other.timestamp
28+
|| self.duration != other.duration
29+
|| self.data != other.data)
3030
}
3131
}
3232

aw-models/src/timeinterval.rs

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,7 @@ pub enum TimeIntervalError {
1919

2020
impl TimeInterval {
2121
pub fn new(start: DateTime<Utc>, end: DateTime<Utc>) -> TimeInterval {
22-
TimeInterval {
23-
start,
24-
end,
25-
}
22+
TimeInterval { start, end }
2623
}
2724

2825
pub fn new_from_string(period: &str) -> Result<TimeInterval, TimeIntervalError> {

aw-query/src/functions.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -429,8 +429,8 @@ mod qfunctions {
429429
) -> Result<DataType, QueryError> {
430430
// typecheck
431431
validate::args_length(&args, 2)?;
432-
let events : Vec<Event> = (&args[0]).try_into()?;
433-
let filter_events : Vec<Event> = (&args[1]).try_into()?;
432+
let events: Vec<Event> = (&args[0]).try_into()?;
433+
let filter_events: Vec<Event> = (&args[1]).try_into()?;
434434

435435
let mut filtered_events = aw_transform::filter_period_intersect(&events, &filter_events);
436436
let mut filtered_tagged_events = Vec::new();

aw-transform/src/classify.rs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -46,9 +46,7 @@ impl RuleTrait for RegexRule {
4646
.data
4747
.values()
4848
.filter(|val| val.is_string())
49-
.any(|val| {
50-
self.regex.is_match(val.as_str().unwrap())
51-
})
49+
.any(|val| self.regex.is_match(val.as_str().unwrap()))
5250
}
5351
}
5452

install-ndk.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ set -e;
44

55
if [ -z "$ANDROID_NDK_HOME" ]; then
66
echo 'ANDROID_NDK_HOME not set, downloading NDK';
7-
wget https://dl.google.com/android/repository/android-ndk-r20-linux-x86_64.zip -O android-ndk.zip;
7+
wget --no-verbose -O android-ndk.zip https://dl.google.com/android/repository/android-ndk-r20-linux-x86_64.zip;
88
unzip -q -d NDK android-ndk.zip;
99
ls NDK;
1010
mv NDK/*/* NDK/;

0 commit comments

Comments
 (0)