the same dependency in all workflows / jobs


    runs-on: ubuntu-18.04
    steps:
    - name: checkout
      uses: actions/checkout@v1
      with:
        ref: [this will be different]
        fetch-depth: 1
        token: ${{ secrets.GITHUB\_TOKEN }}

    - name: Install java
      uses: actions/setup-java@v1
      with:
        java-version: '13.0.1'  

    - name: Install clojure
      uses: DeLaGuardo/setup-clojure@2.0
      with:
        tools-deps: '1.10.1.478'  

    - run: npm i
  1. I want to start each workflow file in the same way. Do I have to create github action from that part in the same repository? No other way?

  2. I would like to prepare all dependencies in job and later run a few jobs based on the state of the system after finish job1. Is it possible?

  1. run job 1
    1.a. install java
  2. run job 2, job 3, job 4 on system after finish job 1 (so with java installed)

Do I have to install the same java version for each job separately? And more dependencies.

  • I want to start each workflow file in the same way. Do I have to create github action from that part in the same repository? No other way?

There is not an actions template conception now, if you want to run a group of same actions in different workflows, you need to add those actions in each workflow file now.

  • I would like to prepare all dependencies in job and later run a few jobs based on the state of the system after finish job1. Is it possible?

 

You can use jobs.<job_id>.needs. Identifies any jobs that must complete successfully before this job will run.

Example: 

job needs job.png

For more information, you can refer to https://help.github.com/cn/actions/automating-your-workflow-with-github-actions/workflow-syntax-for-github-actions#jobsjob_idneeds

  • Do I have to install the same java version for each job separately? And more dependencies.

 

Yes, as jobs are separated, each job runs on different machine, you need to install java for each job.

3 Likes

Not what I wanted to hear, but true :slight_smile:

As workaround probably the best way is to create action in the same repository which preapre all dependencies for all workflows and jobs in the same way. Or just use 1 long job.

1 Like