简体   繁体   中英

How do define certain tests on certain branches?

I am new to gitlab ci/cd. i like how it works. I would like to run certain tests in certain branches. how can i define the same in yml file?

I am using gitlab ci/cd for R package development and using testthat package for unit-testing.

You need to think how to structure your test suites in your branches.

For example, you can name test-suite like /tests/branch_1/ and your branch has name branch_1 , then

test_job:
  script:
    -  test_dir("inst/tests/${CI_COMMIT_REF_NAME}"

where $CI_COMMIT_REF_NAME is your branch or tag name, according to gitlab predefined variables doc , will execute the test-suite with the same name your branch name is.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM