devcontainers / ci

A GitHub Action and Azure DevOps Task designed to simplify using Dev Containers (https://containers.dev) in CI/CD systems.
MIT License
350 stars 56 forks source link

CI step hangs in GitHub Action #255

Closed ruralocity closed 1 year ago

ruralocity commented 1 year ago

Hello, I'm trying to move a GitHub Actions CI workflow to use a pre-existing devcontainer configuration for a Ruby on Rails application. The configuration works locally in VS Code, but I'm having trouble getting it to run as an action. I have a feeling I'm missing something simple.

Following the "simplest example" code from the Getting Started docs:

name: CI
on:
  push:
    branches:
      - my-feature-branch
  pull_request:

jobs:
  tests:
    name: Run test suite
    runs-on: ubuntu-latest

    steps:
      - name: Check out code
        uses: actions/checkout@v3

      - name: Create environment files
        run: |
          cp .env.sample .env

      - name: Run CI
        uses: devcontainers/ci@v0.3
        with:
          runCmd: echo "Hello World!"

The workflow successfully builds the devcontainer, and I see it start up:

 [2023-08-03T22:20:18.662Z] Start: Run: docker-compose --project-name my-app_devcontainer -f /home/runner/work/my-app/my-app/.devcontainer/docker-compose.yml -f /tmp/devcontainercli-runner/docker-compose/docker-compose.devcontainer.build-1691101213357.yml -f /tmp/devcontainercli-runner/docker-compose/docker-compose.devcontainer.containerFeatures-1691101218661.yml up -d

But it hangs at that point, and never runs what I've set in runCmd.

Any guidance is appreciated, thanks!

ruralocity commented 1 year ago

I figured out what was going on—a service I'd defined in the dev container's docker-compose causes CI to hang. I removed it with a workaround and can now build using the Action.