Skip to content

Commit

Permalink
Add initial workflow config & test
Browse files Browse the repository at this point in the history
  • Loading branch information
mjyc committed Jun 6, 2023
1 parent 1609652 commit 6ffc1ea
Show file tree
Hide file tree
Showing 3 changed files with 51 additions and 0 deletions.
14 changes: 14 additions & 0 deletions .devcontainer/smoke_test.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
#!/bin/bash
set -e

mushr_noetic run 'source ~/.bashrc && roslaunch mushr_sim teleop.launch' > /tmp/output &
sleep 5
if tail -n 1 /tmp/output | grep -q "Rosbridge WebSocket server started at ws://0.0.0.0:9090"; then
echo "✅ smoke_test passed"
exit 0;
else
# Print output of `roslaunch mushr_sim teleop.launch` for debugging
cat /tmp/output
echo "❌ smoke_test failed"
exit 1;
fi
21 changes: 21 additions & 0 deletions .github/workflows/devcontainer-test.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
#!/bin/bash
set -e

SRC_DIR="$(pwd)"

echo "Running Smoke Test"

# Build
export DOCKER_BUILDKIT=1
echo "(*) Installing @devcontainer/cli"
npm install -g @devcontainers/cli

echo "Building Dev Container"
ID_LABEL="test-container=mushr"
devcontainer up --id-label ${ID_LABEL} --workspace-folder "${SRC_DIR}"

# Test
devcontainer exec --workspace-folder "${SRC_DIR}" --id-label ${ID_LABEL} /bin/sh -c './src/mushr/.devcontainer/smoke_test.sh'

# Clean up
docker rm -f $(docker container ls -f "label=${ID_LABEL}" -q)
16 changes: 16 additions & 0 deletions .github/workflows/test-pr.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
name: "CI"
on:
pull_request:
workflow_dispatch:

jobs:
test:
runs-on: ubuntu-latest
steps:
- name: Checkout main
id: checkout_release
uses: actions/checkout@v3
- name: Devcontainer container smoke test
id: test_devcontainer
shell: bash
run: ./.github/workflows/devcontainer-test.sh

0 comments on commit 6ffc1ea

Please sign in to comment.