Skip to content

Commit 603238b

Browse files
committed
chore: Add cirrus-ci build.
This uses toktok-stack and runs pytox tests.
1 parent 92e1c5d commit 603238b

File tree

3 files changed

+22
-11
lines changed

3 files changed

+22
-11
lines changed

.cirrus.yml

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
---
2+
cirrus-ci_task:
3+
container:
4+
image: toxchat/toktok-stack:0.0.18
5+
cpu: 2
6+
memory: 6G
7+
configure_script:
8+
- /src/workspace/tools/inject-repo py_toxcore_c
9+
test_all_script:
10+
- bazel test -k
11+
--remote_http_cache=http://$CIRRUS_HTTP_CACHE_HOST
12+
--config=release
13+
//py_toxcore_c/...

.github/settings.yml

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,6 @@ branches:
1111
protection:
1212
required_status_checks:
1313
contexts:
14-
- Codacy/PR Quality Review
15-
- CodeFactor
16-
- Docker Build
17-
- Travis CI - Pull Request
18-
- code-review/reviewable
19-
- coverage/coveralls
14+
- "cirrus-ci"
15+
- "Codacy Static Code Analysis"
16+
- "code-review/reviewable"

pytox/core.c

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ static void callback_friend_request(Tox *tox, const uint8_t *public_key,
5353
bytes_to_hex_string(public_key, TOX_PUBLIC_KEY_SIZE, buf);
5454

5555
PyObject_CallMethod((PyObject *)self, "on_friend_request", "ss#", buf, data,
56-
length - (data[length - 1] == 0));
56+
length - (length > 0 && data[length - 1] == 0));
5757
}
5858

5959
static void callback_friend_message(Tox *tox, uint32_t friendnumber,
@@ -62,22 +62,23 @@ static void callback_friend_message(Tox *tox, uint32_t friendnumber,
6262
void *self) {
6363
PyObject_CallMethod((PyObject *)self, "on_friend_message", "iis#",
6464
friendnumber, type, message,
65-
length - (message[length - 1] == 0));
65+
length - (length > 0 && message[length - 1] == 0));
6666
}
6767

6868
static void callback_friend_name(Tox *tox, uint32_t friendnumber,
6969
const uint8_t *newname, size_t length,
7070
void *self) {
7171
PyObject_CallMethod((PyObject *)self, "on_friend_name", "is#", friendnumber,
72-
newname, length - (newname[length - 1] == 0));
72+
newname,
73+
length - (length > 0 && newname[length - 1] == 0));
7374
}
7475

7576
static void callback_friend_status_message(Tox *tox, uint32_t friendnumber,
7677
const uint8_t *newstatus,
7778
size_t length, void *self) {
7879
PyObject_CallMethod((PyObject *)self, "on_friend_status_message", "is#",
7980
friendnumber, newstatus,
80-
length - (newstatus[length - 1] == 0));
81+
length - (length > 0 && newstatus[length - 1] == 0));
8182
}
8283

8384
static void callback_friend_status(Tox *tox, uint32_t friendnumber,
@@ -120,7 +121,7 @@ static void callback_conference_message(Tox *tox, uint32_t conference_number,
120121
void *self) {
121122
PyObject_CallMethod((PyObject *)self, "on_conference_message", "iiis#",
122123
conference_number, peer_number, type, message,
123-
length - (message[length - 1] == 0));
124+
length - (length > 0 && message[length - 1] == 0));
124125
}
125126

126127
static void callback_conference_peer_name(Tox *tox, uint32_t conference_number,

0 commit comments

Comments
 (0)