Maria Ines Parnisari
Maria Ines Parnisari

Reputation: 17506

How to wait for two GitHub workflows?

I have a GitHub repository with two workflows that produce three distinct Go code coverage files: workflow A gives me one file, workflow B gives me two files. They both run different tests that hit different lines of code in the same repository.

How can I

  1. wait for both workflows to complete so that I can
  2. combine these three files into one

and produce an accurate code coverage measurement?

Upvotes: 0

Views: 1285

Answers (1)

GuiFalourd
GuiFalourd

Reputation: 23270

You could have a main workflow calling both workflows as reusable workflow.

Then, you would join the files on a last job (in the main workflow) that would start only once the jobs calling reusable workflows finished. This last job would join the files.

Observation: You will probably have to save the files as artifact in each reusable to use them in the main workflow afterward.

Example for the main workflow structure:

jobs:
   job1:
     uses: .github/workflows/reusable-workflow-1.yml@ref

   job2:
     uses: .github/workflows/reusable-workflow-2.yml@ref

   job3:
     needs:
      - job1
      - job2
     runs-on: ...
     steps:
       [ ... ]

Upvotes: 1

Related Questions