Home > OS >  Can we group numbers of run under a name in GitHub Action workflow?
Can we group numbers of run under a name in GitHub Action workflow?

Time:10-11

Currently I have a job which looks like this inside a workflow:

flutter_test:
    name: Run flutter test and analyze
    runs-on: ubuntu-latest
    steps:
      # Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
      - uses: actions/checkout@v2
      - uses: actions/setup-java@v1
        with:
          java-version: "12.x"
      - uses: subosito/[email protected]
        with:
          channel: "stable"
          
      - name: Testing and analyzing paginablelistviewbuilder_example
        run: cd example/paginablelistviewbuilder_example/ && flutter pub get && flutter analyze && flutter test

      - name: Testing and analyzing paginablelistviewbuilder_example
        run: cd example/paginablesliverchildbuilderdelegate_example/ && flutter pub get && flutter analyze && flutter test

      - name: Testing and analyzing paginable
        run: flutter pub get && flutter analyze && flutter test --coverage

      - name: Upload coverage to Codecov
        uses: codecov/codecov-action@v2
        with:
          files: coverage/lcov.info

As you can see the Testing and analyzing paginablelistviewbuilder_example, Testing and analyzing paginablelistviewbuilder_example, and Testing and analyzing paginable has different commands attached together with && operator which make it kind of longer and hard to read.

If there is a way to group runs like the following hypothesis:

- name: Testing and analyzing paginablelistviewbuilder_example
        run: cd example/paginablelistviewbuilder_example/ flutter pub get 
        run: flutter analyze
        run: flutter test

It would make the workflow much readable.

CodePudding user response:

You can use a pipe to run multiline commands

- name: Testing and analyzing paginablelistviewbuilder_example
  run: | 
    cd example/paginablelistviewbuilder_example/ flutter pub get 
    flutter analyze
    flutter test
  • Related