Multiple Run Commands in Named Section

How can I do this? I know you can’t run two run commands like this but…then how?

name: Rull-All-Tests

on:
  push:
    branches:
      - master

jobs:
  tests:
    name: Run all tests
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v2
      - name: Setup node 14
        uses: actions/setup-node@v1
        with:
          node-version: 14.x
      - name: Run GraphQL Tests
        run: yarn --cwd src/graphql --silent && yarn --cwd src/graphql test-graphql-integration
        run: yarn --cwd src/graphql test-graphql-unit

I ended up just doing this but still curious why we can’t just combine into one section like I was trying to do above

- name: Run GraphQL Tests - Integration
        run: yarn --cwd src/graphql --silent && yarn --cwd src/graphql test-graphql-integration
- name: Run GraphQL Tests - Unit
        run: yarn --cwd src/graphql test-graphql-unit

IIUC, you could combine multiple commands into a single run with something like this:

      - name: Run GraphQL Tests
        run: |
          yarn --cwd src/graphql --silent && yarn --cwd src/graphql test-graphql-integration
          yarn --cwd src/graphql test-graphql-unit

HTH

Yes, but the indentation should be like this:

- name: Run GraphQL Tests
  run: |
    yarn --cwd src/graphql --silent && yarn --cwd src/graphql test-graphql-integration
    yarn --cwd src/graphql test-graphql-unit

Thanks. That was a copy-paste error. Should be fixed in my post now.

1 Like