How do I create 2 jobs that run on different platforms?

后端 未结 1 1385
太阳男子
太阳男子 2021-01-21 11:56

I\'m using the Gitlab-ci-multi-runner, using an OSX machine (bash shell) and a Windows 7 machine (batch commands). Whenever I push I want it to build and test on both runners. B

1条回答
  •  醉话见心
    2021-01-21 12:47

    You can use the tag system for runner.

    I suppose that you have two runner. The Windows one with windows as tag and the OS X one with osx as tag.

    So, now you can select runner by reclaim tag before running.

    The used .gitlab-ci.yml should be like this:

    MyWindowsJob:
        tags:
            - windows
        script:
            - echo Say hello from windows
    
    MyOSXJob:
        tags:
            - osx
        script:
            - uname -a
            - echo Say hello from osx
    

    If you will build on more than one version of os you should better add version number in tag. For example:

    1. OS X v10.9 Mavericks: osx and osx_v10.9
    2. OS X v10.10 Yosemite: osx and osx_v10.10
    3. OS X v10.11 El Capitan: osx and osx_v10.11

    0 讨论(0)
提交回复
热议问题