Skip to content

Commit

Permalink
ci: run tedge image tests
Browse files Browse the repository at this point in the history
Signed-off-by: Reuben Miller <reuben.d.miller@gmail.com>
  • Loading branch information
reubenmiller committed Dec 16, 2023
1 parent c671ebb commit fad8559
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 7 deletions.
33 changes: 26 additions & 7 deletions .github/workflows/test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,9 @@ jobs:
max-parallel: 1
matrix:
job:
- { target: debian-systemd, bootstrap: true }
- { target: alpine-s6, bootstrap: false }
- { target: debian-systemd, bootstrap: "script" }
- { target: alpine-s6, bootstrap: "none" }
- { target: tedge, bootstrap: "container" }

steps:
# Checkout either the PR or the branch
Expand All @@ -55,6 +56,9 @@ jobs:
if: ${{ github.event_name != 'pull_request_target' }}

- uses: reubenmiller/setup-go-c8y-cli@main
- name: install c8y-tedge extension
run: c8y extension install thin-edge/c8y-tedge

- name: create .env file
run: |
touch .env
Expand Down Expand Up @@ -101,12 +105,27 @@ jobs:
- name: Start demo
run: |
# just up-no-cache
just IMAGE=${{matrix.job.target}} up
just IMAGE=${{matrix.job.target}} up >/dev/null 2>&1 &
UP_PID=$!
case "${{matrix.job.bootstrap}}" in
script)
just IMAGE=${{matrix.job.target}} bootstrap --no-prompt
;;
container)
# Wait for container to startup before doing bootstrapping
sleep 5
just IMAGE=${{matrix.job.target}} bootstrap-container "$DEVICE_ID"
;;
*)
echo "Skipping bootstrapping"
;;
esac
if [ "${{matrix.job.bootstrap}}" = "true" ]; then
just bootstrap --no-prompt
fi
# Wait until bootstrap is ready
wait "$UP_PID"
echo "docker compose up is ready"
sleep 5
- name: Run tests
run: just IMAGE=${{matrix.job.target}} test
Expand Down
4 changes: 4 additions & 0 deletions justfile
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,10 @@ down-all:
bootstrap *ARGS:
@docker compose --env-file {{DEV_ENV}} -f images/{{IMAGE}}/docker-compose.yaml exec tedge env C8Y_USER=${C8Y_USER:-} C8Y_PASSWORD=${C8Y_PASSWORD:-} DEVICE_ID=${DEVICE_ID:-} bootstrap.sh {{ARGS}}

# Bootstrap container using the go-c8y-cli c8y-tedge extension
bootstrap-container *ARGS="":
cd "images/{{IMAGE}}" && c8y tedge bootstrap-container bootstrap {{ARGS}}

# Start a shell on the main device
shell *args='bash':
docker compose -f images/{{IMAGE}}/docker-compose.yaml exec tedge {{args}}
Expand Down

0 comments on commit fad8559

Please sign in to comment.