Skip to content

Allow PHP version to be set via argument #34

Open

Description

@longwave

When using this as CI, sometimes you want a matrix of different PHP versions to test against. To do this at the moment you need to disable autostart, set the version, and then manually start, e.g.

      - uses: ddev/github-action-setup-ddev@v1
        with:
          autostart: false

      - name: Setup PHP Version
        run: ddev config --php-version ${{ matrix.php }}

      - name: Start ddev
        run: ddev start

It would be nicer DX if we could just say

      - uses: ddev/github-action-setup-ddev@v1
        with:
          php-version: ${{ matrix.php }}

Activity

  1. alexpott commented on Jul 4, 2024

    @alexpott

    Maybe it should be more flexible something like:

          - uses: ddev/github-action-setup-ddev@v1
            with:
              before-start:
                - ddev config --php-version ${{ matrix.php }}
                - ddev config --something-else ${{ matrix.something }}
    

    Like PHP is just 1 thing you might want to vary by....

  2. donquixote commented on Oct 25, 2024

    @donquixote

    Or could we have a config: key for config overrides?
    This would have the same structure as the config.yaml file.

          - uses: ddev/github-action-setup-ddev@v1
            with:
              ddev-config:
                php_version: ${{ matrix.php }}
  3. donquixote commented on Oct 25, 2024

    @donquixote

    There could be another key for extensions.

          - uses: ddev/github-action-setup-ddev@v1
            with:
              ddev-get:
                - ddev/ddev-drupal-contrib
                - ddev/ddev-selenium-standalone-chrome
              ddev-config:
                php_version: ${{ matrix.php }}
    
  4. tyler36 commented on Sep 24, 2025

    @tyler36

    General ping to see if this is still an issue.

  5. tomasnorre commented on Oct 22, 2025

    @tomasnorre
    Contributor

    I like the suggestion here, I was about to suggest something similar. Today in the https://github.com/tomasnorre/crawler/ I do following.

    sed -i 's/php_version: "8.1"/php_version: "${{ matrix.php }}"/g' .ddev/config.yaml

    as part of my GitHub Action, but that requires a ddev restart afterwards.

    I have some additional wishes, as I "need" a way to define which core to test with.
    Today I do following after the ddev start

    ddev composer require typo3/cms-core=${{ matrix.typo3 }} tomasnorre/crawler=dev-$BRANCH_NAME

    But I would like that to happen before the first ddev start to spare some time.

    Of course it could all be done with some sed commands, but would be nice if it was sort of baked in. As this GitHub Action is used for testing in CI, it makes sense to have some flexibility in that matter from my point of view.

    I would be happy to help implement this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions