ddev / ddev-addon-template

Template for DDEV add-ons.
Apache License 2.0
17 stars 17 forks source link

Create a GitHub action that does some of the repetitive work of test workflow #28

Closed rfay closed 1 year ago

rfay commented 1 year ago

The test workflows for this template are repeated in every copied repo, so everything has to be updated when anything breaks, like

But I would think we could create a GitHub action that would package up most of the setup that we do, and then the action could be updated instead of having every add-on repo needing to be updated.

I would think that at least this could be done by an action:

https://github.com/ddev/ddev-addon-template/blob/eba2da81ee29c2c8dfbfb84f9513a9354ec1405e/.github/workflows/tests.yml#L47-L54

and probably this too:

https://github.com/ddev/ddev-addon-template/blob/eba2da81ee29c2c8dfbfb84f9513a9354ec1405e/.github/workflows/tests.yml#L75-L76

Any interest @tyler36 or anybody else? Could be fun!

julienloizelet commented 1 year ago

Hi, I'm interested and I guess I could start working on it next week.

I think the ddev_version value that we pass in the matrix could be an input of the wanted action.

This way, every add-on should look like :

jobs:
  tests:
    defaults:
      run:
        shell: bash

    strategy:
      matrix:
        ddev_version: [stable, HEAD]
      fail-fast: false

    steps: 
    - uses: ddev/add-on-test-init@vx.y.z
        with:
          ddev_version: ${{ matrix.ddev_version }}

    - name: tests
      run: bats tests

What do you think ?

rfay commented 1 year ago

Looking forward to it!

rfay commented 1 year ago

Oh, maybe the action can be created in this repo...

julienloizelet commented 1 year ago

Hi,

Initially, I worked in one of my repositories: https://github.com/julienloizelet/ddev-add-on-test-init

Using one of my add-on, I tested it both "locally" : https://github.com/julienloizelet/ddev-add-on-test-init/actions/runs/5504377779 and from the add-on itself: https://github.com/julienloizelet/ddev-playwright/actions/runs/5504488656

Please let me know what you think.

Some remarks:

Oh, maybe the action can be created in this repo...

Personally, I would prefer to have a separate repo for the following reasons:

Having said that, I can totally understand why you'd want to put the action in this repo. Just let me know and I could do a PR to add the action.yaml here.

Thanks.

tyler36 commented 1 year ago

Fantastic! Hopefully, I can do a test run soon.

rfay commented 1 year ago

I think a separate repo is fine, especially if you'll maintain it :) It can be promoted to ddev org when ready. Thanks!

rfay commented 1 year ago

@julienloizelet DID THIS! Yay!