How to run Integration just when merging to master












0















I've Travis CI which is working as expected for Go application



language: go
go:

- "1.10.x"

script:

- go get -v -t -d ./...
- go test -v ./...


This CI takes about a 60-80 sec to run.



The CI is triggered in two scenarios





  1. Submitting to new branch

  2. Merging to the master




Now I've new file which is called integration_test.go which is running integration test which takes about 10 min (deployment etc)
and I want to run this test only when merging to the master (since its more heavy) , and not run when submitting to branches, how it can be done it Travis?



I've tried with



on:
branch: master
condition: `go test -v integration_test.go`









share|improve this question

























  • Have you tried reading the Travis docs on conditional functionality?

    – jonrsharpe
    Nov 17 '18 at 19:17













  • @jonrsharpe - yep I try it without success, see my edit please, do you know what am I missing here ?

    – user6124024
    Nov 17 '18 at 19:22













  • That's just not how conditional stages work; see docs.travis-ci.com/user/conditional-builds-stages-jobs

    – jonrsharpe
    Nov 17 '18 at 19:27











  • @jonrsharpe - Ok thanks but How should I tell it run only this test if: branch = master go test -v integration_test.go`` ?

    – user6124024
    Nov 17 '18 at 19:29













  • @jonrsharpe - can you provide a reference for my issue please?

    – user6124024
    Nov 17 '18 at 19:30


















0















I've Travis CI which is working as expected for Go application



language: go
go:

- "1.10.x"

script:

- go get -v -t -d ./...
- go test -v ./...


This CI takes about a 60-80 sec to run.



The CI is triggered in two scenarios





  1. Submitting to new branch

  2. Merging to the master




Now I've new file which is called integration_test.go which is running integration test which takes about 10 min (deployment etc)
and I want to run this test only when merging to the master (since its more heavy) , and not run when submitting to branches, how it can be done it Travis?



I've tried with



on:
branch: master
condition: `go test -v integration_test.go`









share|improve this question

























  • Have you tried reading the Travis docs on conditional functionality?

    – jonrsharpe
    Nov 17 '18 at 19:17













  • @jonrsharpe - yep I try it without success, see my edit please, do you know what am I missing here ?

    – user6124024
    Nov 17 '18 at 19:22













  • That's just not how conditional stages work; see docs.travis-ci.com/user/conditional-builds-stages-jobs

    – jonrsharpe
    Nov 17 '18 at 19:27











  • @jonrsharpe - Ok thanks but How should I tell it run only this test if: branch = master go test -v integration_test.go`` ?

    – user6124024
    Nov 17 '18 at 19:29













  • @jonrsharpe - can you provide a reference for my issue please?

    – user6124024
    Nov 17 '18 at 19:30
















0












0








0








I've Travis CI which is working as expected for Go application



language: go
go:

- "1.10.x"

script:

- go get -v -t -d ./...
- go test -v ./...


This CI takes about a 60-80 sec to run.



The CI is triggered in two scenarios





  1. Submitting to new branch

  2. Merging to the master




Now I've new file which is called integration_test.go which is running integration test which takes about 10 min (deployment etc)
and I want to run this test only when merging to the master (since its more heavy) , and not run when submitting to branches, how it can be done it Travis?



I've tried with



on:
branch: master
condition: `go test -v integration_test.go`









share|improve this question
















I've Travis CI which is working as expected for Go application



language: go
go:

- "1.10.x"

script:

- go get -v -t -d ./...
- go test -v ./...


This CI takes about a 60-80 sec to run.



The CI is triggered in two scenarios





  1. Submitting to new branch

  2. Merging to the master




Now I've new file which is called integration_test.go which is running integration test which takes about 10 min (deployment etc)
and I want to run this test only when merging to the master (since its more heavy) , and not run when submitting to branches, how it can be done it Travis?



I've tried with



on:
branch: master
condition: `go test -v integration_test.go`






git go github travis-ci travis-ci-cli






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Nov 18 '18 at 8:51









Flimzy

38.2k96597




38.2k96597










asked Nov 17 '18 at 19:16







user6124024




















  • Have you tried reading the Travis docs on conditional functionality?

    – jonrsharpe
    Nov 17 '18 at 19:17













  • @jonrsharpe - yep I try it without success, see my edit please, do you know what am I missing here ?

    – user6124024
    Nov 17 '18 at 19:22













  • That's just not how conditional stages work; see docs.travis-ci.com/user/conditional-builds-stages-jobs

    – jonrsharpe
    Nov 17 '18 at 19:27











  • @jonrsharpe - Ok thanks but How should I tell it run only this test if: branch = master go test -v integration_test.go`` ?

    – user6124024
    Nov 17 '18 at 19:29













  • @jonrsharpe - can you provide a reference for my issue please?

    – user6124024
    Nov 17 '18 at 19:30





















  • Have you tried reading the Travis docs on conditional functionality?

    – jonrsharpe
    Nov 17 '18 at 19:17













  • @jonrsharpe - yep I try it without success, see my edit please, do you know what am I missing here ?

    – user6124024
    Nov 17 '18 at 19:22













  • That's just not how conditional stages work; see docs.travis-ci.com/user/conditional-builds-stages-jobs

    – jonrsharpe
    Nov 17 '18 at 19:27











  • @jonrsharpe - Ok thanks but How should I tell it run only this test if: branch = master go test -v integration_test.go`` ?

    – user6124024
    Nov 17 '18 at 19:29













  • @jonrsharpe - can you provide a reference for my issue please?

    – user6124024
    Nov 17 '18 at 19:30



















Have you tried reading the Travis docs on conditional functionality?

– jonrsharpe
Nov 17 '18 at 19:17







Have you tried reading the Travis docs on conditional functionality?

– jonrsharpe
Nov 17 '18 at 19:17















@jonrsharpe - yep I try it without success, see my edit please, do you know what am I missing here ?

– user6124024
Nov 17 '18 at 19:22







@jonrsharpe - yep I try it without success, see my edit please, do you know what am I missing here ?

– user6124024
Nov 17 '18 at 19:22















That's just not how conditional stages work; see docs.travis-ci.com/user/conditional-builds-stages-jobs

– jonrsharpe
Nov 17 '18 at 19:27





That's just not how conditional stages work; see docs.travis-ci.com/user/conditional-builds-stages-jobs

– jonrsharpe
Nov 17 '18 at 19:27













@jonrsharpe - Ok thanks but How should I tell it run only this test if: branch = master go test -v integration_test.go`` ?

– user6124024
Nov 17 '18 at 19:29







@jonrsharpe - Ok thanks but How should I tell it run only this test if: branch = master go test -v integration_test.go`` ?

– user6124024
Nov 17 '18 at 19:29















@jonrsharpe - can you provide a reference for my issue please?

– user6124024
Nov 17 '18 at 19:30







@jonrsharpe - can you provide a reference for my issue please?

– user6124024
Nov 17 '18 at 19:30














1 Answer
1






active

oldest

votes


















2














What you're likely looking for here is a 'Conditional job'. Using the example here:
https://docs.travis-ci.com/user/build-stages/matrix-expansion/



try:



language: go

go:
- "1.10.x"

script:
- go get -v -t -d ./...
- go test -v ./...

jobs:
include:
- stage: integration
if: branch = master
script: go test -v integration_test.go





share|improve this answer























    Your Answer






    StackExchange.ifUsing("editor", function () {
    StackExchange.using("externalEditor", function () {
    StackExchange.using("snippets", function () {
    StackExchange.snippets.init();
    });
    });
    }, "code-snippets");

    StackExchange.ready(function() {
    var channelOptions = {
    tags: "".split(" "),
    id: "1"
    };
    initTagRenderer("".split(" "), "".split(" "), channelOptions);

    StackExchange.using("externalEditor", function() {
    // Have to fire editor after snippets, if snippets enabled
    if (StackExchange.settings.snippets.snippetsEnabled) {
    StackExchange.using("snippets", function() {
    createEditor();
    });
    }
    else {
    createEditor();
    }
    });

    function createEditor() {
    StackExchange.prepareEditor({
    heartbeatType: 'answer',
    autoActivateHeartbeat: false,
    convertImagesToLinks: true,
    noModals: true,
    showLowRepImageUploadWarning: true,
    reputationToPostImages: 10,
    bindNavPrevention: true,
    postfix: "",
    imageUploader: {
    brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
    contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
    allowUrls: true
    },
    onDemand: true,
    discardSelector: ".discard-answer"
    ,immediatelyShowMarkdownHelp:true
    });


    }
    });














    draft saved

    draft discarded


















    StackExchange.ready(
    function () {
    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53354651%2fhow-to-run-integration-just-when-merging-to-master%23new-answer', 'question_page');
    }
    );

    Post as a guest















    Required, but never shown
























    1 Answer
    1






    active

    oldest

    votes








    1 Answer
    1






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes









    2














    What you're likely looking for here is a 'Conditional job'. Using the example here:
    https://docs.travis-ci.com/user/build-stages/matrix-expansion/



    try:



    language: go

    go:
    - "1.10.x"

    script:
    - go get -v -t -d ./...
    - go test -v ./...

    jobs:
    include:
    - stage: integration
    if: branch = master
    script: go test -v integration_test.go





    share|improve this answer




























      2














      What you're likely looking for here is a 'Conditional job'. Using the example here:
      https://docs.travis-ci.com/user/build-stages/matrix-expansion/



      try:



      language: go

      go:
      - "1.10.x"

      script:
      - go get -v -t -d ./...
      - go test -v ./...

      jobs:
      include:
      - stage: integration
      if: branch = master
      script: go test -v integration_test.go





      share|improve this answer


























        2












        2








        2







        What you're likely looking for here is a 'Conditional job'. Using the example here:
        https://docs.travis-ci.com/user/build-stages/matrix-expansion/



        try:



        language: go

        go:
        - "1.10.x"

        script:
        - go get -v -t -d ./...
        - go test -v ./...

        jobs:
        include:
        - stage: integration
        if: branch = master
        script: go test -v integration_test.go





        share|improve this answer













        What you're likely looking for here is a 'Conditional job'. Using the example here:
        https://docs.travis-ci.com/user/build-stages/matrix-expansion/



        try:



        language: go

        go:
        - "1.10.x"

        script:
        - go get -v -t -d ./...
        - go test -v ./...

        jobs:
        include:
        - stage: integration
        if: branch = master
        script: go test -v integration_test.go






        share|improve this answer












        share|improve this answer



        share|improve this answer










        answered Nov 17 '18 at 19:41









        nbpnbp

        383




        383






























            draft saved

            draft discarded




















































            Thanks for contributing an answer to Stack Overflow!


            • Please be sure to answer the question. Provide details and share your research!

            But avoid



            • Asking for help, clarification, or responding to other answers.

            • Making statements based on opinion; back them up with references or personal experience.


            To learn more, see our tips on writing great answers.




            draft saved


            draft discarded














            StackExchange.ready(
            function () {
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53354651%2fhow-to-run-integration-just-when-merging-to-master%23new-answer', 'question_page');
            }
            );

            Post as a guest















            Required, but never shown





















































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown

































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown







            這個網誌中的熱門文章

            Tangent Lines Diagram Along Smooth Curve

            Yusuf al-Mu'taman ibn Hud

            Zucchini