tpluscode / action-lando-start

MIT License
0 stars 0 forks source link

How to run commands? #7

Closed Crell closed 1 year ago

Crell commented 1 year ago

I'm giving this Action a whirl on a Laravel project with Lando. I can get it to set up correctly, it seems, but I cannot reliably get commands to run inside the app container. That's necessary for doing things like running tests. (Without that, there's not much reason to run Lando in an action.)

I'm trying to do this:


jobs:
    test:
        runs-on: ubuntu-latest
        steps:
            - name: setup-docker
              uses: docker-practice/actions-setup-docker@1.0.4
            - uses: tpluscode/action-setup-lando@master
              with:
                  version: v3.6.5
            - name: Cache Composer packages
              id: composer-cache
              uses: actions/cache@v3
              with:
                  path: vendor
                  key: ${{ runner.os }}-php-${{ hashFiles('**/composer.lock') }}
                  restore-keys: |
                      ${{ runner.os }}-php-
            - run: lando xdebug-on
            - run: lando ssh --command composer install
            - run: lando ssh --command php artisan migrate
            - run: lando ssh --command php artisan db:seed
            - run: echo "::error try to fail"
            - run: lando ssh --command echo "::error try to fail"
            - run: lando ssh --command vendor/bin/phpunit --coverage-clover clover.xml || echo "::error Tests failed."

Unfortunately, every one of those run statements passes with no output, except for the non-lando echo, which just prints the message but still succeeds. I would expect either that or the line after it to fail, or for the phpunit command to fail since I deliberately introduced a failing test.

What am I missing here? The docs so far don't seem to say how to do anything beyond boot it up.

tpluscode commented 1 year ago

Hey, thanks for your question. I never used this action to run lando commands in CI. My use cases so far were to start the services and access them using the *.lndo.site

I also never used lando ssh either at all. Could you share a minimal setup for me to try out?

Crell commented 1 year ago

I ended up doing a manual download of Lando in its own task and running that, as advised by the Lando team in Slack. Once I have it all working I am going to be posting a blog post on the topic.