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

Support Windows and Mac #284

Closed ffMathy closed 7 months ago

ffMathy commented 8 months ago

We want to validate our DevContainer as part of the build, since we've sometimes found differences among Windows and Mac in our DevContainers.

on:
  workflow_dispatch: {}
  push:
    paths:
      - .devcontainer/**

jobs:
  validate:
    name: Validate on ${{ matrix.platform }}
    runs-on: ${{ matrix.platform }}
    strategy:
      fail-fast: false
      matrix:
        platform:
          - ubuntu-latest
          - windows-latest
          - macos-latest

    steps:
      - name: Setup Docker
        uses: docker-practice/actions-setup-docker@master

      - name: Checkout
        uses: actions/checkout@v4
        with:
          fetch-depth: 0

      - name: Execute DevContainer commands
        uses: devcontainers/ci@v0.3.1900000347
        with:
          runCmd: |
            echo "hello world"

But on Windows, we get the following error:

Prepare all required actions
Getting action download info
Download action repository 'devcontainers/ci@v0.3.1900000347' (SHA:691[2](https://github.com/redacted/redacted/actions/runs/8262928689/job/22603298366#step:5:2)4f15[3](https://github.com/redacted/redacted/actions/runs/8262928689/job/22603298366#step:5:3)1ff[4](https://github.com/redacted/redacted/actions/runs/8262928689/job/22603298366#step:5:4)1e7216e9eae6654a740189e4bda)
Run devcontainers/ci@v0.3.1900000347
Starting...
Installing @devcontainers/cli...
** Installing @devcontainers/cli
"C:\Program Files\Git\bin\bash.exe" -c "npm install -g @devcontainers/cli@0"

added 1 package in 8s
Adding --cache-from ghcr.io/redacted/redacted-dev-container:latest to build args
🏗️ build container
  About to run devcontainer build --workspace-folder D:\a\redacted\redacted --image-name ghcr.io/redacted/redacted-dev-container:latest --cache-from ghcr.io/redacted/redacted-dev-container:latest --cache-from ghcr.io/lego/redacted-redacted-container
Error: spawn devcontainer ENOENT
chrmarti commented 7 months ago

We need to look up the executable on the PATH.

I still couldn't get it to work with that on windows-latest because that comes with Windows containers enabled and I couldn't figure out how to switch that to Linux containers. Do you have a different Windows image that comes with Linux containers enabled?

chrmarti commented 7 months ago

Closing as that particular issue is fixed. Still couldn't get it to run due to the missing Windows image with Linux containers.

On Windows runner with Linux Containers: https://github.com/actions/runner-images/issues/252