Any templates for same workflow, multiple virtual environments

Hi GitHub Community,

Is there any available workflow templates if I want to test my scripts on both Ubuntu and macOS Catalina?

Hi, did you find what you were looking for in the meantime? It’s not fully clear to me from your question what you look for, but it sounds like you want a single workflow to run with different runners (Ubuntu, macOS). That’s easily achievable with a job matrix:

on: push
jobs:
  job1:
    runs-on: ${{ matrix.os }}
    strategy:
      matrix:
        os: [ubuntu-latest, macos-latest]
    steps:
      - name: Run this for all OSes
        run: |
          echo "os = ${{ matrix.os }}"
      - name: Run this on Linux only
        if: contains(matrix.os, 'ubuntu-')
        run: |
          echo "Linux only"
      - name: Run this on macOS only
        if: contains(matrix.os, 'macos-')
        run: |
          echo "macOS only"

You need to make sure that the code you run works on all runners. You may want to set shell: bash for steps so that it’s the same shell across OSes.

1 Like