Skip to content

Commit

Permalink
Convert test action to composite
Browse files Browse the repository at this point in the history
  • Loading branch information
patrick-5546 committed Oct 3, 2023
1 parent 168ae10 commit a74672b
Show file tree
Hide file tree
Showing 2 changed files with 55 additions and 3 deletions.
35 changes: 35 additions & 0 deletions .github/actions/docker-compose.ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
# adapted from https://github.com/microsoft/vscode-dev-containers/blob/main/containers/javascript-node-mongo/.devcontainer/docker-compose.yml
# Note: the "ports" property in this file will not forward from a codespace; add to "forwardPorts" in devcontainer.json instead
version: '3.8'

services:
sailbot-workspace:
build:
context: .
dockerfile: ../../.devcontainer/Dockerfile
volumes:
- ../..:/workspaces/sailbot_workspace:cached

# Overrides default command so things don't shut down after the process ends.
command: sleep infinity

# From run arguments of template repository
cap_add:
- SYS_PTRACE
security_opt:
- seccomp:unconfined
- apparmor:unconfined

# URL: mongodb://localhost:27017
mongodb:
image: mongo:latest
restart: unless-stopped

# Runs on the same network as the workspace container, allows "forwardPorts" in devcontainer.json function.
network_mode: service:sailbot-workspace

# Uncomment to change startup options
# environment:
# MONGO_INITDB_ROOT_USERNAME: root
# MONGO_INITDB_ROOT_PASSWORD: example
# MONGO_INITDB_DATABASE: your-database-here
23 changes: 20 additions & 3 deletions .github/actions/test/action.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,23 @@
name: 'Test'
description: 'Test using devcontainer'
runs:
using: 'docker'
image: '../../../.devcontainer/Dockerfile'
entrypoint: ".github/actions/test/run.sh"
using: "composite"
steps:
- name: List
shell: bash
run: ls

- name: Build
shell: bash
run: docker-compose -f ../docker-compose.ci.yml build

- name: Run
shell: bash
run: docker-compose -f ../docker-compose.ci.yml up -d

- name: Test
shell: bash
run: |
docker-compose -f ../docker-compose.ci.yml exec -u ros sailbot-workspace /bin/bash
cd /workspaces/sailbot_workspace
.github/actions/test/run.sh

0 comments on commit a74672b

Please sign in to comment.