Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Github Workflows #82

Draft
wants to merge 24 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
146 changes: 146 additions & 0 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,146 @@
name: Orchestra

on:
push:
branches:
- master
pull_request:
branches:
- master

jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
service: [
mavproxy,
interop-proxy,
telemetry,
pong,
forward-interop,
imagery,
image-rec-master,
image-rec-auto,
grafana
]
steps:
- uses: actions/checkout@v2
- name: Building services
run: |
./ci/script.sh
env:
SERVICE: ${{ matrix.service }}

test-interop-proxy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2

- name: Setup environment
uses: actions/setup-elixir@v1
with:
elixir-version: '1.8'
otp-version: '20'
- name: Testing service
run: |
./ci/script.sh
env:
SERVICE_TEST: interop-proxy
OPTIONS: "-i"

test-telemetry:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2

- name: Setup environment
uses: actions/setup-node@v1
with:
node-version: '12'
- name: Testing service
run: |
./ci/script.sh
env:
SERVICE_TEST: telemetry
OPTIONS: "-i"

test-forward-interop:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2

- name: Setup environment
uses: actions/setup-node@v1
with:
node-version: '12'
- name: Testing service
run: |
./ci/script.sh
env:
SERVICE_TEST: forward-interop
OPTIONS: "-i"

test-pong:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2

- name: Setup environment
uses: actions/setup-node@v1
with:
node-version: '12'
- name: Testing service
run: |
./ci/script.sh
env:
SERVICE_TEST: pong
OPTIONS: "-i"

test-imagery:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2

- name: Setup environment
uses: actions/setup-node@v1
with:
node-version: '12'
- name: Testing service
run: |
./ci/script.sh
env:
SERVICE_TEST: imagery
OPTIONS: "-i"

test-image-rec-master:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2

- name: Setup environment
uses: actions/setup-python@v2
with:
python-version: '3.8'
- name: Testing service
run: |
./ci/script.sh
env:
SERVICE_TEST: image-rec-master
OPTIONS: "-i"

test-image-rec-auto:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2

- name: Setup environment
uses: actions/setup-python@v2
with:
python-version: '3.8'
- name: Testing service
run: |
./ci/script.sh
env:
SERVICE_TEST: image-rec-auto
OPTIONS: "-i"
2 changes: 2 additions & 0 deletions ci/after-script.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
# start with "/test/..."), we have to replace this with the path of
# the service.

# Submit to coveralls only on the Travis CI.

handle_nodejs() {
NODEJS_LCOV=services/"$SERVICE_TEST"/coverage/lcov.info

Expand Down
2 changes: 2 additions & 0 deletions ci/script.sh
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
#!/bin/sh -ex

echo $SERVICE_TEST
# Build a service if the env var is set.
if [ -n "$SERVICE" ]; then
make "$SERVICE"
fi

# Run tests if specified.
if [ -n "$SERVICE_TEST" ]; then
# Change options for tty
make "$SERVICE_TEST"-test
fi
4 changes: 3 additions & 1 deletion services/forward-interop/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ FORWARD_INTEROP_TEST_IMAGE := uavaustin/forward-interop-test

current_dir := $(shell pwd)

OPTIONS ?= "-it"

.PHONY: all
all: image

Expand All @@ -17,7 +19,7 @@ image:
test:
docker build -t $(FORWARD_INTEROP_TEST_IMAGE) \
-f Dockerfile.test $(DOCKERFLAGS) ..
docker run -it --rm -v $(current_dir)/coverage:/test/coverage \
docker run $(OPTIONS) --rm -v $(current_dir)/coverage:/test/coverage \
$(FORWARD_INTEROP_TEST_IMAGE)

.PHONY: clean
Expand Down
3 changes: 2 additions & 1 deletion services/image-rec-auto/Makefile
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# Flags for docker when building images, meant to be overridden
DOCKERFLAGS :=
JETSON ?= "false"
OPTIONS ?= -it
HAWK_EYE_VERSION := 0.0.2b0

IMAGE_REC_AUTO_IMAGE := uavaustin/image-rec-auto
Expand Down Expand Up @@ -45,7 +46,7 @@ else
--build-arg HAWK_EYE_VERSION=$(HAWK_EYE_VERSION) \
$(DOCKERFLAGS) ..

docker run -it --ipc=host --rm -v $(current_dir)/coverage:/test/coverage \
docker run $(OPTIONS) --ipc=host --rm -v $(current_dir)/coverage:/test/coverage \
$(IMAGE_REC_AUTO_TEST_IMAGE)
endif

Expand Down
Binary file added services/image-rec-auto/coverage/.coverage
Binary file not shown.
2 changes: 1 addition & 1 deletion services/image-rec-master/Dockerfile.test
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM python:3.7-alpine
FROM python:3.8-alpine

WORKDIR /test

Expand Down
4 changes: 3 additions & 1 deletion services/image-rec-master/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ IMAGE_REC_MASTER_TEST_IMAGE := uavaustin/image-rec-master-test

current_dir := $(shell pwd)

OPTIONS ?= -it

.PHONY: all
all: image

Expand All @@ -17,7 +19,7 @@ image:
test:
docker build -t $(IMAGE_REC_MASTER_TEST_IMAGE) \
-f Dockerfile.test $(DOCKERFLAGS) ..
docker run -it --rm -v $(current_dir)/coverage:/test/coverage \
docker run $(OPTIONS) --rm -v $(current_dir)/coverage:/test/coverage \
-v /var/run/docker.sock:/var/run/docker.sock \
$(IMAGE_REC_MASTER_TEST_IMAGE)

Expand Down
2 changes: 1 addition & 1 deletion services/image-rec-master/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
aiohttp
aiohttp==3.6.2
aioredis
protobuf>=3.6.1
4 changes: 3 additions & 1 deletion services/imagery/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ DOCKERFLAGS :=
IMAGERY_IMAGE := uavaustin/imagery
IMAGERY_TEST_IMAGE := uavaustin/imagery-test

OPTIONS ?= "-it"

current_dir := $(shell pwd)

.PHONY: all
Expand All @@ -17,7 +19,7 @@ image:
test:
docker build -t $(IMAGERY_TEST_IMAGE) \
-f Dockerfile.test $(DOCKERFLAGS) ..
docker run -it --rm -v $(current_dir)/coverage:/test/coverage \
docker run $(OPTIONS) --rm -v $(current_dir)/coverage:/test/coverage \
$(IMAGERY_TEST_IMAGE)

.PHONY: clean
Expand Down
2 changes: 1 addition & 1 deletion services/imagery/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
"start": "node ./bin/start-service",
"build": "babel src --out-dir lib",
"build-msg": "mkdir -p lib && pbjs -t static-module --es6 --keep-case -o src/messages.js src/messages/*.proto",
"test": "jest",
"test": "jest --runInBand",
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Solves issue of test flakiness mentioned in #59. Jest by default runs tests in parallel, so multiple tests were modifying the sqlite file at the same time (hence the unexplained behavior of rolling back a transaction that wasn't underway).

"lint": "eslint src test --ignore-pattern src/messages.js"
},
"dependencies": {
Expand Down
2 changes: 1 addition & 1 deletion services/imagery/src/backends/sync-backend.js
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ export default class SyncBackend {
const { body: msg } =
await request.get(this._syncUrl + '/api/available')
.proto(imagery.AvailableImages)
.timeout(5000);
.timeout(3000);
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

5 second timeout is causing some tests to fail intermittently.


return msg.id_list;
}
Expand Down
4 changes: 3 additions & 1 deletion services/interop-proxy/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ DOCKERFLAGS :=
INTEROP_PROXY_IMAGE := uavaustin/interop-proxy
INTEROP_PROXY_TEST_IMAGE := uavaustin/interop-proxy-test

OPTIONS ?= "-it"

current_dir := $(shell pwd)

.PHONY: all
Expand All @@ -16,7 +18,7 @@ image:
.PHONY: test
test:
DOCKERFLAGS=$(DOCKERFLAGS) INTEROP_PROXY_IMAGE=$(INTEROP_PROXY_IMAGE) \
INTEROP_PROXY_TEST_IMAGE=$(INTEROP_PROXY_TEST_IMAGE) ./test.sh
INTEROP_PROXY_TEST_IMAGE=$(INTEROP_PROXY_TEST_IMAGE) ./test.sh $(OPTIONS)

.PHONY: clean
clean:
Expand Down
9 changes: 8 additions & 1 deletion services/interop-proxy/test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,14 @@ fi
if [ "$built" -eq 0 ]; then
printf "\n\033[34mStarting tests...\033[0m\n\n"

docker run -it --rm --net=interop-proxy-test-net \
# CHeck for docker run options
if [ -z "$1" ]; then
flags="-it"
else
flags="$1"
fi

docker run ${flags} --rm --net=interop-proxy-test-net \
-e INTEROP_URL=172.37.0.2 $INTEROP_PROXY_TEST_IMAGE

result=$?
Expand Down
4 changes: 3 additions & 1 deletion services/pong/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ ALPINE_IMAGE := alpine

current_dir := $(shell pwd)

OPTIONS ?= -it

.PHONY: all
all: image

Expand All @@ -17,7 +19,7 @@ image:
.PHONY: test
test: alpine
docker build -t $(PONG_TEST_IMAGE) -f Dockerfile.test $(DOCKERFLAGS) ..
docker run -it --rm -v $(current_dir)/coverage:/test/coverage \
docker run $(OPTIONS) --rm -v $(current_dir)/coverage:/test/coverage \
-v /var/run/docker.sock:/var/run/docker.sock $(PONG_TEST_IMAGE)

.PHONY: alpine
Expand Down
4 changes: 3 additions & 1 deletion services/telemetry/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ PLANE_SITL_IMAGE := uavaustin/plane-sitl

current_dir := $(shell pwd)

OPTIONS ?= -it

.PHONY: all
all: image

Expand All @@ -18,7 +20,7 @@ image:
test: plane-sitl
docker build -t $(TELEMETRY_TEST_IMAGE) \
-f Dockerfile.test $(DOCKERFLAGS) ..
docker run -it --rm -v $(current_dir)/coverage:/test/coverage \
docker run $(OPTIONS) --rm -v $(current_dir)/coverage:/test/coverage \
-v /var/run/docker.sock:/var/run/docker.sock $(TELEMETRY_TEST_IMAGE)

.PHONY: plane-sitl
Expand Down