-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Adopted a number of QOL improvements from littlefs - Split testing and profiling into separate jobs - Added status updates which includes changes for both code size and runtime - Increased timeouts in tests by 10x. This is an effor to avoid false failures which occur often if your machine does not handle timeouts quickly enough. Note, this does increase the time to run tests by, roughly, 10x Realistically this is a hack, the correct solution is to stub out the timing code for testing so that we can control the number of ticks that pass exactly.
- Loading branch information
Showing
3 changed files
with
219 additions
and
124 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,111 @@ | ||
script: | ||
# Strict compilation of library | ||
- CFLAGS='-pedantic -Werror' make | ||
|
||
# Runtime tests | ||
- make test | ||
|
||
# Relative profiling with current master | ||
- if ( git clone https://github.com/geky/events tests/master && | ||
make -s -C tests/master prof | tee tests/results.txt ) ; | ||
then | ||
cat tests/results.txt | make prof ; | ||
else | ||
make prof ; | ||
fi | ||
# Environment variables | ||
env: | ||
global: | ||
- CFLAGS=-Werror | ||
|
||
# CI jobs | ||
jobs: | ||
include: | ||
# Test stage | ||
- stage: test | ||
env: | ||
- STAGE=test | ||
- NAME=test | ||
script: | ||
# Strict compilation of library only (tests use gcc features) | ||
- make CFLAGS+=-pedantic | ||
# Run tests | ||
- make test | ||
# Find code size with smallest configuration | ||
- make clean size OBJ=equeue.o | tee sizes | ||
|
||
# Update status with code size, compare with master if possible | ||
- | | ||
if [ "$TRAVIS_TEST_RESULT" -eq 0 ] | ||
then | ||
CURR=$(tail -n1 sizes | awk '{print $1}') | ||
PREV=$(curl -u "$GEKY_BOT_STATUSES" https://api.github.com/repos/$TRAVIS_REPO_SLUG/status/master \ | ||
| jq -re "select(.sha != \"$TRAVIS_COMMIT\") | ||
| .statuses[] | select(.context == \"$STAGE/$NAME\").description | ||
| capture(\"code size is (?<size>[0-9]+)\").size" \ | ||
|| echo 0) | ||
STATUS="Passed, code size is ${CURR}B" | ||
if [ "$PREV" -ne 0 ] | ||
then | ||
STATUS="$STATUS ($(python -c "print '%+.2f' % (100*($CURR-$PREV)/$PREV.0)")%)" | ||
fi | ||
fi | ||
# Runtime profiling stage | ||
- stage: test | ||
env: | ||
- STAGE=test | ||
- NAME=prof | ||
script: | ||
# Relative profiling against master | ||
- if ( git clone https://github.com/geky/equeue master && | ||
make -s -C master prof | tee master/runtime ) ; | ||
then | ||
cat master/runtime | make prof | tee runtime ; | ||
else | ||
make prof | tee runtime ; | ||
fi | ||
|
||
# Update status with profile results, compare with master if possible | ||
- | | ||
if [ "$TRAVIS_TEST_RESULT" -eq 0 ] | ||
then | ||
CURR=$(grep -o '[0-9]\+ cycles' runtime | \ | ||
awk '{sum += $1} END {print sum}') | ||
PREV=$(curl -u "$GEKY_BOT_STATUSES" https://api.github.com/repos/$TRAVIS_REPO_SLUG/status/master \ | ||
| jq -re "select(.sha != \"$TRAVIS_COMMIT\") | ||
| .statuses[] | select(.context == \"$STAGE/$NAME\").description | ||
| capture(\"runtime is (?<runtime>[0-9]+)\").runtime" \ | ||
|| echo 0) | ||
STATUS="Passed, runtime is ${CURR} cycles" | ||
if [ "$PREV" -ne 0 ] | ||
then | ||
STATUS="$STATUS ($(python -c "print '%+.2f' % (100*($CURR-$PREV)/$PREV.0)")%)" | ||
fi | ||
fi | ||
# Manage statuses | ||
before_install: | ||
- | | ||
curl -u "$GEKY_BOT_STATUSES" -X POST \ | ||
https://api.github.com/repos/$TRAVIS_REPO_SLUG/statuses/${TRAVIS_PULL_REQUEST_SHA:-$TRAVIS_COMMIT} \ | ||
-d "{ | ||
\"context\": \"$STAGE/$NAME\", | ||
\"state\": \"pending\", | ||
\"description\": \"${STATUS:-In progress}\", | ||
\"target_url\": \"https://travis-ci.org/$TRAVIS_REPO_SLUG/jobs/$TRAVIS_JOB_ID\" | ||
}" | ||
after_failure: | ||
- | | ||
curl -u "$GEKY_BOT_STATUSES" -X POST \ | ||
https://api.github.com/repos/$TRAVIS_REPO_SLUG/statuses/${TRAVIS_PULL_REQUEST_SHA:-$TRAVIS_COMMIT} \ | ||
-d "{ | ||
\"context\": \"$STAGE/$NAME\", | ||
\"state\": \"failure\", | ||
\"description\": \"${STATUS:-Failed}\", | ||
\"target_url\": \"https://travis-ci.org/$TRAVIS_REPO_SLUG/jobs/$TRAVIS_JOB_ID\" | ||
}" | ||
after_success: | ||
- | | ||
curl -u "$GEKY_BOT_STATUSES" -X POST \ | ||
https://api.github.com/repos/$TRAVIS_REPO_SLUG/statuses/${TRAVIS_PULL_REQUEST_SHA:-$TRAVIS_COMMIT} \ | ||
-d "{ | ||
\"context\": \"$STAGE/$NAME\", | ||
\"state\": \"success\", | ||
\"description\": \"${STATUS:-Passed}\", | ||
\"target_url\": \"https://travis-ci.org/$TRAVIS_REPO_SLUG/jobs/$TRAVIS_JOB_ID\" | ||
}" | ||
# Job control | ||
stages: | ||
- name: test |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.