Bring up an OS from matrix in step1 , compile code in step2 depends on step1, run tests from matrix

What I want to do:

  • Bring up 1 system based on matrix.os in step ‘build’

  • Run N test cases using matrix.test-name in step ‘tests’

What I don’t want:

  • Bringing up N system that each run 1 test case which is what I get now.

  • Having to write a script to wrap all the test cases

Eventually, I want:

A. Bring up all the systems in matrix.os and matrix.python-version and matrix.cflag-options

B. Run N test cases on each of the systems in A

Can someone point me to a good example of how to do this or what I can try?

My action.yml below fails

name: Build

    branches: [master]

    name: Compile Code
    runs-on: ${{ matrix.os }}
        os: [ubuntu-latest]
        #os: [ubuntu-latest, macOS-latest]
        #os: [ubuntu-latest, macOS-latest, windows-latest]
        #python-version: [3.6, 3.7]
        python-version: [3.6]
test-name :
          - born
          - geoflow
# - actin-dimer-auto
# - actin-dimer-parallel
# - alkanes
# - FKBP
# - hca-bind
# - ion-pmf
# - ion-protein
# - ionize
# - pka-lig
# - point-pmf
# - solv
# - protein-rn
      - uses: actions/checkout@v1
      - name: Set up Python
        uses: actions/setup-python@v1
          python-version: ${{ matrix.python-version }}
      - name: Prereqs
        uses: mstksg/get-package@v1
          apt-get: bison flex swig libreadline-dev
      - name: Build and Install
        run: |
          echo "==================================== WHERE AM I ==================================== "
          # Make the install directory
          mkdir -p $HOME/local

          echo "==================================== VERSIONS: ==================================== "
          echo "==================================== PYTHON VERSION"
          python -c "import sys; print(sys.version)"
          echo "==================================== CMAKE VERSION"
          cmake --version
          echo "==================================== Gcc VERSION"
          gcc --version
          echo "==================================== G++ VERSION"
          g++ --version
          echo "==================================== SWIG VERSION"
          swig -version

          echo "==================================== Install Python requirements ==================================== "
          pip3 install -U pip
          pip3 install -U pytest
          pip3 install -U virtualenv
          pip3 install -U numpy
          pip3 install -r pdb2pqr/requirements.txt

          # Just build APBS for now
          echo "==================================== PWD FOR TOP DIR ==================================== "

          echo "==================================== Get External SubModules ==================================== "
          git submodule init
          git submodule update
          mkdir build
          cd build
          cmake ..
          make VERBOSE=1
          cd ..

          cd apbs
          echo "==================================== PWD FOR APBS src==================================== "
          mkdir build
          cd build
          echo "==================================== BUILD DIR ==================================== "

          echo "==================================== RUN CMAKE ==================================== "
          cmake ${{ matrix.cflag-options }} -DCMAKE_INSTALL_PREFIX:PATH=$HOME/local .. || exit 1

          echo "==================================== RUN MAKE ==================================== "
          VERBOSE=1 make -j 1 install
    name: Test Code
    needs: build
    runs-on: ${{ matrix.os }}
      - name: Run the tests
        run: |
          # Assume we are in the User's home directory where the top of the repository
          echo "==================================== LOOK for APBS binary ==================================== "
          #echo find $HOME -type f -name apbs
          #find $HOME -type f -name apbs
          echo find $HOME -type f -name
          find $HOME -type f -name libmaloc\*
          echo cd apbs/tests
          cd apbs/tests
          echo pwd
          echo ls
          echo bash $HOME/local/bin ${{ matrix.test-name }}
          bash $HOME/local/bin ${{ matrix.test-name }}

Hello @intendo 

This post was moved to a different board that fits your topic of discussion a bit better. This means you’ll get better engagement on your post, and it keeps our Community organized so users can more easily find information.

As you’ll notice, your Topic is now in the Github Actions board. No action is needed on your part; you can continue the conversation as normal here.

Let me know if you have any other questions or if I can help with anything else.

Greatly appreciated,


@intendo ,

When configuring a workflow, you need to understand:
1) You must and only can specify runner on job-level, and each job runs on only one runner.

2) The runner is assigned when the job startup, and you can’t change the runner during the job is running via a step in this job.

3) You can’t define matrix on workflow-level, you can only define matrix on each job.

4) Each job in the matrix can only take one value from the array of each configuration option, can’t take multiple values from a same configuration option.

5) The matrix configuration options defined on a job can’t available to another job. If you want other jobs can execute the same configuration options, you need to directly define the same matrix on those jobs.

In summary, I think your requests are difficult to achieve.
More details, you can reference the docs about Workflow syntax for GitHub Actions.

1 Like