Wrapping workflow in a single action

I have a short workflow that starts out like this:

---
name: MYTESTS-APPROVED
on: [push,pull_request]
jobs:
  build:
    runs-on: ubuntu-latest
    strategy:
      matrix:
        python-version: [3.5,3.6,3.7] # this can be changed by the user
        os: [macOS-latest, ubuntu-latest] # this can be changed by the user
    steps:
    - name: STEP 1. Check-Out Repo
      uses: actions/checkout@v2
    #===============================================#
    - name: STEP 2. Set-Up Python
      uses: actions/setup-python@v1
      with:
        python-version: ${{ matrix.python-version }}
    #===============================================#
    - name: STEP 3. Install dependencies
      run: |
        pip install --upgrade pip setuptools wheel
        pip install --no-binary :all: nmslib
        pip install .
        pip install python-coveralls
    - name: STEP 4. Pytest Coverage
      run: |
        pip install coveralls
        pip install junit2html
        python setup.py test \
             --addopts "--mpl-generate-path=tests/baseline_images \
             --color=yes --cov-config .coveragerc --cov-branch \
             --cov=scedar --junitxml=junitxml-doc.xml"
        junit2html junitxml-doc.xml coverage-report.html

My group is working on a project where we will have people add this .yml file to their github repos where it will be used to run their tests. If the tests pass then they will get our custom badge as a stamp of approval. I would like the .yml file to be as easy and straightfoward to use, so it would be great if I could  wrap this workflow up in a single action and just include the parts they need to configure themselves as inputs for this  action. This way the .yaml file  they see  will  be very simple and straightfoward.

I was thinking about making  a python based action because I’m using strictly python modules anyway.  Can this be done easily? Any help is much appreciated!

1 Like

@benstear ,

As I mentioned in this ticket, I’m afraid it is very hard to wrap multiple jobs/steps into one action.

If the steps you wants to wrap are running some commands, maybe it will be relatively easy to implement, you can try to create an action to execute these commands in order. But if the steps include some other wrapped actions, it will become more troublesome and hard to implement, you may need to re-write these wrapped actions in your custom action so that them can be integrated in to the custom action.

Thanks for your reply. Do you know when/if github actions will be implementing this as a feature?

@benstear ,

The similar feqture requests had been reported to the appropriate engineering team before, and it’s being tracked internally, but I don’t have any timeline to share yet.