How to run Integration just when merging to master











up vote
1
down vote

favorite
1












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 at 19:17












  • @jonrsharpe - yep I try it without success, see my edit please, do you know what am I missing here ?
    – Rayn D
    Nov 17 at 19:22












  • That's just not how conditional stages work; see docs.travis-ci.com/user/conditional-builds-stages-jobs
    – jonrsharpe
    Nov 17 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`` ?
    – Rayn D
    Nov 17 at 19:29












  • @jonrsharpe - can you provide a reference for my issue please?
    – Rayn D
    Nov 17 at 19:30

















up vote
1
down vote

favorite
1












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 at 19:17












  • @jonrsharpe - yep I try it without success, see my edit please, do you know what am I missing here ?
    – Rayn D
    Nov 17 at 19:22












  • That's just not how conditional stages work; see docs.travis-ci.com/user/conditional-builds-stages-jobs
    – jonrsharpe
    Nov 17 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`` ?
    – Rayn D
    Nov 17 at 19:29












  • @jonrsharpe - can you provide a reference for my issue please?
    – Rayn D
    Nov 17 at 19:30















up vote
1
down vote

favorite
1









up vote
1
down vote

favorite
1






1





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 at 8:51









Flimzy

36.1k96496




36.1k96496










asked Nov 17 at 19:16









Rayn D

1251621




1251621












  • Have you tried reading the Travis docs on conditional functionality?
    – jonrsharpe
    Nov 17 at 19:17












  • @jonrsharpe - yep I try it without success, see my edit please, do you know what am I missing here ?
    – Rayn D
    Nov 17 at 19:22












  • That's just not how conditional stages work; see docs.travis-ci.com/user/conditional-builds-stages-jobs
    – jonrsharpe
    Nov 17 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`` ?
    – Rayn D
    Nov 17 at 19:29












  • @jonrsharpe - can you provide a reference for my issue please?
    – Rayn D
    Nov 17 at 19:30




















  • Have you tried reading the Travis docs on conditional functionality?
    – jonrsharpe
    Nov 17 at 19:17












  • @jonrsharpe - yep I try it without success, see my edit please, do you know what am I missing here ?
    – Rayn D
    Nov 17 at 19:22












  • That's just not how conditional stages work; see docs.travis-ci.com/user/conditional-builds-stages-jobs
    – jonrsharpe
    Nov 17 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`` ?
    – Rayn D
    Nov 17 at 19:29












  • @jonrsharpe - can you provide a reference for my issue please?
    – Rayn D
    Nov 17 at 19:30


















Have you tried reading the Travis docs on conditional functionality?
– jonrsharpe
Nov 17 at 19:17






Have you tried reading the Travis docs on conditional functionality?
– jonrsharpe
Nov 17 at 19:17














@jonrsharpe - yep I try it without success, see my edit please, do you know what am I missing here ?
– Rayn D
Nov 17 at 19:22






@jonrsharpe - yep I try it without success, see my edit please, do you know what am I missing here ?
– Rayn D
Nov 17 at 19:22














That's just not how conditional stages work; see docs.travis-ci.com/user/conditional-builds-stages-jobs
– jonrsharpe
Nov 17 at 19:27




That's just not how conditional stages work; see docs.travis-ci.com/user/conditional-builds-stages-jobs
– jonrsharpe
Nov 17 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`` ?
– Rayn D
Nov 17 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`` ?
– Rayn D
Nov 17 at 19:29














@jonrsharpe - can you provide a reference for my issue please?
– Rayn D
Nov 17 at 19:30






@jonrsharpe - can you provide a reference for my issue please?
– Rayn D
Nov 17 at 19:30














1 Answer
1






active

oldest

votes

















up vote
2
down vote



accepted










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',
    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








    up vote
    2
    down vote



    accepted










    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

























      up vote
      2
      down vote



      accepted










      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























        up vote
        2
        down vote



        accepted







        up vote
        2
        down vote



        accepted






        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 at 19:41









        nbp

        382




        382






























             

            draft saved


            draft discarded



















































             


            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







            Popular posts from this blog

            Costa Masnaga

            Fotorealismo

            Sidney Franklin